Re: Getting file type from Save dlog
Re: Getting file type from Save dlog
- Subject: Re: Getting file type from Save dlog
- From: Steve Mills <email@hidden>
- Date: Wed, 30 Jan 2013 15:27:55 -0600
On Jan 30, 2013, at 15:15:32, Kevin Perry <email@hidden>
wrote:
> On Jan 30, 2013, at 12:32 PM, Steve Mills <email@hidden> wrote:
>
>> I finally got this all figured out. This is a mess. It's goofy that Apple decided to send the localized type name strings here
>
> I’m not following you here. What is sending localized type names where?
NSDocument methods:
-(BOOL) writeToURL:(NSURL*)absoluteURL ofType:(NSString*)typeName error:(NSError**)outError
passes the type in typeName.
-(NSArray*) writableTypesForSaveOperation:(NSSaveOperationType)saveOperation
expects an array of type name strings.
-(NSString*) fileTypeFromLastRunSavePanel
returns the type name string. Etc.
> The way NSSavePanel is designed, it is completely agnostic of the accessory view inserted into it, even one owned by NSDocument. It has no idea how to change the contents of the accessory view based on what you pass to -setAllowedFileTypes:—there may not even be a document type popup there at all.
Right, which means NSDocument should've had its various methods that deal with its accessory panel use something more viable like extensions and/or UTIs, which is exactly what NSSavePanel uses to deal with file types.
> If you want to customize what types NSDocument shows in its default accessory view, then overriding -writableTypesForSaveOperation: is exactly the right thing to do. Sorry for the trouble you had in discovering that—would you like to file a documentation bug with a suggested improvement?
I just might do that. Although NSDocument has already gone through big changes in the way it handles saving documents, I wonder how likely they'd be to change it again.
--
Steve Mills
office: 952-818-3871
home: 952-401-6255
cell: 612-803-6157
_______________________________________________
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