Revision: 22420
          http://sourceforge.net/p/bibdesk/svn/22420
Author:   hofman
Date:     2018-07-14 11:34:10 +0000 (Sat, 14 Jul 2018)
Log Message:
-----------
Make sure Local-Url and Url are defined as custom fields with their type when 
using them instead of linked files

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

Modified: trunk/bibdesk/BibPref_Defaults.m
===================================================================
--- trunk/bibdesk/BibPref_Defaults.m    2018-07-14 11:18:46 UTC (rev 22419)
+++ trunk/bibdesk/BibPref_Defaults.m    2018-07-14 11:34:10 UTC (rev 22420)
@@ -341,6 +341,24 @@
     [convertURLFieldsButton setEnabled:useLocalUrl == NO];
     [removeLocalFileFieldsButton setEnabled:autoConvert];
     [removeRemoteURLFieldsButton setEnabled:autoConvert];
+    if (useLocalUrl) {
+        // make sure Local-Url and Url are defined as Local File and remote 
URL fields
+        NSArray *customFields = [customFieldsArray valueForKey:@"field"];
+        if ([customFields containsObject:BDSKLocalUrlString] == NO || 
[customFields containsObject:BDSKUrlString] == NO) {
+            NSMutableDictionary *newDict;
+            if ([customFields containsObject:BDSKLocalUrlString] == NO) {
+                newDict = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
BDSKLocalUrlString, @"field", [NSNumber numberWithInteger:BDSKLocalFileType], 
@"type", [NSNumber numberWithBool:NO], @"default", nil];
+                [customFieldsArray addObject:newDict];
+                [customFieldsSet addObject:BDSKLocalUrlString];
+            }
+            if ([customFields containsObject:BDSKUrlString] == NO) {
+                newDict = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
BDSKUrlString, @"field", [NSNumber numberWithInteger:BDSKRemoteURLType], 
@"type", [NSNumber numberWithBool:NO], @"default", nil];
+                [customFieldsArray addObject:newDict];
+                [customFieldsSet addObject:BDSKUrlString];
+            }
+            [self updatePrefs];
+        }
+    }
 }
 
 - (IBAction)changeConvertURLFields:(id)sender {

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


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to