Revision: 27973
          http://sourceforge.net/p/bibdesk/svn/27973
Author:   hofman
Date:     2022-09-30 16:54:06 +0000 (Fri, 30 Sep 2022)
Log Message:
-----------
include password in search file when holding Option when dragging or copying

Modified Paths:
--------------
    trunk/bibdesk/BDSKSearchGroup.m
    trunk/bibdesk/BibDocument_DataSource.m

Modified: trunk/bibdesk/BDSKSearchGroup.m
===================================================================
--- trunk/bibdesk/BDSKSearchGroup.m     2022-09-30 16:15:20 UTC (rev 27972)
+++ trunk/bibdesk/BDSKSearchGroup.m     2022-09-30 16:54:06 UTC (rev 27973)
@@ -330,6 +330,15 @@
             [plist removeObjectForKey:@"search term"];
             [plist removeObjectForKey:@"history"];
             
+            if ([[item 
propertyListForType:@"net.sourceforge.bibdesk.bdsksearch.includepassword"] 
boolValue]) {
+                NSString *password = nil;
+                if ([[self serverInfo] getUsername:NULL password:&password]) {
+                    NSMutableDictionary *options = [[[plist 
objectForKey:@"options"] mutableCopy] autorelease] ?: [NSMutableDictionary 
dictionary];
+                    [options setObject:password forKey:@"password"];
+                    [plist setObject:options forKey:@"options"];
+                }
+            }
+            
             NSString *fileName = [[[self serverInfo] name] 
stringByAppendingPathExtension:@"bdsksearch"];
             
             // make sure the filename is unique
@@ -355,6 +364,15 @@
     [plist removeObjectForKey:@"search term"];
     [plist removeObjectForKey:@"history"];
     
+    if ([[filePromiseProvider userInfo] isEqual:@"BDSKIncludePassword"]) {
+        NSString *password = nil;
+        if ([[self serverInfo] getUsername:NULL password:&password]) {
+            NSMutableDictionary *options = [[[plist objectForKey:@"options"] 
mutableCopy] autorelease] ?: [NSMutableDictionary dictionary];
+            [options setObject:password forKey:@"password"];
+            [plist setObject:options forKey:@"options"];
+        }
+    }
+    
     [plist writeToURL:fileURL atomically:YES];
     
     completionHandler(nil);

Modified: trunk/bibdesk/BibDocument_DataSource.m
===================================================================
--- trunk/bibdesk/BibDocument_DataSource.m      2022-09-30 16:15:20 UTC (rev 
27972)
+++ trunk/bibdesk/BibDocument_DataSource.m      2022-09-30 16:54:06 UTC (rev 
27973)
@@ -1136,10 +1136,15 @@
     if (success && searchGroup) {
         Class providerClass = NSClassFromString(@"NSFilePromiseProvider");
         if (providerClass) {
-            return [[[providerClass alloc] 
initWithFileType:@"net.sourceforge.bibdesk.bdsksearch" delegate:searchGroup] 
autorelease];
+            id item = [[[providerClass alloc] 
initWithFileType:@"net.sourceforge.bibdesk.bdsksearch" delegate:searchGroup] 
autorelease];
+            if (([NSEvent standardModifierFlags] & NSAlternateKeyMask) != 0)
+                [item setUserInfo:@"BDSKIncludePassword"];
+            return item;
         } else {
             NSPasteboardItem *item = [[[NSPasteboardItem alloc] init] 
autorelease];
             [item setDataProvider:searchGroup forTypes:[NSArray 
arrayWithObjects:(NSString *)kPasteboardTypeFileURLPromise, (NSString 
*)kPasteboardTypeFilePromiseContent, nil]];
+            if (([NSEvent standardModifierFlags] & NSAlternateKeyMask) != 0)
+                [item setPropertyList:[NSNumber numberWithBool:YES] 
forType:@"net.sourceforge.bibdesk.bdsksearch.includepassword"];
             [pboard writeObjects:[NSArray arrayWithObjects:item, nil]];
         }
     }

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