Saturday, 15 June 2013

objective c - Get dropped mail message from Apple Mail in Cocoa -



objective c - Get dropped mail message from Apple Mail in Cocoa -

i googled , read docs. searched on so, found answers propose usage of applescript, can't utilize applescript because of sandbox.

i working on cocoa application (written in objective-c , sandboxed). implementing drag-and-drop apple mail service application. app should receive or re-create eml mail service message finder does.

i tried looking @ nspromisedfilespboardtype hardly figure out how should work it. tried such code in - (bool)acceptdrop:(id<nsdragginginfo>)info method:

if ([info.draggingpasteboard.types containsobject:@"mv super-secret message transfer pasteboard type"]) { nsurl *tempfolder = [fm createtempfolderinfolder:appdatadir()]; nsarray *filenames = [info namesofpromisedfilesdroppedatdestination:tempfolder]; // tempfolder filepath of generated temp folder in appdata directory accessible sandboxed app // filenames becomes nil homecoming yes; }

when seek iterating through types in pasteboard, see:

dropped types are: type: dyn.ah62d4rv4gu8y4zvanr41a3pwfz30n25wqz4ca5pfsr30c35feb4he2pssrxgn6vasbu1g7dfqm10c6xeeb4hw6df (null) type: mv super-secret message transfer pasteboard type (null) type: dyn.ah62d4rv4gu8zg7puqz3c465fqr3gn7bakf41k55rqf4g86vasbu1g7dfqm10c6xeeb4hw6df ( { business relationship = gmail; id = 6622; mailbox = inbox; subject = "got suv?"; } ) type: super-secret automator pasteboard type ( { business relationship = gmail; id = 6622; mailbox = inbox; subject = "got suv?"; } ) type: dyn.ah62d4rv4gu8yc6durvwwa3xmrvw1gkdusm1044pxqyuha2pxsvw0e55bsmwca7d3sbwu ( eml ) type: apple files promise pasteboard type ( eml ) type: public.url (null) type: corepasteboardflavortype 0x75726c20 (null) type: dyn.ah62d4rv4gu8yc6durvwwaznwmuuha2pxsvw0e55bsmwca7d3sbwu ( "message:%3c1a392cb9-b78c-402d-8d7f-dbd1d4a9ec42@neptune.do.losaltos.k12.ca.us%3e", "" ) type: apple url pasteboard type ( "message:%3c1a392cb9-b78c-402d-8d7f-dbd1d4a9ec42@neptune.do.losaltos.k12.ca.us%3e", "" ) type: public.url-name (null) type: corepasteboardflavortype 0x75726c6e (null) type: com.apple.pasteboard.promised-file-content-type com.apple.mail.email type: com.apple.pasteboard.promised-file-url (null) type: dyn.ah62d4rv4gu8y6y4usm1044pxqzb085xyqz1hk64uqm10c6xenv61a3k (null) type: nspromisecontentspboardtype (null)

anyone help me?

i went through process , pretty easy actually.

look "com.apple.pasteboard.promised-file-content-type = com.apple.mail.email" in pasteboard types , if found phone call namesofpromisedfilesdroppedatdestination (from nsdragginginfo) drop destination url , file created when drag finished.

objective-c cocoa drag-and-drop

No comments:

Post a Comment