Revision: 22621
          http://sourceforge.net/p/bibdesk/svn/22621
Author:   hofman
Date:     2018-09-17 09:29:17 +0000 (Mon, 17 Sep 2018)
Log Message:
-----------
Rename setFields: to setPubFields: and remove old implementation of 
setPubFields:, for consistency with getters

Modified Paths:
--------------
    trunk/bibdesk/BDSKTextImportController.m
    trunk/bibdesk/BibDocument_UI.m
    trunk/bibdesk/BibItem+Scripting.m
    trunk/bibdesk/BibItem.h
    trunk/bibdesk/BibItem.m

Modified: trunk/bibdesk/BDSKTextImportController.m
===================================================================
--- trunk/bibdesk/BDSKTextImportController.m    2018-09-17 06:30:40 UTC (rev 
22620)
+++ trunk/bibdesk/BDSKTextImportController.m    2018-09-17 09:29:17 UTC (rev 
22621)
@@ -1513,7 +1513,7 @@
         BibItem *item = [self publication];
         
         [item setPubType:[pub pubType]];
-        [item setFields:[pub pubFields]];
+        [item setPubFields:[pub pubFields]];
         
         [itemTableView reloadData];
     }

Modified: trunk/bibdesk/BibDocument_UI.m
===================================================================
--- trunk/bibdesk/BibDocument_UI.m      2018-09-17 06:30:40 UTC (rev 22620)
+++ trunk/bibdesk/BibDocument_UI.m      2018-09-17 09:29:17 UTC (rev 22621)
@@ -1082,7 +1082,7 @@
 
 - (void)handleBibItemChangedNotification:(NSNotification *)notification{
 
-    // note: userInfo is nil if -[BibItem setFields:] is called
+    // note: userInfo is nil if -[BibItem setPubFields:] is called
        NSDictionary *userInfo = [notification userInfo];
     BibItem *pub = [notification object];
     

Modified: trunk/bibdesk/BibItem+Scripting.m
===================================================================
--- trunk/bibdesk/BibItem+Scripting.m   2018-09-17 06:30:40 UTC (rev 22620)
+++ trunk/bibdesk/BibItem+Scripting.m   2018-09-17 09:29:17 UTC (rev 22621)
@@ -537,7 +537,7 @@
        // hopefully, I don't understand the whole filetypes/pubtypes stuff     
        [self setPubType:[newPub pubType]];
        [self setCiteKey:[newPub citeKey]];
-       [self setFields:[newPub pubFields]];
+       [self setPubFields:[newPub pubFields]];
        
        [[self undoManager] 
setActionName:NSLocalizedString(@"AppleScript",@"Undo action name for 
AppleScript")];
        // NSLog([newPub description]);

Modified: trunk/bibdesk/BibItem.h
===================================================================
--- trunk/bibdesk/BibItem.h     2018-09-17 06:30:40 UTC (rev 22620)
+++ trunk/bibdesk/BibItem.h     2018-09-17 09:29:17 UTC (rev 22621)
@@ -661,20 +661,15 @@
 */
 - (NSString *)citeKey;
 
+- (NSDictionary *)pubFields;
+
 /*!
        @method     setPubFields
-       @abstract   basic setter for the dictionary of fields, for 
initialization only.
+    @abstract   setter for the dictionary of fields, with notification and 
undo.
        @discussion -
 */
 - (void)setPubFields: (NSDictionary *)newFields;
 
-/*!
-       @method     setFields
-       @abstract   setter for the dictionary of fields, with notification and 
undo.
-       @discussion -
-*/
-- (void)setFields: (NSDictionary *)newFields;
-
 - (void)setField: (NSString *)key toValue: (NSString *)value;
 - (void)setField: (NSString *)key toValue: (NSString *)value 
withModDate:(NSDate *)date;
 
@@ -699,7 +694,6 @@
 */
 - (NSString *)valueOfField: (NSString *)key inherit: (BOOL)inherit;
 
-- (NSDictionary *)pubFields;
 - (NSArray *)allFieldNames;
 
 /*!

Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m     2018-09-17 06:30:40 UTC (rev 22620)
+++ trunk/bibdesk/BibItem.m     2018-09-17 09:29:17 UTC (rev 22621)
@@ -1191,22 +1191,17 @@
 }
 
 - (void)setPubFields: (NSDictionary *)newFields{
-    if(newFields != pubFields){
-        [pubFields release];
-        pubFields = [newFields mutableCopy];
-        [self updateMetadataForKey:BDSKAllFieldsString];
-    }
-}
-
-- (void)setFields: (NSDictionary *)newFields{
     NSDictionary *oldFields = [self pubFields];
-       if(![newFields isEqualToDictionary:oldFields]){
+       if(NO == [newFields isEqualToDictionary:oldFields]){
                if ([self undoManager]) {
-                       [[[self undoManager] prepareWithInvocationTarget:self] 
setFields:oldFields];
+                       [[[self undoManager] prepareWithInvocationTarget:self] 
setPubFields:oldFields];
                }
                
-               [self setPubFields:newFields];
-               
+        [pubFields release];
+        pubFields = [[NSMutableDictionary alloc] initWithDictionary:newFields];
+        
+        [self updateMetadataForKey:BDSKAllFieldsString];
+
                NSDictionary *notifInfo = [NSDictionary dictionary]; // cmh: 
maybe not the best info, but handled correctly
                [[NSNotificationCenter defaultCenter] 
postNotificationName:BDSKBibItemChangedNotification
                                                                                
                                        object:self

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