Revision: 27488
          http://sourceforge.net/p/bibdesk/svn/27488
Author:   hofman
Date:     2022-05-27 14:29:53 +0000 (Fri, 27 May 2022)
Log Message:
-----------
reorder condition to avoid level

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

Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m  2022-05-27 14:26:06 UTC (rev 27487)
+++ trunk/bibdesk/BDSKEditor.m  2022-05-27 14:29:53 UTC (rev 27488)
@@ -604,27 +604,25 @@
 }
 
 - (IBAction)downloadRemoteURL:(id)sender{
-    if ([[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKUseLocalUrlAndUrlKey]) {
-        if ([publication canDownloadURLForField:BDSKUrlString]) {
-            if ([NSString isEmptyString:[publication 
valueOfField:BDSKLocalUrlString inherit:NO]]) {
-                [publication downloadURLForField:BDSKUrlString];
-            } else {
-                NSAlert *alert = [[[NSAlert alloc] init] autorelease];
-                [alert setMessageText:NSLocalizedString(@"Local-Url is set", 
@"Message in alert dialog")];
-                [alert setInformativeText:NSLocalizedString(@"Downloading will 
overwrite the current value of the Local-Url field. Do you want to proceed?", 
@"Informative text in alert dialog")];
-                [alert addButtonWithTitle:NSLocalizedString(@"Download", 
@"Button title")];
-                [alert addButtonWithTitle:NSLocalizedString(@"Cancel", 
@"Button title")];
-                [alert beginSheetModalForWindow:[self window] 
completionHandler:^(NSInteger returnCode){
-                    if (returnCode == NSAlertFirstButtonReturn)
-                        [publication downloadURLForField:BDSKUrlString];
-                }];
-            }
-        }
-    } else {
+    if ([[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKUseLocalUrlAndUrlKey] == NO) {
         for (BDSKLinkedFile *file in [publication remoteURLs]) {
             if ([publication canDownloadLinkedFile:file])
                 [publication downloadLinkedFile:file replace:NO];
         }
+    } else if ([publication canDownloadURLForField:BDSKUrlString]) {
+        if ([NSString isEmptyString:[publication 
valueOfField:BDSKLocalUrlString inherit:NO]]) {
+            [publication downloadURLForField:BDSKUrlString];
+        } else {
+            NSAlert *alert = [[[NSAlert alloc] init] autorelease];
+            [alert setMessageText:NSLocalizedString(@"Local-Url is set", 
@"Message in alert dialog")];
+            [alert setInformativeText:NSLocalizedString(@"Downloading will 
overwrite the current value of the Local-Url field. Do you want to proceed?", 
@"Informative text in alert dialog")];
+            [alert addButtonWithTitle:NSLocalizedString(@"Download", @"Button 
title")];
+            [alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"Button 
title")];
+            [alert beginSheetModalForWindow:[self window] 
completionHandler:^(NSInteger returnCode){
+                if (returnCode == NSAlertFirstButtonReturn)
+                    [publication downloadURLForField:BDSKUrlString];
+            }];
+        }
     }
 }
 

Modified: trunk/bibdesk/BibDocument_Actions.m
===================================================================
--- trunk/bibdesk/BibDocument_Actions.m 2022-05-27 14:26:06 UTC (rev 27487)
+++ trunk/bibdesk/BibDocument_Actions.m 2022-05-27 14:29:53 UTC (rev 27488)
@@ -1119,27 +1119,25 @@
         NSBeep();
         return;
     }
-    if ([[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKUseLocalUrlAndUrlKey]) {
-        if ([pub canDownloadURLForField:BDSKUrlString]) {
-            if ([NSString isEmptyString:[pub valueOfField:BDSKLocalUrlString 
inherit:NO]]) {
-                [pub downloadURLForField:BDSKUrlString];
-            } else {
-                NSAlert *alert = [[[NSAlert alloc] init] autorelease];
-                [alert setMessageText:NSLocalizedString(@"Local-Url is set", 
@"Message in alert dialog")];
-                [alert setInformativeText:NSLocalizedString(@"Downloading will 
overwrite the current value of the Local-Url field. Do you want to proceed?", 
@"Informative text in alert dialog")];
-                [alert addButtonWithTitle:NSLocalizedString(@"Download", 
@"Button title")];
-                [alert addButtonWithTitle:NSLocalizedString(@"Cancel", 
@"Button title")];
-                [alert beginSheetModalForWindow:[self windowForSheet] 
completionHandler:^(NSInteger returnCode){
-                    if (returnCode == NSAlertFirstButtonReturn)
-                        [pub downloadURLForField:BDSKUrlString];
-                }];
-            }
-        }
-    } else {
+    if ([[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKUseLocalUrlAndUrlKey] == NO) {
         for (BDSKLinkedFile *file in [pub remoteURLs]) {
             if ([pub canDownloadLinkedFile:file])
                 [pub downloadLinkedFile:file replace:NO];
         }
+    } else if ([pub canDownloadURLForField:BDSKUrlString]) {
+        if ([NSString isEmptyString:[pub valueOfField:BDSKLocalUrlString 
inherit:NO]]) {
+            [pub downloadURLForField:BDSKUrlString];
+        } else {
+            NSAlert *alert = [[[NSAlert alloc] init] autorelease];
+            [alert setMessageText:NSLocalizedString(@"Local-Url is set", 
@"Message in alert dialog")];
+            [alert setInformativeText:NSLocalizedString(@"Downloading will 
overwrite the current value of the Local-Url field. Do you want to proceed?", 
@"Informative text in alert dialog")];
+            [alert addButtonWithTitle:NSLocalizedString(@"Download", @"Button 
title")];
+            [alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"Button 
title")];
+            [alert beginSheetModalForWindow:[self windowForSheet] 
completionHandler:^(NSInteger returnCode){
+                if (returnCode == NSAlertFirstButtonReturn)
+                    [pub downloadURLForField:BDSKUrlString];
+            }];
+        }
     }
 }
 

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