Revision: 15153
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=15153&view=rev
Author:   hofman
Date:     2009-04-22 16:31:17 +0000 (Wed, 22 Apr 2009)

Log Message:
-----------
Reset cite key warning in editor when the same cite key in another pub changes. 
Also make sure that the field editor uses the correct string value when a field 
changes, in case it is changed in the parent.

Modified Paths:
--------------
    trunk/bibdesk/BDSKEditor.m

Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m  2009-04-22 12:32:05 UTC (rev 15152)
+++ trunk/bibdesk/BDSKEditor.m  2009-04-22 16:31:17 UTC (rev 15153)
@@ -2179,9 +2179,14 @@
                                                         [crossref 
caseInsensitiveCompare:[userInfo objectForKey:@"oldValue"]] == NSOrderedSame));
        
     // If it is not our item or his crossref parent, we don't care, but our 
parent may have changed his cite key
-       if (sender != publication && NO == parentDidChange)
+       if (sender != publication && NO == parentDidChange) {
+        // though a change of the cite key of another item may change the 
duplicate status
+        if ([changeKey isEqualToString:BDSKCiteKeyString] &&
+            [[publication citeKey] caseInsensitiveCompare:[userInfo 
objectForKey:@"oldValue"]] == NSOrderedSame)
+            [self updateCiteKeyDuplicateWarning];
                return;
-       
+       }
+    
        if([changeKey isEqualToString:BDSKLocalFileString]){
         [fileView reloadIcons];
         [self synchronizeWindowTitleWithDocumentName];
@@ -2194,7 +2199,7 @@
                [self updateTypePopup];
        }
        else if([changeKey isEqualToString:BDSKCiteKeyString]){
-               [citeKeyField setStringValue:newValue];
+               [citeKeyField setStringValue:[publication citeKey]];
                [self updateCiteKeyAutoGenerateStatus];
         [self updateCiteKeyDuplicateWarning];
        }
@@ -2263,7 +2268,7 @@
             [authorTableView reloadData];
         
         if ([tableView editedRow] != -1 && [[fields objectAtIndex:[tableView 
editedRow]] isEqualToString:changeKey]) {
-            NSString *tmpValue = newValue ?: @"";
+            NSString *tmpValue = [publication valueOfField:changeKey] ?: @"";
             if ([changeKey isCitationField] == NO && [tableCellFormatter 
editAsComplexString])
                 tmpValue = [tmpValue stringAsBibTeXString];
             [[tableView currentEditor] setString:tmpValue];


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to