Hi, I would like my document based app to be able to send its files as email 
attachments. I notice that the Finder has the services option to send a file as 
an attachment, and kind of thought that something like that might have been 
built in to the document architecture, but apparently not. It does appear to be 
a standard service that is available and listed in the system preferences.

I assumed that if I wanted to try this out, I should be able to do something 
like this in my NSDocument subclass:

+ (void)initialize {
    [NSApp registerServicesMenuSendTypes:[NSArray 
arrayWithObjects:NSFilenamesPboardType, NSFileContentsPboardType, 
NSURLPboardType, NSFilesPromisePboardType, nil] returnTypes:nil];
}

- (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString 
*)returnType {
    return nil;
}

- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray 
*)types {
    return NO;
}

(assuming that the "New Email With Attachment" service would take one of the 
pasteboard types I had specified). I then put breakpoints in the other two 
methods, but they were never called.

I realize that there are other ways that something like this could be 
accomplished, but seeing as the service is there, I wanted to try to get it 
working that way. 

Can anyone enlighten me on how this is supposed to be done?


Thanks

Gideon






_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to