diff options
author | Bibiko <bibiko@eva.mpg.de> | 2009-08-20 11:16:14 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2009-08-20 11:16:14 +0000 |
commit | be6b947b45c4e7e883c6369316feebfa01ef75c8 (patch) | |
tree | 208e3312874aa3e22e96363be89504d4765b1e88 /Source/TableDocument.m | |
parent | 25b8ef5121716a1b68982a7aacdc38322f179c8f (diff) | |
download | sequelpro-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
Diffstat (limited to 'Source/TableDocument.m')
-rw-r--r-- | Source/TableDocument.m | 25 |
1 files changed, 22 insertions, 3 deletions
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); |