Revision: 29256 http://sourceforge.net/p/bibdesk/svn/29256 Author: hofman Date: 2025-05-01 12:06:16 +0000 (Thu, 01 May 2025) Log Message: ----------- Use only typeTag and not type propeerty
Modified Paths: -------------- trunk/bibdesk/BDSKSearchGroupSheetController.h trunk/bibdesk/BDSKSearchGroupSheetController.m Modified: trunk/bibdesk/BDSKSearchGroupSheetController.h =================================================================== --- trunk/bibdesk/BDSKSearchGroupSheetController.h 2025-05-01 11:53:09 UTC (rev 29255) +++ trunk/bibdesk/BDSKSearchGroupSheetController.h 2025-05-01 12:06:16 UTC (rev 29256) @@ -113,8 +113,6 @@ @property (nonatomic, getter=isEditable) BOOL editable; @property (nonatomic, getter=isResettable) BOOL resettable; -@property (nonatomic, strong) NSString *type; - @property (nonatomic) NSInteger typeTag; @property (nonatomic, readonly) NSArray *databases; Modified: trunk/bibdesk/BDSKSearchGroupSheetController.m =================================================================== --- trunk/bibdesk/BDSKSearchGroupSheetController.m 2025-05-01 11:53:09 UTC (rev 29255) +++ trunk/bibdesk/BDSKSearchGroupSheetController.m 2025-05-01 12:06:16 UTC (rev 29256) @@ -59,10 +59,10 @@ + (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key { NSSet *keyPaths = [super keyPathsForValuesAffectingValueForKey:key]; - if ([@"type" isEqualToString:key]) + if ([@"typeTag" isEqualToString:key]) keyPaths = [keyPaths setByAddingObject:@"serverInfo"]; - else if ([[NSSet setWithObjects:@"typeTag", @"databases", nil] containsObject:key]) - keyPaths = [keyPaths setByAddingObject:@"type"]; + else if ([@"databases" isEqualToString:key]) + keyPaths = [keyPaths setByAddingObject:@"typeTag"]; return keyPaths; } @@ -103,9 +103,9 @@ - (void)changeOptions { while ([syntaxPopup numberOfItems] > 1) [syntaxPopup removeItemAtIndex:1]; - if ([[self type] isEqualToString:BDSKSearchGroupZoom]) + if ([[[self serverInfo] type] isEqualToString:BDSKSearchGroupZoom]) [syntaxPopup addItemsWithTitles:[BDSKZoomGroupServer supportedRecordSyntaxes]]; - else if ([[self type] isEqualToString:BDSKSearchGroupSRU]) + else if ([[[self serverInfo] type] isEqualToString:BDSKSearchGroupSRU]) [syntaxPopup addItemsWithTitles:[BDSKSRUGroupServer supportedRecordSyntaxes]]; NSString *value = [serverInfo recordSyntax]; @@ -189,7 +189,7 @@ [editButton setToolTip:NSLocalizedString(@"Edit the selected default server settings", @"Tool tip message")]; if (i == [sender numberOfItems] - 1) { - [self setServerInfo:originalServerInfo ?: [BDSKServerInfo defaultServerInfoWithType:[self type]]]; + [self setServerInfo:originalServerInfo ?: [BDSKServerInfo defaultServerInfoWithType:[[self serverInfo] type]]]; if ([revealButton state] == NSOffState) [revealButton performClick:self]; [self setCustom:YES]; @@ -344,15 +344,6 @@ } [self changeOptions]; } - -- (NSString *)type { return [serverInfo type] ?: BDSKSearchGroupEntrez; } - -- (void)setType:(NSString *)newType { - if ([newType isEqualToString:[serverInfo type]] == NO) { - [serverInfo setType:newType]; - [self changeOptions]; - } -} - (NSInteger)typeTag { return [serverInfo serverType]; @@ -359,14 +350,16 @@ } - (void)setTypeTag:(NSInteger)tag { - // use [self setType:] to trigger KVO - switch (tag) { - case BDSKServerTypeEntrez: [self setType:BDSKSearchGroupEntrez]; break; - case BDSKServerTypeZoom: [self setType:BDSKSearchGroupZoom]; break; - case BDSKServerTypeSRU: [self setType:BDSKSearchGroupSRU]; break; - case BDSKServerTypeDBLP: [self setType:BDSKSearchGroupDBLP]; break; - case BDSKServerTypeISI: [self setType:BDSKSearchGroupISI]; break; - default: BDSKASSERT_NOT_REACHED("Unknown search type tag"); + if (tag != [serverInfo serverType]) { + switch (tag) { + case BDSKServerTypeEntrez: [serverInfo setType:BDSKSearchGroupEntrez]; break; + case BDSKServerTypeZoom: [serverInfo setType:BDSKSearchGroupZoom]; break; + case BDSKServerTypeSRU: [serverInfo setType:BDSKSearchGroupSRU]; break; + case BDSKServerTypeDBLP: [serverInfo setType:BDSKSearchGroupDBLP]; break; + case BDSKServerTypeISI: [serverInfo setType:BDSKSearchGroupISI]; break; + default: BDSKASSERT_NOT_REACHED("Unknown search type tag"); + } + [self changeOptions]; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit