How to detect a paste request for file copy/paste?
How to detect a paste request for file copy/paste?
- Subject: How to detect a paste request for file copy/paste?
- From: Ling Li <email@hidden>
- Date: Tue, 9 Dec 2008 14:58:23 -0800
- Acceptlanguage: en-US
- Thread-topic: How to detect a paste request for file copy/paste?
I want to implement a delayed file paste feature for file copy/paste. When I first put file lists into the clipboard, the files are actually not existing yet (in another unmapped network place). These files will only be created after got the paste request. So my question is how to detect the paste request? I tried to implement NSFilesPromisePboardType for copy/paste, but never work. So my question is, after I put something into pasteboard, how can I get notification when another application does paste?
Here is my test code:
NSPasteboard *pboard = [NSPasteboard generalPasteboard];
NSMutableArray *types = [[NSMutableArray alloc] init];
[types addObject:NSFilesPromisePboardType];
[pboard declareTypes:types owner:self];
[types release];
I also implemented namesOfPromisedFilesDroppedAtDestination, which just provide the file path. After I run, the paste item with both Finder and PasteboardKeeper is never highlighted, so I can not paste. If I click 'Show clipboard', it shows nothing in the window, and show 'Clipboard contents: unknown' in the bottom status bar.
I also tried first put NSFilenamesPboardType into pboard, and implemented pasteboard:provideDataForType:, and still nothing happen.
So my question is:
1. Is there any promised file copy/paste?
2. How can I get paste notification? Can I get destination path then I can write files directly to destination like promised DnD did?
Thanks for any help.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden