Revision: 28271
          http://sourceforge.net/p/bibdesk/svn/28271
Author:   hofman
Date:     2023-05-31 22:20:25 +0000 (Wed, 31 May 2023)
Log Message:
-----------
Mark cite key as edited when reading for document rather than in init, so it is 
not marked for items imported from an external file

Modified Paths:
--------------
    trunk/bibdesk/BibDocument.m
    trunk/bibdesk/BibItem.h
    trunk/bibdesk/BibItem.m

Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2023-05-31 17:12:24 UTC (rev 28270)
+++ trunk/bibdesk/BibDocument.m 2023-05-31 22:20:25 UTC (rev 28271)
@@ -1855,6 +1855,9 @@
     
     newPubs = [BDSKBibTeXParser itemsFromData:data macros:&newMacros 
documentInfo:&newDocumentInfo groups:&newGroups frontMatter:&newFrontMatter 
filePath:[fileURL path] owner:self encoding:parserEncoding error:&error];
     
+    // do not autogenerate the cite key, unless it is empty or a placeholder
+    [newPubs makeObjectsPerformSelector:@selector(markCiteKeyEdited)];
+    
     // @@ move this to NSDocumentController; need to figure out where to add 
it, though
     // @@ should we check for kBDSKBibTeXParserFailed instead? The difference 
is whether we ignore warnings for circular macros 
(kBDSKParserIgnoredFrontMatter), which we used to do
     if (error) {

Modified: trunk/bibdesk/BibItem.h
===================================================================
--- trunk/bibdesk/BibItem.h     2023-05-31 17:12:24 UTC (rev 28270)
+++ trunk/bibdesk/BibItem.h     2023-05-31 22:20:25 UTC (rev 28271)
@@ -451,6 +451,8 @@
 
 - (void)markNeWithDate:(NSDate *)date description:(NSString *)dateDescription;
 
+- (void)markCiteKeyEdited;
+
 /*!
        @method     setPubType:withModDate:
        @abstract   Basic setter for the publication type, with undo. Sets up 
the fields if necessary.

Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m     2023-05-31 17:12:24 UTC (rev 28270)
+++ trunk/bibdesk/BibItem.m     2023-05-31 22:20:25 UTC (rev 28271)
@@ -294,7 +294,7 @@
             [self markNeWithDate:date description:[date standardDescription]];
         }
         
-        hasEditedCiteKey = isNew == NO && [self hasEmptyOrDefaultCiteKey] == 
NO;
+        hasEditedCiteKey = NO;
         
         filesToBeFiled = nil;
         localUrlNeedsToBeFiled = NO;
@@ -581,6 +581,10 @@
     [self setDateModified:date];
 }
 
+- (void)markCiteKeyEdited {
+    hasEditedCiteKey = NO == [self hasEmptyOrDefaultCiteKey];
+}
+
 #pragma mark Archiving
 
 + (NSData *)archivedPublications:(NSArray *)array {

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