aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-08-20 11:16:14 +0000
committerBibiko <bibiko@eva.mpg.de>2009-08-20 11:16:14 +0000
commitbe6b947b45c4e7e883c6369316feebfa01ef75c8 (patch)
tree208e3312874aa3e22e96363be89504d4765b1e88
parent25b8ef5121716a1b68982a7aacdc38322f179c8f (diff)
downloadsequelpro-be6b947b45c4e7e883c6369316feebfa01ef75c8.tar.gz
sequelpro-be6b947b45c4e7e883c6369316feebfa01ef75c8.tar.bz2
sequelpro-be6b947b45c4e7e883c6369316feebfa01ef75c8.zip
• Main Menu > File
- renamed "Open" into "Open…" plus tooltip - added "Save Query…" (enabled if a query is in the editor and rename 'Query' to 'Queries' dynamically) [still hidden] - added "Save Connection…" [still hidden] • added method numberOfQueries to CustomQuery • 'Save Query…" and "Save Connection…" are bound to the same connector distinguished via their tags
-rw-r--r--Interfaces/English.lproj/MainMenu.xib73
-rw-r--r--Source/CustomQuery.h4
-rw-r--r--Source/CustomQuery.m7
-rw-r--r--Source/TableDocument.m25
4 files changed, 87 insertions, 22 deletions
diff --git a/Interfaces/English.lproj/MainMenu.xib b/Interfaces/English.lproj/MainMenu.xib
index 661d0011..bc93e9cb 100644
--- a/Interfaces/English.lproj/MainMenu.xib
+++ b/Interfaces/English.lproj/MainMenu.xib
@@ -8,6 +8,7 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="81"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -250,23 +251,13 @@
</object>
<object class="NSMenuItem" id="849728981">
<reference key="NSMenu" ref="709725194"/>
- <string key="NSTitle">Open</string>
+ <string type="base64-UTF8" key="NSTitle">T3BlbuKApg</string>
<string key="NSKeyEquiv">o</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="625762401"/>
<reference key="NSMixedImage" ref="315854375"/>
</object>
- <object class="NSMenuItem" id="256715652">
- <reference key="NSMenu" ref="709725194"/>
- <bool key="NSIsHidden">YES</bool>
- <string key="NSTitle">Save</string>
- <string key="NSKeyEquiv">s</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="625762401"/>
- <reference key="NSMixedImage" ref="315854375"/>
- </object>
<object class="NSMenuItem" id="3878246">
<reference key="NSMenu" ref="709725194"/>
<bool key="NSIsDisabled">YES</bool>
@@ -287,6 +278,27 @@
<reference key="NSOnImage" ref="625762401"/>
<reference key="NSMixedImage" ref="315854375"/>
</object>
+ <object class="NSMenuItem" id="256715652">
+ <reference key="NSMenu" ref="709725194"/>
+ <bool key="NSIsHidden">YES</bool>
+ <string type="base64-UTF8" key="NSTitle">U2F2ZSBRdWVyeeKApg</string>
+ <string key="NSKeyEquiv">s</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="625762401"/>
+ <reference key="NSMixedImage" ref="315854375"/>
+ </object>
+ <object class="NSMenuItem" id="283468712">
+ <reference key="NSMenu" ref="709725194"/>
+ <bool key="NSIsHidden">YES</bool>
+ <string type="base64-UTF8" key="NSTitle">U2F2ZSBDb25uZWN0aW9u4oCmA</string>
+ <string key="NSKeyEquiv">S</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="625762401"/>
+ <reference key="NSMixedImage" ref="315854375"/>
+ <int key="NSTag">1</int>
+ </object>
<object class="NSMenuItem" id="985746359">
<reference key="NSMenu" ref="709725194"/>
<bool key="NSIsDisabled">YES</bool>
@@ -2583,6 +2595,14 @@
</object>
<int key="connectionID">962</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">saveConnectionSheet:</string>
+ <reference key="source" ref="63651044"/>
+ <reference key="destination" ref="283468712"/>
+ </object>
+ <int key="connectionID">964</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -2806,8 +2826,9 @@
<reference ref="3878246"/>
<reference ref="934534577"/>
<reference ref="849728981"/>
- <reference ref="256715652"/>
<reference ref="320151386"/>
+ <reference ref="256715652"/>
+ <reference ref="283468712"/>
</object>
<reference key="parent" ref="86447006"/>
</object>
@@ -3845,6 +3866,11 @@
<reference key="object" ref="700684737"/>
<reference key="parent" ref="1934"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">963</int>
+ <reference key="object" ref="283468712"/>
+ <reference key="parent" ref="709725194"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -4185,6 +4211,7 @@
<string>938.IBPluginDependency</string>
<string>940.IBPluginDependency</string>
<string>941.IBPluginDependency</string>
+ <string>943.IBAttributePlaceholdersKey</string>
<string>943.IBPluginDependency</string>
<string>944.IBPluginDependency</string>
<string>950.IBPluginDependency</string>
@@ -4194,6 +4221,7 @@
<string>956.IBEditorWindowLastContentRect</string>
<string>956.IBPluginDependency</string>
<string>960.IBPluginDependency</string>
+ <string>963.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -4297,7 +4325,7 @@
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
- <string>{{701, 300}, {213, 133}}</string>
+ <string>{{570, 390}, {213, 133}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>{{399, 465}, {213, 93}}</string>
@@ -4307,7 +4335,7 @@
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
- <string>{{914, 340}, {136, 43}}</string>
+ <string>{{783, 430}, {136, 43}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -4340,7 +4368,7 @@
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
- <string>{{647, 500}, {235, 203}}</string>
+ <string>{{436, 500}, {235, 203}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>{{698, 703}, {184, 133}}</string>
@@ -4358,7 +4386,7 @@
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
- <string>{{398, 340}, {218, 253}}</string>
+ <string>{{256, 450}, {218, 253}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>{{518, 583}, {218, 253}}</string>
@@ -4464,7 +4492,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{350, 470}, {209, 233}}</string>
+ <string>{{350, 450}, {220, 253}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>{{180, 535}, {182, 253}}</string>
@@ -4574,6 +4602,14 @@ w6gg4oaSIGZhY2FkZV0</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <object class="NSMutableDictionary">
+ <string key="NS.key.0">ToolTip</string>
+ <object class="IBToolTipAttribute" key="NS.object.0">
+ <string key="name">ToolTip</string>
+ <reference key="object" ref="849728981"/>
+ <string key="toolTip">Open a connection file (*.spf) or load a SQL file (*.sql) into the Custom Query editor</string>
+ </object>
+ </object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -4583,6 +4619,7 @@ w6gg4oaSIGZhY2FkZV0</string>
<string>{{767, 692}, {166, 23}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
@@ -4605,7 +4642,7 @@ w6gg4oaSIGZhY2FkZV0</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">962</int>
+ <int key="maxID">964</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
diff --git a/Source/CustomQuery.h b/Source/CustomQuery.h
index c5cb2a30..a874bc15 100644
--- a/Source/CustomQuery.h
+++ b/Source/CustomQuery.h
@@ -101,6 +101,8 @@
NSNumber *sortField;
NSString *fieldIDQueryString;
+
+ unsigned int numberOfQueries;
}
@@ -157,6 +159,6 @@
- (void)commentOutCurrentQueryTakingSelection:(BOOL)takeSelection;
- (NSString *)usedQuery;
- (NSString *)argumentForRow:(NSUInteger)rowIndex ofTable:(NSString *)tableForColumn andDatabase:(NSString *)database;
-
+- (unsigned int)numberOfQueries;
@end
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index 891cb38e..faa86221 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -808,6 +808,7 @@
if([[textView textStorage] editedMask] != 0) {
customQueryParser = [[SPSQLParser alloc] initWithString:[textView string]];
queries = [[NSArray alloc] initWithArray:[customQueryParser splitSqlStringIntoRangesByCharacter:';']];
+ numberOfQueries = [queries count];
if(currentQueryRanges)
[currentQueryRanges release];
currentQueryRanges = [[NSArray arrayWithArray:queries] retain];
@@ -2531,6 +2532,12 @@
#pragma mark -
#pragma mark Other
+
+- (unsigned int)numberOfQueries
+{
+ return numberOfQueries;
+}
+
/*
* This method is called as part of Key Value Observing which is used to watch for prefernce changes which effect the interface.
*/
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index c36a2e35..341e149a 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -1734,7 +1734,7 @@
[panel setAllowsOtherFileTypes:NO];
[panel setCanSelectHiddenExtension:YES];
- if( [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 2 ) {
+ if( [sender tag] == 0 ) {
// Custom Query tab is active thus save the editor's content as SQL file
[panel setAccessoryView:encodingAccessoryView];
@@ -1752,13 +1752,15 @@
[encodingPopUp setEnabled:YES];
[self setupPopUp:encodingPopUp selectedEncoding:[prefs integerForKey:@"lastSqlFileEncoding"] withDefaultEntry:NO];
- } else {
+ } else if([sender tag] == 1){
// Save current session (open connection windows as SPF file)
- [panel setMessage:NSLocalizedString(@"Save Sequel Pro session", @"Save Sequel Pro session")];
+ // [panel setMessage:NSLocalizedString(@"Save Sequel Pro session", @"Save Sequel Pro session")];
[panel setAllowedFileTypes:[NSArray arrayWithObjects:@"spf", nil]];
filename = [NSString stringWithFormat:@"%@", [self name]];
+ } else {
+ return;
}
[panel beginSheetForDirectory:nil
@@ -1859,6 +1861,23 @@
return ([self database] != nil);
}
+
+ // Change "Save Query/Queries" menu item title dynamically
+ // and disable it if no query in the editor
+ if ([menuItem action] == @selector(saveConnectionSheet:) && [menuItem tag] == 0) {
+ if([customQueryInstance numberOfQueries] < 1) {
+ [menuItem setTitle:NSLocalizedString(@"Save Query…",@"Save Query…")];
+ return NO;
+ }
+ else if([customQueryInstance numberOfQueries] == 1)
+ [menuItem setTitle:NSLocalizedString(@"Save Query…",@"Save Query…")];
+ else
+ [menuItem setTitle:NSLocalizedString(@"Save Queries…",@"Save Queries…")];
+
+ return YES;
+ }
+
+
if ([menuItem action] == @selector(exportTable:))
{
return ([self database] != nil && [self table] != nil);