Give the application delegate a chance to open documents from the

recent documents menu. This makes the menu available to non-document
based applications as documented and implemented by Apple.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30386 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2010-05-14 07:42:34 +00:00
parent 0693cd9edc
commit 7f90afe7bc
2 changed files with 20 additions and 0 deletions

View file

@ -1688,6 +1688,19 @@ static NSString *processName = nil;
return;
}
url = (NSURL *)[_recent_documents objectAtIndex: idx];
if ([url isFileURL])
{
/* From Apple's documentation of the -noteNewRecentDocumentURL: method:
"Applications not based on NSDocument must also implement the
application:openFile: method in the application delegate to
handle requests from the Open Recent menu command." */
id appDelegate = [NSApp delegate];
if ([appDelegate respondsToSelector: @selector(application:openFile:)])
{
if ([appDelegate application: NSApp openFile: [url path]])
return;
}
}
[self openDocumentWithContentsOfURL: url display: YES];
}