Re: How to filter the NSOpenPanel with "Recommended Applications"
Re: How to filter the NSOpenPanel with "Recommended Applications"
- Subject: Re: How to filter the NSOpenPanel with "Recommended Applications"
- From: Tony Romano <email@hidden>
- Date: Thu, 27 May 2010 18:14:25 -0700
Adding to what others have said.
1. Determine a list of applications that can work with the file type. Use Launch Services (LSGetApplicationURLs for URLs).
2. In the your open panel delegate, implement: shouldEnableURL and return YES if the application is on the list
3. You may also have an application that is not listed in the directory that is currently showing, therefore, you should consider enabling all the directories as well so the user can navigate to the app under the correct directory.
-Tony
On May 26, 2010, at 7:55 PM, appleBoy chen wrote:
> Hi All,
>
> I want to show the Panel like Finder's "Choose Application" to let user
> slect one application to open with the file.
> Follow is my code:
>
> NSOpenPanel *openPanel = [NSOpenPanel openPanel];
> [openPanel setCanChooseDirectories:NO];
> [openPanel setCanChooseFiles:YES];
> [openPanel setAllowsMultipleSelection:NO];
> if([openPanel runModalForTypes:[NSArray arrayWithObjects:@"app",nil]] ==
> NSOKButton)
> {
> ...
> }
>
> And, I want to only show the supported application for the associated file.
> Like Finder's "Choose Application" Panel, it can set Eanble to "Recommended
> Applications" to filter the applications. the NSOpenPanel can support it?
> or i must usr another solution. thanks for any reply.
>
> best regards
> Kakaxi
> _______________________________________________
>
> 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
>
-Tony
_______________________________________________
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