Revision: 27566 http://sourceforge.net/p/bibdesk/svn/27566 Author: hofman Date: 2022-06-06 14:13:54 +0000 (Mon, 06 Jun 2022) Log Message: ----------- Let the document post notification when linked files change for search indexes. Rename notification key.
Modified Paths: -------------- trunk/bibdesk/BDSKFileSearchIndex.m trunk/bibdesk/BDSKNotesSearchIndex.m trunk/bibdesk/BDSKStringConstants.h trunk/bibdesk/BDSKStringConstants.m trunk/bibdesk/BibDocument_UI.m trunk/bibdesk/BibItem.m Modified: trunk/bibdesk/BDSKFileSearchIndex.m =================================================================== --- trunk/bibdesk/BDSKFileSearchIndex.m 2022-06-06 09:26:17 UTC (rev 27565) +++ trunk/bibdesk/BDSKFileSearchIndex.m 2022-06-06 14:13:54 UTC (rev 27566) @@ -115,7 +115,7 @@ }); NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - [nc addObserver:self selector:@selector(processInfoChangedNotification:) name:BDSKFileSearchIndexInfoChangedNotification object:owner]; + [nc addObserver:self selector:@selector(processInfoChangedNotification:) name:BDSKDocumentDidChangeLinkedFilesNotification object:owner]; [nc addObserver:self selector:@selector(processAddItemNotification:) name:BDSKDocumentDidAddItemNotification object:owner]; [nc addObserver:self selector:@selector(processDelItemNotification:) name:BDSKDocumentWillRemoveItemNotification object:owner]; Modified: trunk/bibdesk/BDSKNotesSearchIndex.m =================================================================== --- trunk/bibdesk/BDSKNotesSearchIndex.m 2022-06-06 09:26:17 UTC (rev 27565) +++ trunk/bibdesk/BDSKNotesSearchIndex.m 2022-06-06 14:13:54 UTC (rev 27566) @@ -75,7 +75,7 @@ [self resetWithPublications:[owner publications]]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - [nc addObserver:self selector:@selector(processAddItemNotification:) name:BDSKFileSearchIndexInfoChangedNotification object:owner]; + [nc addObserver:self selector:@selector(processAddItemNotification:) name:BDSKDocumentDidChangeLinkedFilesNotification object:owner]; [nc addObserver:self selector:@selector(processAddItemNotification:) name:BDSKDocumentDidAddItemNotification object:owner]; [nc addObserver:self selector:@selector(processDelItemNotification:) name:BDSKDocumentWillRemoveItemNotification object:owner]; Modified: trunk/bibdesk/BDSKStringConstants.h =================================================================== --- trunk/bibdesk/BDSKStringConstants.h 2022-06-06 09:26:17 UTC (rev 27565) +++ trunk/bibdesk/BDSKStringConstants.h 2022-06-06 14:13:54 UTC (rev 27566) @@ -319,7 +319,7 @@ extern NSString *BDSKDocumentControllerAddDocumentNotification; extern NSString *BDSKDocumentControllerRemoveDocumentNotification; extern NSString *BDSKDocumentControllerDidChangeMainDocumentNotification; -extern NSString *BDSKFileSearchIndexInfoChangedNotification; +extern NSString *BDSKDocumentDidChangeLinkedFilesNotification; extern NSString *BDSKEncodingsListChangedNotification; extern NSString *BDSKTemporaryFileMigrationNotification; extern NSString *BDSKFlagsChangedNotification; Modified: trunk/bibdesk/BDSKStringConstants.m =================================================================== --- trunk/bibdesk/BDSKStringConstants.m 2022-06-06 09:26:17 UTC (rev 27565) +++ trunk/bibdesk/BDSKStringConstants.m 2022-06-06 14:13:54 UTC (rev 27566) @@ -329,7 +329,7 @@ NSString *BDSKDocumentControllerAddDocumentNotification = @"BDSKDocumentControllerAddDocumentNotification"; NSString *BDSKDocumentControllerRemoveDocumentNotification = @"BDSKDocumentControllerRemoveDocumentNotification"; NSString *BDSKDocumentControllerDidChangeMainDocumentNotification = @"BDSKDocumentControllerDidChangeMainDocumentNotification"; -NSString *BDSKFileSearchIndexInfoChangedNotification = @"BDSKFileSearchIndexInfoChangedNotification"; +NSString *BDSKDocumentDidChangeLinkedFilesNotification = @"BDSKDocumentDidChangeLinkedFilesNotification"; NSString *BDSKEncodingsListChangedNotification = @"BDSKEncodingsListChangedNotification"; NSString *BDSKTemporaryFileMigrationNotification = @"BDSKTemporaryFileMigrationNotification"; NSString *BDSKFlagsChangedNotification = @"BDSKFlagsChangedNotification"; Modified: trunk/bibdesk/BibDocument_UI.m =================================================================== --- trunk/bibdesk/BibDocument_UI.m 2022-06-06 09:26:17 UTC (rev 27565) +++ trunk/bibdesk/BibDocument_UI.m 2022-06-06 14:13:54 UTC (rev 27566) @@ -1485,6 +1485,12 @@ if ([changedKey isEqualToString:BDSKLocalFileString] || [changedKey isEqualToString:BDSKRemoteURLString]) docFlags.itemChangeMask |= BDSKItemChangedFilesMask; + if ([changedKey isEqualToString:BDSKLocalFileString]) { + NSDictionary *notifInfo = [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObject:pub], BDSKDocumentPublicationsKey, nil]; + [[NSNotificationCenter defaultCenter] postNotificationName:BDSKDocumentDidChangeLinkedFilesNotification + object:self + userInfo:notifInfo]; + } // queue for UI updating, in case the item is changed as part of a batch process such as Find & Replace or AutoFile if (docFlags.isDocumentClosed == NO) { Modified: trunk/bibdesk/BibItem.m =================================================================== --- trunk/bibdesk/BibItem.m 2022-06-06 09:26:17 UTC (rev 27565) +++ trunk/bibdesk/BibItem.m 2022-06-06 14:13:54 UTC (rev 27566) @@ -4104,16 +4104,10 @@ spotlightMetadataChanged = YES; // make sure the UI is notified that the linked file has changed, as this is often called after setField:toValue: if ([self owner]) { - NSDictionary *notifInfo = [NSDictionary dictionaryWithObjectsAndKeys:isFile ? BDSKLocalFileString : BDSKRemoteURLString, BDSKBibItemKeyKey, nil]; + NSDictionary *notifInfo = [NSDictionary dictionaryWithObjectsAndKeys:(isFile ? BDSKLocalFileString : BDSKRemoteURLString), BDSKBibItemKeyKey, nil]; [[NSNotificationCenter defaultCenter] postNotificationName:BDSKBibItemChangedNotification object:self userInfo:notifInfo]; - if (isFile && [[self owner] isDocument]) { - notifInfo = [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObject:self], BDSKDocumentPublicationsKey, nil]; - [[NSNotificationCenter defaultCenter] postNotificationName:BDSKFileSearchIndexInfoChangedNotification - object:owner - userInfo:notifInfo]; - } } } 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