aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--Interfaces/English.lproj/MainMenu.xib267
-rw-r--r--Source/SPAppController.m5
-rw-r--r--Source/TableDocument.h1
-rw-r--r--Source/TableDocument.m25
4 files changed, 287 insertions, 11 deletions
diff --git a/Interfaces/English.lproj/MainMenu.xib b/Interfaces/English.lproj/MainMenu.xib
index 1b9c9754..4994a0a7 100644
--- a/Interfaces/English.lproj/MainMenu.xib
+++ b/Interfaces/English.lproj/MainMenu.xib
@@ -12,7 +12,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="628"/>
+ <integer value="81"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -275,6 +275,17 @@
<reference key="NSMixedImage" ref="315854375"/>
<int key="NSTag">1002</int>
</object>
+ <object class="NSMenuItem" id="949877576">
+ <reference key="NSMenu" ref="709725194"/>
+ <bool key="NSIsAlternate">YES</bool>
+ <string key="NSTitle">Open in New Window</string>
+ <string key="NSKeyEquiv">o</string>
+ <int key="NSKeyEquivModMask">1572864</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="625762401"/>
+ <reference key="NSMixedImage" ref="315854375"/>
+ <int key="NSTag">1100</int>
+ </object>
<object class="NSMenuItem" id="1001934250">
<reference key="NSMenu" ref="709725194"/>
<string key="NSTitle">Open Recent</string>
@@ -2713,6 +2724,14 @@
</object>
<int key="connectionID">997</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">openCurrentConnectionInNewWindow:</string>
+ <reference key="source" ref="63651044"/>
+ <reference key="destination" ref="949877576"/>
+ </object>
+ <int key="connectionID">999</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -2931,6 +2950,7 @@
<reference ref="643339783"/>
<reference ref="1001934250"/>
<reference ref="894994307"/>
+ <reference ref="949877576"/>
</object>
<reference key="parent" ref="86447006"/>
</object>
@@ -4018,6 +4038,11 @@
<reference key="object" ref="718573983"/>
<reference key="parent" ref="172963563"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">998</int>
+ <reference key="object" ref="949877576"/>
+ <reference key="parent" ref="709725194"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -4371,6 +4396,7 @@
<string>992.IBPluginDependency</string>
<string>995.IBPluginDependency</string>
<string>996.IBPluginDependency</string>
+ <string>998.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -4429,7 +4455,7 @@
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
- <string>{{495, 295}, {280, 283}}</string>
+ <string>{{503, 227}, {280, 283}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{654, 613}, {157, 223}}</string>
@@ -4461,7 +4487,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{449, 1007}, {197, 53}}</string>
- <string>{{584, 510}, {511, 20}}</string>
+ <string>{{355, 510}, {511, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{506, 836}, {511, 20}}</string>
@@ -4471,7 +4497,7 @@
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
- <string>{{570, 370}, {213, 133}}</string>
+ <string>{{667, 147}, {210, 133}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{399, 465}, {213, 93}}</string>
@@ -4514,7 +4540,7 @@
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
- <string>{{539, 325}, {237, 253}}</string>
+ <string>{{547, 257}, {237, 253}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{698, 703}, {184, 133}}</string>
@@ -4532,7 +4558,7 @@
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
- <string>{{326, 341}, {215, 253}}</string>
+ <string>{{367, 257}, {215, 253}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{518, 583}, {218, 253}}</string>
@@ -4540,7 +4566,7 @@
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
- <string>{{826, 327}, {251, 183}}</string>
+ <string>{{597, 327}, {251, 183}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{312, 683}, {231, 153}}</string>
@@ -4609,7 +4635,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{907, 327}, {265, 183}}</string>
+ <string>{{678, 327}, {265, 183}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{829, 663}, {268, 173}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -4637,7 +4663,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{453, 275}, {206, 303}}</string>
+ <string>{{461, 187}, {235, 323}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{180, 535}, {182, 253}}</string>
@@ -4760,7 +4786,8 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{559, 640}, {146, 23}}</string>
+ <string>{{696, 397}, {143, 23}}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -4788,7 +4815,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">997</int>
+ <int key="maxID">999</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -5423,6 +5450,224 @@
</object>
<reference key="sourceIdentifier" ref="939419192"/>
</object>
+ <object class="IBPartialClassDescription">
+ <string key="className">TableDocument</string>
+ <string key="superclassName">NSDocument</string>
+ <object class="NSMutableDictionary" key="actions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>addConnectionToFavorites:</string>
+ <string>addDatabase:</string>
+ <string>analyzeTable:</string>
+ <string>backForwardInHistory:</string>
+ <string>checkTable:</string>
+ <string>checksumTable:</string>
+ <string>chooseDatabase:</string>
+ <string>chooseEncoding:</string>
+ <string>closeDatabaseSheet:</string>
+ <string>closeErrorConnectionSheet:</string>
+ <string>closePanelSheet:</string>
+ <string>closePasswordSheet:</string>
+ <string>closeSheet:</string>
+ <string>copy:</string>
+ <string>copyCreateTableSyntax:</string>
+ <string>copyCreateTableSyntaxFromSheet:</string>
+ <string>copyServerVariableName:</string>
+ <string>copyServerVariableValue:</string>
+ <string>export:</string>
+ <string>exportMultipleTables:</string>
+ <string>exportTable:</string>
+ <string>flushPrivileges:</string>
+ <string>flushTable:</string>
+ <string>import:</string>
+ <string>openCurrentConnectionInNewWindow:</string>
+ <string>optimizeTable:</string>
+ <string>removeDatabase:</string>
+ <string>repairTable:</string>
+ <string>saveConnectionSheet:</string>
+ <string>saveCreateSyntax:</string>
+ <string>saveServerVariables:</string>
+ <string>setDatabases:</string>
+ <string>showCreateTableSyntax:</string>
+ <string>showMySQLHelp:</string>
+ <string>showUserManager:</string>
+ <string>showVariables:</string>
+ <string>validateSaveConnectionAccessory:</string>
+ <string>viewContent:</string>
+ <string>viewQuery:</string>
+ <string>viewRelations:</string>
+ <string>viewStatus:</string>
+ <string>viewStructure:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="outlets">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>addDatabaseButton</string>
+ <string>chooseDatabaseButton</string>
+ <string>connectionErrorDialog</string>
+ <string>contentViewSplitter</string>
+ <string>createTableSyntaxTextField</string>
+ <string>createTableSyntaxTextView</string>
+ <string>createTableSyntaxWindow</string>
+ <string>customQueryInstance</string>
+ <string>customQueryTextView</string>
+ <string>databaseDataInstance</string>
+ <string>databaseEncodingButton</string>
+ <string>databaseNameField</string>
+ <string>databaseSheet</string>
+ <string>dbTablesTableView</string>
+ <string>encodingPopUp</string>
+ <string>exportControllerInstance</string>
+ <string>extendedTableInfoInstance</string>
+ <string>favoritesButton</string>
+ <string>historyControl</string>
+ <string>inputTextWindow</string>
+ <string>inputTextWindowHeader</string>
+ <string>inputTextWindowMessage</string>
+ <string>inputTextWindowSecureTextField</string>
+ <string>listFilterField</string>
+ <string>queryProgressBar</string>
+ <string>saveConnectionAccessory</string>
+ <string>saveConnectionAutoConnect</string>
+ <string>saveConnectionEncrypt</string>
+ <string>saveConnectionEncryptString</string>
+ <string>saveConnectionIncludeData</string>
+ <string>saveConnectionIncludeQuery</string>
+ <string>saveConnectionSavePassword</string>
+ <string>saveConnectionSavePasswordAlert</string>
+ <string>saveVariablesButton</string>
+ <string>sidebarGrabber</string>
+ <string>spHistoryControllerInstance</string>
+ <string>tableContentInstance</string>
+ <string>tableDataInstance</string>
+ <string>tableDumpInstance</string>
+ <string>tableInfoCollapseButton</string>
+ <string>tableInfoTable</string>
+ <string>tableListSplitter</string>
+ <string>tableRelationsInstance</string>
+ <string>tableSourceInstance</string>
+ <string>tableTabView</string>
+ <string>tableWindow</string>
+ <string>tablesListInstance</string>
+ <string>titleAccessoryView</string>
+ <string>titleImageView</string>
+ <string>titleStringView</string>
+ <string>variablesCountTextField</string>
+ <string>variablesSearchField</string>
+ <string>variablesSheet</string>
+ <string>variablesTableView</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ <string>NSWindow</string>
+ <string>NSSplitView</string>
+ <string>NSTextField</string>
+ <string>NSTextView</string>
+ <string>NSWindow</string>
+ <string>id</string>
+ <string>NSTextView</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>NSTableView</string>
+ <string>NSPopUpButton</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>NSSearchField</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>NSSecureTextField</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>NSButton</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>NSButton</string>
+ <string>NSTableView</string>
+ <string>NSSplitView</string>
+ <string>id</string>
+ <string>id</string>
+ <string>NSTabView</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>NSTextField</string>
+ <string>NSSearchField</string>
+ <string>id</string>
+ <string>id</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBDocumentRelativeSource</string>
+ <string key="minorKey">../../Source/TableDocument.h</string>
+ </object>
+ </object>
</object>
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<bool key="EncodedWithXMLCoder">YES</bool>
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:) ||