aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-10-06 20:50:36 +0000
committerBibiko <bibiko@eva.mpg.de>2009-10-06 20:50:36 +0000
commit3bbcf08f70e3b8538d0a89e686051581bb5ecd09 (patch)
tree489c10a6b71756f7c6ef3d9cd7746eb8fa3a0c8a /Source
parent23c8a125dca16dd846a25d7ab30266e52f8048f2 (diff)
downloadsequelpro-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')
-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:) ||