diff options
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:) || |