Revision: 27687
          http://sourceforge.net/p/bibdesk/svn/27687
Author:   hofman
Date:     2022-07-04 09:15:00 +0000 (Mon, 04 Jul 2022)
Log Message:
-----------
When the crossref changes, all fields can change. Also when the cite key of the 
parent changes, inherited fields of child can change. Need full update of all 
derived data and UI.

Modified Paths:
--------------
    trunk/bibdesk/BibDocument_UI.m
    trunk/bibdesk/BibItem.m

Modified: trunk/bibdesk/BibDocument_UI.m
===================================================================
--- trunk/bibdesk/BibDocument_UI.m      2022-07-04 06:30:11 UTC (rev 27686)
+++ trunk/bibdesk/BibDocument_UI.m      2022-07-04 09:15:00 UTC (rev 27687)
@@ -1415,6 +1415,10 @@
     NSString *key = [pub citeKey];
     NSString *oldKey = nil;
     
+    // when the crossref changes, all ionherited fields can change
+    if ([changedKey isEqualToString:BDSKCrossrefString])
+        changedKey = nil;
+    
     // need to handle cite keys and crossrefs if a cite key changed
     if([changedKey isEqualToString:BDSKCiteKeyString]){
         oldKey = [userInfo objectForKey:BDSKBibItemOldValueKey];
@@ -1424,7 +1428,8 @@
     }
     
     // All Fields contains all dependencies of any search field
-    if (searchKeyDependsOnKey(BDSKAllFieldsString, changedKey))
+    BOOL shouldReindex = searchKeyDependsOnKey(BDSKAllFieldsString, 
changedKey);
+    if (shouldReindex)
         [publications reindexPublication:pub];
     
     if ([changedKey isEqualToString:BDSKLocalFileString]) {
@@ -1449,7 +1454,13 @@
         // invalidate groups that depend on inherited values
         if ([NSString isEmptyString:crossref] == NO && [key 
isCaseInsensitiveEqual:crossref]) {
             [aPub invalidateGroupNames];
+            // inherited fields are also searched
+            if (shouldReindex)
+                [publications reindexPublication:aPub];
             [changedPublications addObject:aPub];
+            // all inherited fields could change when parent is created, needs 
full UI update
+            if ([changedKey isEqualToString:BDSKCiteKeyString])
+                changedKey = nil;
         }
         
         // change the crossrefs if we change the parent cite key

Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m     2022-07-04 06:30:11 UTC (rev 27686)
+++ trunk/bibdesk/BibItem.m     2022-07-04 09:15:00 UTC (rev 27687)
@@ -4094,7 +4094,7 @@
        hasBeenEdited = YES;
     spotlightMetadataChanged = YES;   
     
-    BOOL allFieldsChanged = [BDSKAllFieldsString isEqualToString:key];
+    BOOL allFieldsChanged = [BDSKAllFieldsString isEqualToString:key] || 
[BDSKCrossrefString isEqualToString:key];
     
     // invalidate people (authors, editors, etc.) if necessary
     // invalidate the URLs; they are rebuilt when needed

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to