Revision: 28331
          http://sourceforge.net/p/bibdesk/svn/28331
Author:   hofman
Date:     2023-07-20 09:18:19 +0000 (Thu, 20 Jul 2023)
Log Message:
-----------
revert last commit, explicit set date added for filtered douments, not sure 
whether generic initializer is called for autosaving mecchanisms

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

Modified: trunk/bibdesk/BDSKDocumentController.m
===================================================================
--- trunk/bibdesk/BDSKDocumentController.m      2023-07-19 17:08:36 UTC (rev 
28330)
+++ trunk/bibdesk/BDSKDocumentController.m      2023-07-20 09:18:19 UTC (rev 
28331)
@@ -350,8 +350,10 @@
             NSURL *tmpFileURL = [[NSFileManager defaultManager] 
temporaryFileURLWithBasename:tmpFileName];
             
             if ([filteredString writeToURL:tmpFileURL atomically:YES 
encoding:encoding error:outError]) {
-                if ((doc = [self makeDocumentForURL:nil 
withContentsOfURL:tmpFileURL ofType:BDSKBibTeXDocumentType error:outError]))
+                if ((doc = [self makeDocumentForURL:nil 
withContentsOfURL:tmpFileURL ofType:BDSKBibTeXDocumentType error:outError])) {
                     [doc setDisplayName:[tmpFileName 
stringByDeletingPathExtension]];
+                    [(BibDocument *)doc markAsImported];
+                }
                 [[NSFileManager defaultManager] removeItemAtPath:[tmpFileURL 
path] error:NULL];
             }
         }

Modified: trunk/bibdesk/BibDocument.h
===================================================================
--- trunk/bibdesk/BibDocument.h 2023-07-19 17:08:36 UTC (rev 28330)
+++ trunk/bibdesk/BibDocument.h 2023-07-20 09:18:19 UTC (rev 28331)
@@ -347,6 +347,7 @@
 - (BOOL)readFromBibTeXData:(NSData *)data string:(NSString *)string 
fromURL:(NSURL *)absoluteURL encoding:(NSStringEncoding)encoding error:(NSError 
**)outError;
 
 - (void)reportTemporaryCiteKeysForNewDocument:(BOOL)isNewFile;
+- (void)markAsImported;
 
 - (NSString *)bibTeXStringDroppingInternal:(BOOL)drop forPublications:(NSArray 
*)items;
 - (NSString *)previewBibTeXStringForPublications:(NSArray *)items;

Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2023-07-19 17:08:36 UTC (rev 28330)
+++ trunk/bibdesk/BibDocument.m 2023-07-20 09:18:19 UTC (rev 28331)
@@ -267,18 +267,6 @@
 
 - (void)encodeWithCoder:(NSCoder *)encoder {}
 
-- (id)initForURL:(NSURL *)urlOrNil withContentsOfURL:(NSURL *)contentsURL 
ofType:(NSString *)typeName error:(NSError * _Nullable *)outError {
-    self = [super initForURL:urlOrNil withContentsOfURL:contentsURL 
ofType:typeName error:outError];
-    if (self) {
-        // set date-added for imports
-        NSDate *importDate = [NSDate date];
-        NSString *importDateDescription = [importDate standardDescription];
-        for (BibItem *pub in publications)
-            [pub markNeWithDate:importDate description:importDateDescription];
-    }
-    return self;
-}
-
 - (void)invalidateSearchFieldCellTimer{
     // AppKit bug workarounds:  NSSearchFieldCell's timer creates a retain 
cycle after typing in it, so we manually invalidate it when the document is 
deallocated to avoid leaking the cell and timer.  Further, if the insertion 
point is in the searchfield cell when the window closes, the field editor (and 
associated text system) and undo manager also leak, so we send -[documentWindow 
endEditingFor:nil] in windowWillClose:.
     id timer = [[searchField cell] valueForKey:@"_partialStringTimer"];
@@ -1986,6 +1974,14 @@
 
 #pragma mark -
 
+- (void)markAsImported {
+    // set date-added for imports
+    NSDate *importDate = [NSDate date];
+    NSString *importDateDescription = [importDate standardDescription];
+    for (BibItem *pub in publications)
+        [pub markNeWithDate:importDate description:importDateDescription];
+}
+
 - (void)generateForTemporaryCiteKey:(NSString *)tmpKey {
     NSArray *selItems = [self selectedPublications];
     [self selectPublications:[[self publications] allItemsForCiteKey:tmpKey]];

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