Add files opened/saved from :browse to "Recent Files" menu

This commit is contained in:
Bjorn Winckler
2008-05-10 16:07:58 +02:00
parent 31bd050607
commit f08c899208
4 changed files with 30 additions and 5 deletions
+1 -3
View File
@@ -292,10 +292,8 @@ static int executeInLoginShell(NSString *path, NSArray *args);
// Don't add files that are being edited remotely (using ODB).
if ([arguments objectForKey:@"remoteID"]) continue;
NSURL *url = [NSURL fileURLWithPath:[filenames objectAtIndex:i]];
if (!url) continue;
[[NSDocumentController sharedDocumentController]
noteNewRecentDocumentURL:url];
noteNewRecentFilePath:[filenames objectAtIndex:i]];
}
if ((openInTabs && (vc = [self topmostVimController]))
+8 -2
View File
@@ -922,9 +922,15 @@ static NSTimeInterval MMResendInterval = 0.5;
- (void)savePanelDidEnd:(NSSavePanel *)panel code:(int)code
context:(void *)context
{
NSString *string = (code == NSOKButton) ? [panel filename] : nil;
NSString *path = (code == NSOKButton) ? [panel filename] : nil;
@try {
[backendProxy setDialogReturn:string];
[backendProxy setDialogReturn:path];
// Add file to the "Recent Files" menu (this ensures that files that
// are opened/saved from a :browse command are added to this menu).
if (path)
[[NSDocumentController sharedDocumentController]
noteNewRecentFilePath:path];
}
@catch (NSException *e) {
NSLog(@"Exception caught in %s %@", _cmd, e);
+7
View File
@@ -277,6 +277,13 @@ NSString *buildSearchTextCommand(NSString *searchText);
@interface NSDocumentController (MMExtras)
- (void)noteNewRecentFilePath:(NSString *)path;
@end
// ODB Editor Suite Constants (taken from ODBEditorSuite.h)
#define keyFileSender 'FSnd'
#define keyFileSenderToken 'FTok'
+14
View File
@@ -294,3 +294,17 @@ buildSearchTextCommand(NSString *searchText)
@end // NSColor (MMExtras)
@implementation NSDocumentController (MMExtras)
- (void)noteNewRecentFilePath:(NSString *)path
{
NSURL *url = [NSURL fileURLWithPath:path];
if (url)
[self noteNewRecentDocumentURL:url];
}
@end // NSDocumentController (MMExtras)