aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPAppController.m5
-rw-r--r--Source/TableDocument.h1
-rw-r--r--Source/TableDocument.m25
3 files changed, 31 insertions, 0 deletions
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index 94a732b9..547d1e9c 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -87,6 +87,11 @@
return NO;
}
}
+ if ([menuItem action] == @selector(openCurrentConnectionInNewWindow:))
+ {
+ [menuItem setTitle:NSLocalizedString(@"Open in New Window", @"menu item open in new window")];
+ return NO;
+ }
return YES;
}
diff --git a/Source/TableDocument.h b/Source/TableDocument.h
index 3a8adbfb..37f8ca60 100644
--- a/Source/TableDocument.h
+++ b/Source/TableDocument.h
@@ -166,6 +166,7 @@ enum sp_current_query_mode
- (IBAction)removeDatabase:(id)sender;
- (IBAction)showMySQLHelp:(id)sender;
- (IBAction)saveServerVariables:(id)sender;
+- (IBAction)openCurrentConnectionInNewWindow:(id)sender;
- (NSArray *)allDatabaseNames;
// Encoding methods
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:) ||