Revision: 23754
          http://sourceforge.net/p/bibdesk/svn/23754
Author:   hofman
Date:     2019-04-28 13:48:13 +0000 (Sun, 28 Apr 2019)
Log Message:
-----------
reimplement deprecated delegate methods for promised files, they are apparently 
called again on 10.14

Modified Paths:
--------------
    trunk/bibdesk/BDSKDragImageView.h
    trunk/bibdesk/BDSKDragImageView.m
    trunk/bibdesk/BDSKPersonController.m
    trunk/bibdesk/BibDocument_DataSource.m

Modified: trunk/bibdesk/BDSKDragImageView.h
===================================================================
--- trunk/bibdesk/BDSKDragImageView.h   2019-04-28 06:30:54 UTC (rev 23753)
+++ trunk/bibdesk/BDSKDragImageView.h   2019-04-28 13:48:13 UTC (rev 23754)
@@ -46,6 +46,7 @@
 - (BOOL)dragImageView:(BDSKDragImageView *)view acceptDrop:(id 
<NSDraggingInfo>)sender;
 - (NSArray *)draggedItemsForDragImageView:(BDSKDragImageView *)view;
 - (NSImage *)dragImageForDragImageView:(BDSKDragImageView *)view;
+- (NSArray *)dragImageView:(BDSKDragImageView *)view 
namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination;
 @end
 
 

Modified: trunk/bibdesk/BDSKDragImageView.m
===================================================================
--- trunk/bibdesk/BDSKDragImageView.m   2019-04-28 06:30:54 UTC (rev 23753)
+++ trunk/bibdesk/BDSKDragImageView.m   2019-04-28 13:48:13 UTC (rev 23754)
@@ -82,6 +82,12 @@
 - (void)concludeDragOperation:(id <NSDraggingInfo>)sender {
 }
 
+- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination 
{
+    if ([delegate 
respondsToSelector:@selector(dragImageView:namesOfPromisedFilesDroppedAtDestination:)])
+        return [delegate dragImageView:self 
namesOfPromisedFilesDroppedAtDestination:dropDestination];
+    return nil;
+}
+
 - (void)drawRect:(NSRect)aRect {
     [super drawRect:aRect];
     

Modified: trunk/bibdesk/BDSKPersonController.m
===================================================================
--- trunk/bibdesk/BDSKPersonController.m        2019-04-28 06:30:54 UTC (rev 
23753)
+++ trunk/bibdesk/BDSKPersonController.m        2019-04-28 13:48:13 UTC (rev 
23754)
@@ -508,6 +508,14 @@
        return [[[NSWorkspace sharedWorkspace] iconForFileType:@"vcf"] 
dragImageWithCount:1];
 }
 
+- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination 
{
+    NSData *data = [person vCardRepresentation];
+    NSString *fileName = [[person name] stringByAppendingPathExtension:@"vcf"];
+    NSURL *fileURL = [[NSFileManager defaultManager] 
uniqueFileURLWithName:fileName atURL:dropDestination];
+    [data writeToURL:fileURL atomically:YES];
+    return [NSArray arrayWithObjects:[fileURL lastPathComponent], nil];
+}
+
 - (void)pasteboard:(NSPasteboard *)pboard item:(NSPasteboardItem *)item 
provideDataForType:(NSString *)type {
     if ([type isEqualToString:(NSString *)kPasteboardTypeFileURLPromise]) {
         NSURL *dropDestination = [pboard pasteLocationURL];

Modified: trunk/bibdesk/BibDocument_DataSource.m
===================================================================
--- trunk/bibdesk/BibDocument_DataSource.m      2019-04-28 06:30:54 UTC (rev 
23753)
+++ trunk/bibdesk/BibDocument_DataSource.m      2019-04-28 13:48:13 UTC (rev 
23754)
@@ -1176,6 +1176,28 @@
     return success;
 }
 
+- (NSArray *)outlineView:(NSOutlineView *)ov 
namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination 
forDraggedItems:(NSArray *)items {
+    if ([items count] == 1) {
+        BDSKSearchGroup *group = [items firstObject];
+        if ([group groupType] == BDSKSearchGroupType) {
+            NSMutableDictionary *plist = [[[group dictionaryValue] 
mutableCopy] autorelease];
+            
+            // we probably don't want to share this info with anyone else
+            [plist removeObjectForKey:@"search term"];
+            [plist removeObjectForKey:@"history"];
+            
+            NSString *fileName = [[[group serverInfo] name] 
stringByAppendingPathExtension:@"bdsksearch"];
+            
+            // make sure the filename is unique
+            NSURL *fileURL = [[NSFileManager defaultManager] 
uniqueFileURLWithName:fileName atURL:dropDestination];
+            [plist writeToURL:fileURL atomically:YES];
+            
+            return [NSArray arrayWithObjects:[fileURL lastPathComponent], nil];
+        }
+    }
+    return nil;
+}
+
 - (void)outlineView:(NSOutlineView *)ov 
concludeDragOperation:(NSDragOperation)operation {
     [self clearPromisedDraggedItems];
 }

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