Revision: 22356
          http://sourceforge.net/p/bibdesk/svn/22356
Author:   hofman
Date:     2018-06-24 16:36:51 +0000 (Sun, 24 Jun 2018)
Log Message:
-----------
default to preferred local file format when dropping a url

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

Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m  2018-06-24 16:26:23 UTC (rev 22355)
+++ trunk/bibdesk/BDSKEditor.m  2018-06-24 16:36:51 UTC (rev 22356)
@@ -3184,17 +3184,32 @@
                 NSURL *url = [fileURLs objectAtIndex:0];
                 NSString *filename = nil;
                 NSDragOperation mask = [info draggingSourceOperationMask];
+                NSInteger format = [[NSUserDefaults standardUserDefaults] 
integerForKey:BDSKLocalFileOptionKey];
+                if (mask == NSDragOperationGeneric)
+                    format = format == 3 ? 1 : 3;
+                else if (mask == NSDragOperationCopy)
+                    format = format == 0 ? 1 : 0;
                 if ([url isFileReferenceURL])
                     url = [url filePathURL];
-                if (mask == NSDragOperationGeneric) {
-                    NSString *basePath = [publication basePath];
-                    filename = [url path];
-                    if (basePath)
-                        filename = [filename relativePathFromPath:basePath];
-                } else if (mask == NSDragOperationCopy) {
-                    filename = [url path];
-                } else {
-                    filename = [url absoluteString];
+                switch (format) {
+                    case 0:
+                        filename = [url absoluteString];
+                        break;
+                    case 1:
+                        filename = [url path];
+                        break;
+                    case 2:
+                        filename = [[url path] 
stringByAbbreviatingWithTildeInPath];
+                        break;
+                    case 3:
+                    {
+                        NSString *basePath = [publication basePath];
+                        filename = basePath ? [[url path] 
relativePathFromPath:basePath] : [url path];
+                        break;
+                    }
+                    default:
+                        filename = [url path];
+                        break;
                 }
                 [self recordChangingField:field toValue:filename];
                 return YES;

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