Is there a way to add an item that does not point to a file that exists in the file system in the "Open Recent" menu?
In a non-NSDocument-based application, I can add an item to the Open Recent submenu with the following code:
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:[NSURL URLWithString:stringToFilePath]];
It works as a document if the URL points to a file that exists in the file system.
If the URL does not point to a file on the system, such as a web url or custom URL scheme, nothing happens.
For example, this code has no effect and does not generate any logs at runtime, even if my application processes the scheme used in the URL:
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:[NSURL URLWithString:@"http://www.stackoverflow.com"]];
Update: someone found (a long time ago) a way to configure this menu to show files whether they exist or not: http://lists.apple.com/archives/cocoa-dev/2007/Apr/msg00651 .html
I managed to subclass NSDocumentController, but my method override - (NSArray *) recentDocumentURLs is never called.
Not surprising, as the document says:
This method is not good to override, since the internal NSDocumentController is not usually used use it.
But the document does not say what to use instead, and the poster did not provide more detailed information. Any idea?
, .
, , , (, , , ).