Revision: 23899
          http://sourceforge.net/p/bibdesk/svn/23899
Author:   hofman
Date:     2019-06-27 16:33:49 +0000 (Thu, 27 Jun 2019)
Log Message:
-----------
Add a contextual menu item to download a remote URL keeping the source

Modified Paths:
--------------
    trunk/bibdesk_vendorsrc/amaxwell/FileView/English.lproj/FileView.strings
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.h
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
    trunk/bibdesk_vendorsrc/amaxwell/FileView/French.lproj/FileView.strings
    trunk/bibdesk_vendorsrc/amaxwell/FileView/German.lproj/FileView.strings

Modified: 
trunk/bibdesk_vendorsrc/amaxwell/FileView/English.lproj/FileView.strings
===================================================================
(Binary files differ)

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.h
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.h      2019-06-27 
16:11:43 UTC (rev 23898)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.h      2019-06-27 
16:33:49 UTC (rev 23899)
@@ -39,18 +39,19 @@
 #import <Cocoa/Cocoa.h>
 
 enum {
-    FVZoomInMenuItemTag      = 1001,
-    FVZoomOutMenuItemTag     = 1002,
-    FVGridMenuItemTag        = 1003,
-    FVColumnMenuItemTag      = 1004,
-    FVRowMenuItemTag         = 1005,
-    FVQuickLookMenuItemTag   = 1006,
-    FVOpenMenuItemTag        = 1007,
-    FVRevealMenuItemTag      = 1008,
-    FVChangeLabelMenuItemTag = 1009,
-    FVDownloadMenuItemTag    = 1010,
-    FVRemoveMenuItemTag      = 1011,
-    FVReloadMenuItemTag      = 1012 
+    FVZoomInMenuItemTag       = 1001,
+    FVZoomOutMenuItemTag      = 1002,
+    FVGridMenuItemTag         = 1003,
+    FVColumnMenuItemTag       = 1004,
+    FVRowMenuItemTag          = 1005,
+    FVQuickLookMenuItemTag    = 1006,
+    FVOpenMenuItemTag         = 1007,
+    FVRevealMenuItemTag       = 1008,
+    FVChangeLabelMenuItemTag  = 1009,
+    FVDownloadMenuItemTag     = 1010,
+    FVDownloadCopyMenuItemTag = 1011,
+    FVRemoveMenuItemTag       = 1012,
+    FVReloadMenuItemTag       = 1013
 };
 
 enum {

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m      2019-06-27 
16:11:43 UTC (rev 23898)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m      2019-06-27 
16:33:49 UTC (rev 23899)
@@ -3847,7 +3847,7 @@
         [anItem setState:state];
         return enabled;
     }
-    else if (action == @selector(downloadSelectedLink:)) {
+    else if (action == @selector(downloadSelectedLink:) || action == 
@selector(downloadCopyOfSelectedLink:)) {
         if ([self allowsDownloading]) {
             BOOL alreadyDownloading = [[_downloads valueForKey:@"downloadURL"] 
containsObject:aURL];
             // don't check reachability; just handle the error if it fails
@@ -4014,6 +4014,9 @@
         anItem = [sharedMenu 
addItemWithTitle:NSLocalizedStringFromTableInBundle(@"Download and Replace", 
@"FileView", bundle, @"context menu title") 
action:@selector(downloadSelectedLink:) keyEquivalent:@""];
         [anItem setTag:FVDownloadMenuItemTag];
         
+        anItem = [sharedMenu 
addItemWithTitle:NSLocalizedStringFromTableInBundle(@"Download and Add", 
@"FileView", bundle, @"context menu title") 
action:@selector(downloadCopyOfSelectedLink:) keyEquivalent:@""];
+        [anItem setTag:FVDownloadCopyMenuItemTag];
+        
         [sharedMenu addItem:[NSMenuItem separatorItem]];
         
         anItem = [sharedMenu 
addItemWithTitle:NSLocalizedStringFromTableInBundle(@"Zoom In", @"FileView", 
bundle, @"context menu title") action:@selector(zoomIn:) keyEquivalent:@""];
@@ -4143,6 +4146,21 @@
     }
 }
 
+- (void)downloadCopyOfSelectedLink:(id)sender
+{
+    if ([self allowsDownloading]) {
+        // validation ensures that we have a single selection, and that there 
is no current download with this URL
+        NSUInteger selIndex = [_selectionIndexes firstIndex];
+        if (NSNotFound != selIndex) {
+            NSURL *theURL = [self URLAtIndex:selIndex];
+            NSUInteger addIndex = selIndex + 1;
+            [[self dataSource] fileView:self insertURLs:[NSArray 
arrayWithObjects:theURL, nil] atIndexes:[NSIndexSet indexSetWithIndex:addIndex] 
forDrop:nil dropOperation:FVDropOn];
+            if (addIndex < [self numberOfIcons] && [theURL isEqual:[self 
URLAtIndex:addIndex]])
+                [self _downloadURLAtIndex:addIndex];
+        }
+    }
+}
+
 #pragma mark Quick Look support
 
 - (void)handlePreviewerWillClose:(NSNotification *)aNote

Modified: 
trunk/bibdesk_vendorsrc/amaxwell/FileView/French.lproj/FileView.strings
===================================================================
(Binary files differ)

Modified: 
trunk/bibdesk_vendorsrc/amaxwell/FileView/German.lproj/FileView.strings
===================================================================
(Binary files differ)

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