Revision: 25184
          http://sourceforge.net/p/bibdesk/svn/25184
Author:   hofman
Date:     2020-12-12 17:28:04 +0000 (Sat, 12 Dec 2020)
Log Message:
-----------
Check whether cite key is in use in bibitem method

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

Modified: trunk/bibdesk/BDSKPublicationsArray.h
===================================================================
--- trunk/bibdesk/BDSKPublicationsArray.h       2020-12-12 17:23:59 UTC (rev 
25183)
+++ trunk/bibdesk/BDSKPublicationsArray.h       2020-12-12 17:28:04 UTC (rev 
25184)
@@ -50,7 +50,6 @@
 
 - (BibItem *)itemForCiteKey:(NSString *)key;
 - (NSArray *)allItemsForCiteKey:(NSString *)key;
-- (BOOL)citeKeyIsUsed:(NSString *)key byItemOtherThan:(BibItem *)anItem;
 - (void)changeCiteKey:(NSString *)oldKey toCiteKey:(NSString *)newKey 
forItem:(BibItem *)anItem;
 
 - (id)itemForIdentifierURL:(NSURL *)aURL;

Modified: trunk/bibdesk/BDSKPublicationsArray.m
===================================================================
--- trunk/bibdesk/BDSKPublicationsArray.m       2020-12-12 17:23:59 UTC (rev 
25183)
+++ trunk/bibdesk/BDSKPublicationsArray.m       2020-12-12 17:28:04 UTC (rev 
25184)
@@ -247,17 +247,6 @@
     return items ?: [NSArray array];
 }
 
-- (BOOL)citeKeyIsUsed:(NSString *)key byItemOtherThan:(BibItem *)anItem;
-{
-    NSArray *items = [itemsForCiteKeys objectForKey:key];
-    
-       if ([items count] > 1)
-               return YES;
-       if ([items count] == 1 && [items objectAtIndex:0] != anItem)    
-               return YES;
-       return NO;
-}
-
 #pragma mark Crossref support
 
 - (id)itemForIdentifierURL:(NSURL *)aURL;

Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m     2020-12-12 17:23:59 UTC (rev 25183)
+++ trunk/bibdesk/BibItem.m     2020-12-12 17:28:04 UTC (rev 25184)
@@ -1081,7 +1081,8 @@
 - (BOOL)isValidCiteKey:(NSString *)proposedCiteKey{
        if ([NSString isEmptyString:proposedCiteKey])
         return NO;
-    return ([[owner publications] citeKeyIsUsed:proposedCiteKey 
byItemOtherThan:self] == NO);
+    NSArray *items = [[owner publications] allItemsForCiteKey:proposedCiteKey];
+    return [items count] == 0 || ([items count] == 1 && [items 
containsObject:self]);
 }
 
 - (BOOL)citeKeyIsCrossreffed:(NSString *)key{

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