Re: Controlling the Open Recent menu
Re: Controlling the Open Recent menu
- Subject: Re: Controlling the Open Recent menu
- From: Hasan Diwan <email@hidden>
- Date: Fri, 5 Sep 2003 15:30:25 +0200
The WebKit contains a mechanism for storing Recent pages in a menu. I
used it for OrchidMail, relevant code is below:
- (void)addToHistory:(WebView *)w {
NSMenu *historyMenu = [[[NSApp mainMenu] itemAtIndex:4] submenu];
NSMenuItem *pageItem = [[[NSMenuItem alloc] initWithTitle:[[[w
mainFrame] da
taSource] pageTitle] action:@selector(loadPage:) keyEquivalent:@" "]
autorelease
];
[historyMenu insertItem:pageItem atIndex:0];
}
Cheers!
On Friday, Sep 5, 2003, at 12:15 Europe/Copenhagen, Will Thimbleby
wrote:
Cheers, FYI putting non-file based URLs into the menu gets an error
-[NSFileManager fileSystemRepresentationWithPath:]: nil or empty path
argument
It seems that if you want non-file URLs in the recents menu then you
need to code it yourself.
-Will
On Friday, September 5, 2003, at 06:41 am, Kyle Hammond wrote:
Hi Will,
NSDocumentController handles the Open Recent menu, even in
non-document based applications. See documentation on the following
methods.
- (NSArray *)recentDocumentURLs;
- (void)noteNewRecentDocumentURL:(NSURL *)url;
- (void)noteNewRecentDocument:(NSDocument *)document;
- (IBAction)clearRecentDocuments:(id)sender;
You should be able to add your own URL to the menu using
[ [ NSDocumentController sharedDocumentController ]
noteNewRecentDocumentURL:yourURL ];
Putting non-file based URLs into the menu may or may not work. Also,
putting in URLs that your own application doesn't handle may or may
not work. I've never tried it.
Best of luck.
Kyle
On Friday, September 5, 2003, at 12:00 AM,
email@hidden wrote:
Date: Fri, 5 Sep 2003 03:17:45 +0100
Subject: Controlling the Open Recent menu
From: Will Thimbleby <email@hidden>
Hi guys,
Is there anyway you know of being able to use the "Open Recent" menu
to
store&open NSURLs that don't point to files, for example web pages or
specific app bookmarks. If not is there a system default that defines
the number of items that should be in the menu, and I'll have to
write
it myself.
Cheer -Will
---------------------
Kyle Hammond
email@hidden
<http://www.snowmintcs.com/> - personal finance software
<http://www.codeblazer.com/> - multimedia software solutions
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
Hasan Diwan {
http://ibn.com/~hdiwan}
OpenPGP Fingerprint: 275D 0E84 550C D92A 4A56 732C 8528 2579 E6E9 4842
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.