Revision: 29326 http://sourceforge.net/p/bibdesk/svn/29326 Author: hofman Date: 2025-07-22 15:02:50 +0000 (Tue, 22 Jul 2025) Log Message: ----------- no need to pass new cite key or crossref when it was changed
Modified Paths: -------------- trunk/bibdesk/BDSKPublicationsArray.h trunk/bibdesk/BDSKPublicationsArray.m trunk/bibdesk/BibDocument_UI.m Modified: trunk/bibdesk/BDSKPublicationsArray.h =================================================================== --- trunk/bibdesk/BDSKPublicationsArray.h 2025-07-22 14:57:58 UTC (rev 29325) +++ trunk/bibdesk/BDSKPublicationsArray.h 2025-07-22 15:02:50 UTC (rev 29326) @@ -58,10 +58,10 @@ - (nullable BibItem *)itemForCiteKey:(NSString *)key; - (nullable NSArray *)allItemsForCiteKey:(NSString *)key; -- (void)changeCiteKey:(NSString *)oldKey toCiteKey:(NSString *)newKey forItem:(BibItem *)anItem; +- (void)changeCiteKey:(NSString *)oldKey forItem:(BibItem *)anItem; - (nullable NSArray *)allItemsForCrossref:(NSString *)key; -- (void)changeCrossref:(nullable NSString *)oldKey toCrossref:(nullable NSString *)newKey forItem:(BibItem *)anItem; +- (void)changeCrossref:(nullable NSString *)oldKey forItem:(BibItem *)anItem; - (nullable BibItem *)itemForIdentifierURL:(NSURL *)aURL; - (nullable NSArray *)itemsForIdentifierURLs:(NSArray *)anArray; Modified: trunk/bibdesk/BDSKPublicationsArray.m =================================================================== --- trunk/bibdesk/BDSKPublicationsArray.m 2025-07-22 14:57:58 UTC (rev 29325) +++ trunk/bibdesk/BDSKPublicationsArray.m 2025-07-22 15:02:50 UTC (rev 29326) @@ -257,10 +257,10 @@ #pragma mark Items for cite keys -- (void)changeCiteKey:(NSString *)oldKey toCiteKey:(NSString *)newKey forItem:(BibItem *)anItem; +- (void)changeCiteKey:(NSString *)oldKey forItem:(BibItem *)anItem; { [self removeItem:anItem forCiteKey:oldKey]; - [self addItem:anItem forCiteKey:newKey]; + [self addItem:anItem forCiteKey:[anItem citeKey]]; } - (BibItem *)itemForCiteKey:(NSString *)key; @@ -273,7 +273,7 @@ - (NSArray *)allItemsForCiteKey:(NSString *)key; { - if ([NSString isEmptyString:key] == NO) + if ([NSString isEmptyString:key] == NO) return [itemsForCiteKeys objectForKey:key]; return nil; } @@ -280,9 +280,10 @@ #pragma mark Items for crossrefs -- (void)changeCrossref:(NSString *)oldKey toCrossref:(NSString *)newKey forItem:(BibItem *)anItem { +- (void)changeCrossref:(NSString *)oldKey forItem:(BibItem *)anItem { if ([NSString isEmptyString:oldKey] == NO) [self removeItem:anItem forCrossref:oldKey]; + NSString *newKey = [anItem valueOfField:BDSKCrossrefString inherit:NO]; if ([NSString isEmptyString:newKey] == NO) [self addItem:anItem forCrossref:newKey]; } Modified: trunk/bibdesk/BibDocument_UI.m =================================================================== --- trunk/bibdesk/BibDocument_UI.m 2025-07-22 14:57:58 UTC (rev 29325) +++ trunk/bibdesk/BibDocument_UI.m 2025-07-22 15:02:50 UTC (rev 29326) @@ -1424,7 +1424,7 @@ // when the crossref changes, all ionherited fields can change if ([changedKey isEqualToString:BDSKCrossrefString]) { - [publications changeCrossref:[userInfo objectForKey:BDSKBibItemOldValueKey] toCrossref:[pub valueOfField:BDSKCrossrefString inherit:NO] forItem:pub]; + [publications changeCrossref:[userInfo objectForKey:BDSKBibItemOldValueKey] forItem:pub]; changedKey = nil; } @@ -1431,7 +1431,7 @@ // need to handle cite keys and crossrefs if a cite key changed if([changedKey isEqualToString:BDSKCiteKeyString]){ oldKey = [userInfo objectForKey:BDSKBibItemOldValueKey]; - [publications changeCiteKey:oldKey toCiteKey:key forItem:pub]; + [publications changeCiteKey:oldKey forItem:pub]; if([NSString isEmptyString:oldKey] || [oldKey isEqualToString:[BibItem defaultCiteKey]] || [NSString isEmptyString:key] || [key isEqualToString:[BibItem defaultCiteKey]] || [[self undoManager] isUndoing] || [[self undoManager] isRedoing]) oldKey = nil; } 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