Revision: 28803
http://sourceforge.net/p/bibdesk/svn/28803
Author: hofman
Date: 2024-02-23 13:53:53 +0000 (Fri, 23 Feb 2024)
Log Message:
-----------
let bibitem notify document about automatic file migration directly instead of
posting a notification
Modified Paths:
--------------
trunk/bibdesk/BDSKStringConstants.h
trunk/bibdesk/BDSKStringConstants.m
trunk/bibdesk/BibDocument.h
trunk/bibdesk/BibDocument.m
trunk/bibdesk/BibDocument_UI.m
trunk/bibdesk/BibItem.m
Modified: trunk/bibdesk/BDSKStringConstants.h
===================================================================
--- trunk/bibdesk/BDSKStringConstants.h 2024-02-23 10:39:56 UTC (rev 28802)
+++ trunk/bibdesk/BDSKStringConstants.h 2024-02-23 13:53:53 UTC (rev 28803)
@@ -322,7 +322,6 @@
extern NSString *BDSKDocumentControllerDidChangeMainDocumentNotification;
extern NSString *BDSKDocumentDidChangeLinkedFilesNotification;
extern NSString *BDSKEncodingsListChangedNotification;
-extern NSString *BDSKTemporaryFileMigrationNotification;
extern NSString *BDSKFlagsChangedNotification;
extern NSString *BDSKOrphanedFilesFinderFinishedNotification;
extern NSString *BDSKExportTemplatesChangedNotification;
Modified: trunk/bibdesk/BDSKStringConstants.m
===================================================================
--- trunk/bibdesk/BDSKStringConstants.m 2024-02-23 10:39:56 UTC (rev 28802)
+++ trunk/bibdesk/BDSKStringConstants.m 2024-02-23 13:53:53 UTC (rev 28803)
@@ -332,7 +332,6 @@
NSString *BDSKDocumentControllerDidChangeMainDocumentNotification =
@"BDSKDocumentControllerDidChangeMainDocumentNotification";
NSString *BDSKDocumentDidChangeLinkedFilesNotification =
@"BDSKDocumentDidChangeLinkedFilesNotification";
NSString *BDSKEncodingsListChangedNotification =
@"BDSKEncodingsListChangedNotification";
-NSString *BDSKTemporaryFileMigrationNotification =
@"BDSKTemporaryFileMigrationNotification";
NSString *BDSKFlagsChangedNotification = @"BDSKFlagsChangedNotification";
NSString *BDSKOrphanedFilesFinderFinishedNotification =
@"BDSKOrphanedFilesFinderFinishedNotification";
NSString *BDSKExportTemplatesChangedNotification =
@"BDSKExportTemplatesChangedNotification";
Modified: trunk/bibdesk/BibDocument.h
===================================================================
--- trunk/bibdesk/BibDocument.h 2024-02-23 10:39:56 UTC (rev 28802)
+++ trunk/bibdesk/BibDocument.h 2024-02-23 13:53:53 UTC (rev 28803)
@@ -420,6 +420,8 @@
@property (nonatomic) NSStringEncoding documentStringEncoding;
+- (void)publicationDidAutoConvertFiles;
+
- (BDSKAutoGenerateStatus)userChangedField:(NSString *)fieldName
ofPublications:(NSArray *)pubs from:(NSArray *)oldValues to:(NSArray
*)newValues;
- (BDSKAutoGenerateStatus)userChangedField:(NSString *)fieldName
ofPublication:(BibItem *)pub from:(id)oldValue to:(id)newValue;
Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2024-02-23 10:39:56 UTC (rev 28802)
+++ trunk/bibdesk/BibDocument.m 2024-02-23 13:53:53 UTC (rev 28803)
@@ -314,6 +314,12 @@
[self runScriptHookWithName:BDSKScriptHookNameOpenDocument
forPublications:nil];
}
+- (void)publicationDidAutoConvertFiles {
+ // display after the window loads so we can use a sheet, and the migration
controller window is in front
+ if (docFlags.displayMigrationAlert == NO && [[NSUserDefaults
standardUserDefaults] boolForKey:BDSKDisableMigrationWarningKey] == NO)
+ docFlags.displayMigrationAlert = YES;
+}
+
- (void)windowControllerDidLoadNib:(NSWindowController *) aController
{
[groupOutlineView setStronglyReferencesItems:YES];
Modified: trunk/bibdesk/BibDocument_UI.m
===================================================================
--- trunk/bibdesk/BibDocument_UI.m 2024-02-23 10:39:56 UTC (rev 28802)
+++ trunk/bibdesk/BibDocument_UI.m 2024-02-23 13:53:53 UTC (rev 28803)
@@ -91,8 +91,6 @@
#import "BDSKZoomablePDFView.h"
#import "BDSKStatusBar.h"
-#define BDSKDisableMigrationWarningKey @"BDSKDisableMigrationWarning"
-
static char BDSKDocumentFileViewObservationContext;
static char BDSKDocumentOutlineViewObservationContext;
static char BDSKDocumentDefaultsObservationContext;
@@ -1585,12 +1583,6 @@
[self updatePreviews];
}
-- (void)handleTemporaryFileMigrationNotification:(NSNotification
*)notification{
- // display after the window loads so we can use a sheet, and the migration
controller window is in front
- if ([[NSUserDefaults standardUserDefaults]
boolForKey:BDSKDisableMigrationWarningKey] == NO)
- docFlags.displayMigrationAlert = YES;
-}
-
- (void)handleSkimFileDidSaveNotification:(NSNotification *)notification{
NSString *path = [notification object];
@@ -1688,10 +1680,6 @@
selector:@selector(handleApplicationDidBecomeActiveNotification:)
name:NSApplicationDidBecomeActiveNotification
object:nil];
- [nc addObserver:self
- selector:@selector(handleTemporaryFileMigrationNotification:)
- name:BDSKTemporaryFileMigrationNotification
- object:self];
// observe this on behalf of our BibItems, or else all BibItems register
for these notifications and -[BibItem dealloc] gets expensive when
unregistering; this means that (shared) items without a document won't get
these notifications
[nc addObserver:self
selector:@selector(handleCustomFieldsDidChangeNotification:)
Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m 2024-02-23 10:39:56 UTC (rev 28802)
+++ trunk/bibdesk/BibItem.m 2024-02-23 13:53:53 UTC (rev 28803)
@@ -4180,10 +4180,8 @@
removeMask |= BDSKRemoveRemoteURLFields;
[self migrateFilesWithRemoveOptions:removeMask
numberOfAddedFiles:&added numberOfRemovedFields:NULL error:NULL];
// Don't post this unless the owner is a document. At present, if we
open a URL group using a local file on disk that has valid URLs, this method
will be called and it will end up with BDSKLinkedFile instances. If we then
click the "Import" button in the document, no warning is displayed because we
don't call migrateFilesAndRemove:... again.
- if (added > 0) {
- NSNotification *note = [NSNotification
notificationWithName:BDSKTemporaryFileMigrationNotification object:[self
owner]];
- [[NSNotificationQueue defaultQueue] enqueueNotification:note
postingStyle:NSPostNow coalesceMask:NSNotificationCoalescingOnName
forModes:@[NSDefaultRunLoopMode]];
- }
+ if (added > 0 && [[self owner] isDocument])
+ [(BibDocument *)[self owner] publicationDidAutoConvertFiles];
}
}
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