Re: Recently Opened in Doc
Re: Recently Opened in Doc
- Subject: Re: Recently Opened in Doc
- From: Brad Stone <email@hidden>
- Date: Sat, 04 Feb 2012 11:32:06 -0500
Thanks everyone. In the end, since this is a shoebox app like iPhoto where the user doesn't access their data via File->Open and the file name doesn't necessarily make sense to the user I suppressed the Open Recently menu (the user has a History menu like Safari for that purpose). For the dock menu I made my own which allowed me to give the user menu item titles that would mean something to them. I did it two parts. First I did this to suppress the default functionality:
- (NSUInteger)maximumRecentDocumentCount {
return 0;
}
and then I provide my own using - (NSMenu *)applicationDockMenu:(NSApplication *)sender. I'm not doing a lot of calculations here so it comes up quickly for the user.
On Jan 28, 2012, at 5:58 PM, James Merkel wrote:
> On 28 Jan 2012 08:46:48 -0800 Quincey Morris wrote:
>
>> On Jan 28, 2012, at 08:19 , Brad Stone wrote:
>>
>>> I have a shoebox app like iPhoto where the actual filename is irrelevant to the user. I control the file name.
>>>
>>> What I'd like to do is just capture the menu items before they're displayed and change the menu titles into something relevant to the user. In the scheme of things it's a minor way to access the info in my app so if I could eliminate them that would be OK too. Changing the filename is not an option at this point.
>>
>> It seems to me you can subclass NSDocumentController, then override 'noteNewRecentDocument:' to do nothing. Presumably this will keep your filename off the "Open Recent" submenu, the "Recent Items" item on the Apple menu, and the dock menu. Then you should be able to delete the "Open Recent" item itself, and be left with no traces of recent items from your app.
>>
>> If you wanted to go the extra mile, you could create your own recent-items implementation, driven from your 'noteNewRecentDocument:' override, and using the 'applicationDockMenu:' application delegate method, with whatever document identifiers you want.
>
>
> My app is not document based so I call noteNewRecentDocumentURL: directly to add the filename to the Open Recent submenu list.
> If I comment that line of code out then the document is not added to the list as expected. Also, the Dock menu "Show Recents" shows nothing and the filename is not added to the Dock menu list.
>
> So yes, noteNewRecentDocument; (which calls noteNewRecentDocumentURL: ) is the key to the whole thing.
>
> Jim Merkel
_______________________________________________
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