Revision: 23921
          http://sourceforge.net/p/bibdesk/svn/23921
Author:   hofman
Date:     2019-07-02 09:23:46 +0000 (Tue, 02 Jul 2019)
Log Message:
-----------
hidden pref for types to automatically download

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

Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2019-07-02 09:15:55 UTC (rev 23920)
+++ trunk/bibdesk/BibDocument.m 2019-07-02 09:23:46 UTC (rev 23921)
@@ -167,6 +167,7 @@
 
 #define BDSKDownloadImportedURLsKey @"BDSKDownloadImportedURLs"
 #define BDSKReplaceDownloadedURLsKey @"BDSKReplaceDownloadedURLs"
+#define BDSKURLTypesToDownloadKey @"BDSKURLTypesToDownload"
 
 #pragma mark -
 
@@ -2122,14 +2123,17 @@
     
     if ([[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKDownloadImportedURLsKey]) {
         BOOL replace = [[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKReplaceDownloadedURLsKey];
+        NSArray *types = [[NSUserDefaults standardUserDefaults] 
stringArrayForKey:BDSKURLTypesToDownloadKey];
+        if ([types count] == 0)
+            types = [NSArray arrayWithObject:@"pdf"];
         for (pub in newPubs) {
             if (useLocalUrlAndUrl) {
-                if ([pub canDownloadUrl] && [[[pub 
remoteURLForField:BDSKUrlString] pathExtension] isCaseInsensitiveEqual:@"pdf"])
+                if ([pub canDownloadUrl] && [types containsObject:[[[pub 
remoteURLForField:BDSKUrlString] pathExtension] lowercaseString] ?: @""])
                     [pub downloadUrl];
             } else if ([[pub localFiles] count] == 0) {
                 for (BDSKLinkedFile *linkedURL in [pub remoteURLs]) {
                     if ([pub canDownloadLinkedFile:linkedURL] &&
-                        [[[linkedURL URL] pathExtension] 
isCaseInsensitiveEqual:@"pdf"]) {
+                        [types containsObject:[[[linkedURL URL] pathExtension] 
lowercaseString] ?: @""]) {
                         if (replace)
                             [pub downloadLinkedFile:linkedURL];
                         else

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



_______________________________________________
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to