Revision: 28178 http://sourceforge.net/p/bibdesk/svn/28178 Author: hofman Date: 2023-02-23 22:23:08 +0000 (Thu, 23 Feb 2023) Log Message: ----------- Do auto generate cite key for imported pubs that have a cite key set when autogenerating pref is set. Set a flag in BibItem when the citeKey is changed, so we don't keep generating.
Modified Paths: -------------- trunk/bibdesk/BibItem.h trunk/bibdesk/BibItem.m Modified: trunk/bibdesk/BibItem.h =================================================================== --- trunk/bibdesk/BibItem.h 2023-02-23 22:10:46 UTC (rev 28177) +++ trunk/bibdesk/BibItem.h 2023-02-23 22:23:08 UTC (rev 28178) @@ -108,6 +108,7 @@ NSMutableDictionary *URLs; NSNumber * fileOrder; BOOL hasBeenEdited; + BOOL citeKeyEdited; NSMutableSet *filesToBeFiled; BOOL localUrlNeedsToBeFiled; id<BDSKOwner> owner; Modified: trunk/bibdesk/BibItem.m =================================================================== --- trunk/bibdesk/BibItem.m 2023-02-23 22:10:46 UTC (rev 28177) +++ trunk/bibdesk/BibItem.m 2023-02-23 22:23:08 UTC (rev 28178) @@ -294,6 +294,8 @@ [self markNeWithDate:date description:[date standardDescription]]; } + citeKeyEdited = NO; + filesToBeFiled = nil; localUrlNeedsToBeFiled = NO; @@ -381,6 +383,7 @@ macroResolver = nil; fileOrder = nil; hasBeenEdited = YES; + citeKeyEdited = NO; // we don't bother encoding this spotlightMetadataChanged = YES; identifierURL = createUniqueURL(); @@ -1062,6 +1065,7 @@ // no need to further call updateMetadataForKey: hasBeenEdited = YES; spotlightMetadataChanged = YES; + citeKeyEdited = NO == [self hasEmptyOrDefaultCiteKey]; NSDictionary *notifInfo = [NSDictionary dictionaryWithObjectsAndKeys:BDSKCiteKeyString, BDSKBibItemKeyKey, newCiteKey, BDSKBibItemNewValueKey, oldCiteKey, BDSKBibItemOldValueKey, nil]; @@ -1089,7 +1093,7 @@ NSArray *requiredFields = [[BDSKTypeManager sharedManager] requiredFieldsForCiteKey]; // see if it needs to be set (hasEmptyOrDefaultCiteKey) - if (nil == requiredFields || [self hasEmptyOrDefaultCiteKey] == NO) + if (nil == requiredFields || citeKeyEdited) return NO; // see if we have enough fields to generate it 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