Revision: 29400
          http://sourceforge.net/p/bibdesk/svn/29400
Author:   hofman
Date:     2025-07-30 14:41:39 +0000 (Wed, 30 Jul 2025)
Log Message:
-----------
usee only selectItemsForCiteKeys:selectLibrary:

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

Modified: trunk/bibdesk/BDSKDocumentController.m
===================================================================
--- trunk/bibdesk/BDSKDocumentController.m      2025-07-30 09:22:45 UTC (rev 
29399)
+++ trunk/bibdesk/BDSKDocumentController.m      2025-07-30 14:41:39 UTC (rev 
29400)
@@ -387,6 +387,7 @@
             NSDictionary *options = [customOpenSettings 
objectForKey:absoluteURL];
             if (options)
                 [customOpenSettings setObject:options forKey:fileURL];
+            NSString *citeKey = [dictionary 
objectForKey:@"net_sourceforge_bibdesk_citekey"] ?: [dictionary 
objectForKey:BDSKCiteKeyString];
             
             // use a local variable in case it wasn't passed in, so we can 
always log this failure
             [super openDocumentWithContentsOfURL:fileURL 
display:displayDocument completionHandler:^(NSDocument *document, BOOL 
documentWasAlreadyOpen, NSError *error){
@@ -394,7 +395,7 @@
                 if (document == nil) {
                     NSLog(@"document at URL %@ failed to open for reason: %@", 
fileURL, [error localizedFailureReason]);
                 } else if(displayDocument) {
-                    if (NO == [(BibDocument *)document 
selectItemForPartialItem:dictionary])
+                    if (NO == [(BibDocument *)document 
selectItemsForCiteKeys:@[citeKey] selectLibrary:YES])
                         NSBeep();
                     if ([NSString isEmptyString:searchString] == NO)
                         [(BibDocument *)document setSearchString:searchString];

Modified: trunk/bibdesk/BibDocument.h
===================================================================
--- trunk/bibdesk/BibDocument.h 2025-07-30 09:22:45 UTC (rev 29399)
+++ trunk/bibdesk/BibDocument.h 2025-07-30 14:41:39 UTC (rev 29400)
@@ -415,7 +415,6 @@
 @property (nonatomic, nullable, readonly) BibItem *singleSelectedPublication;
 
 - (BOOL)selectItemsForCiteKeys:(NSArray *)citeKeys selectLibrary:(BOOL)flag;
-- (BOOL)selectItemForPartialItem:(NSDictionary *)partialItem;
 
 - (void)selectPublication:(BibItem *)bib;
 - (void)selectPublications:(nullable NSArray *)bibArray;

Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2025-07-30 09:22:45 UTC (rev 29399)
+++ trunk/bibdesk/BibDocument.m 2025-07-30 14:41:39 UTC (rev 29400)
@@ -2487,27 +2487,16 @@
     [self setSearchString:@""];
 
     NSMutableArray *itemsToSelect = [NSMutableArray array];
-    for (NSString *key in citeKeys) {
-        BibItem *anItem = [publications itemForCiteKey:key];
-        if (anItem)
-            [itemsToSelect addObject:anItem];
+    for (NSString *key in citeKeys)
+        [itemsToSelect addObjectsFromArray:[publications itemsForCiteKey:key]];
+    if ([itemsToSelect count] > 0) {
+        [self selectPublications:itemsToSelect];
+        return YES;
+    } else {
+        return NO;
     }
-    [self selectPublications:itemsToSelect];
-    return [itemsToSelect count] > 0;
 }
 
-- (BOOL)selectItemForPartialItem:(NSDictionary *)partialItem{
-        
-    NSString *itemKey = [partialItem 
objectForKey:@"net_sourceforge_bibdesk_citekey"] ?: [partialItem 
objectForKey:BDSKCiteKeyString];
-    
-    BOOL matchFound = NO;
-
-    if(itemKey != nil)
-        matchFound = [self selectItemsForCiteKeys:@[itemKey] 
selectLibrary:YES];
-    
-    return matchFound;
-}
-
 - (void)selectPublication:(BibItem *)bib{
        [self selectPublications:@[bib]];
 }

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