Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Excluding non-export file types from the Export dialog.



I've been looking for an answer to this for a week now. Nothing I come up with seems to work. Surly others have come across this? How do you folks make your export dialogs?

Here's what I've done:

I've set up an "Export As…" menu in my application. I've wired it to First Responder's saveDocumentTo:. I've added two file types (html and rtf) to my info.plist, set their CFBundleTypeRole to "None", and put references to both those type in NSExportableAs in my native file format. So the file section of my info.plist looks like:

<key>CFBundleDocumentTypes</key>
<array>
<dict>
	<key>CFBundleTypeExtensions</key>
	<array>
		<string>native</string>
	</array>
	<key>CFBundleTypeIconFile</key>
	<string>Native</string>
	<key>CFBundleTypeMIMETypes</key>
	<array>
		<string>application/octet-stream</string>
	</array>
	<key>CFBundleTypeName</key>
	<string>Native Type</string>
	<key>CFBundleTypeRole</key>
	<string>Editor</string>
	<key>LSTypeIsPackage</key>
	<false/>
	<key>NSDocumentClass</key>
	<string>MyDocument</string>
	<key>NSExportableAs</key>
	<array>
		<string>HTML</string>
		<string>RTF</string>
	</array>
	<key>NSPersistentStoreTypeKey</key>
	<string>Binary</string>
</dict>
<dict>
	<key>CFBundleTypeExtensions</key>
	<array>
		<string>html</string>
	</array>
	<key>CFBundleTypeName</key>
	<string>HTML</string>
	<key>CFBundleTypeRole</key>
	<string>None</string>
	<key>LSTypeIsPackage</key>
	<false/>
	<key>NSPersistentStoreTypeKey</key>
	<string>InMemory</string>
</dict>
<dict>
	<key>CFBundleTypeExtensions</key>
	<array>
		<string>rtf</string>
	</array>
	<key>CFBundleTypeName</key>
	<string>RTF</string>
	<key>CFBundleTypeRole</key>
	<string>None</string>
	<key>LSTypeIsPackage</key>
	<false/>
	<key>NSPersistentStoreTypeKey</key>
	<string>InMemory</string>
</dict>

When I select "Export As…" from my menu, a standard save sheet pops out and has a list of formats in a pop-up button as its accessory view. So far so good.

HOWEVER, in addition to "HTML" and "RTF" (listed in NSExportableAs), "Native" also shows up in the file format popup. That's just wrong. If I wanted to write the native format, I'd use Save or Save As…, not Export As…. In every cocoa program I've ever used, the only file formats to appear in the export dialog are the ones listed in NSExportableAs. Not the rest

This question has been asked a few times[1][2], but it's never been answered. Is there really no solution for this (other that rolling a custom accessory view)!?

[1]: http://lists.apple.com/archives/cocoa-dev/2003/Sep/msg00071.html
[2]: http://lists.apple.com/archives/cocoa-dev/2004/Dec/msg00359.html


Many thanks! -Joshua Emmons _______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.