diff options
author | Bibiko <bibiko@eva.mpg.de> | 2009-10-06 20:50:36 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2009-10-06 20:50:36 +0000 |
commit | 3bbcf08f70e3b8538d0a89e686051581bb5ecd09 (patch) | |
tree | 489c10a6b71756f7c6ef3d9cd7746eb8fa3a0c8a /Source/TableDocument.m | |
parent | 23c8a125dca16dd846a25d7ab30266e52f8048f2 (diff) | |
download | sequelpro-3bbcf08f70e3b8538d0a89e686051581bb5ecd09.tar.gz sequelpro-3bbcf08f70e3b8538d0a89e686051581bb5ecd09.tar.bz2 sequelpro-3bbcf08f70e3b8538d0a89e686051581bb5ecd09.zip |
• added main menu item: "Open “<file>” in New Window" ⌥⌘O as alternated menu item bound to "Open…"
- this action opens the current file-based connection in a new window by reading <file> again
Diffstat (limited to 'Source/TableDocument.m')
-rw-r--r-- | Source/TableDocument.m | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 10f74e67..1c9613fa 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -1951,6 +1951,20 @@ contextInfo:nil]; } +- (IBAction)openCurrentConnectionInNewWindow:(id)sender +{ + TableDocument *newTableDocument; + + // Manually open a new document, setting SPAppController as sender to trigger autoconnection + if (newTableDocument = [[NSDocumentController sharedDocumentController] makeUntitledDocumentOfType:@"SequelPro connection" error:nil]) { + [newTableDocument setShouldAutomaticallyConnect:NO]; + [[NSDocumentController sharedDocumentController] addDocument:newTableDocument]; + [newTableDocument makeWindowControllers]; + [newTableDocument showWindows]; + [newTableDocument initWithConnectionFile:[[[self fileURL] absoluteString] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; + } +} + - (void)closeConnection { [mySQLConnection disconnect]; @@ -2613,6 +2627,17 @@ return ([menuItem action] == @selector(newDocument:) || [menuItem action] == @selector(terminate:)); } + if ([menuItem action] == @selector(openCurrentConnectionInNewWindow:)) + { + if([[[self fileURL] absoluteString] hasPrefix:@"/"]) { + [menuItem setTitle:[NSString stringWithFormat:NSLocalizedString(@"Open “%@” in New Window", @"menu item open “%@” in new window"), [[[[self fileURL] absoluteString] lastPathComponent] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]; + return YES; + } else { + [menuItem setTitle:NSLocalizedString(@"Open in New Window", @"menu item open in new window")]; + return NO; + } + } + if ([menuItem action] == @selector(import:) || [menuItem action] == @selector(export:) || [menuItem action] == @selector(exportMultipleTables:) || |