aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableDocument.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2009-09-12 16:19:51 +0000
committerstuconnolly <stuart02@gmail.com>2009-09-12 16:19:51 +0000
commitf4bede9def108d8fd25334871ca00971687c4e51 (patch)
tree9e744ffcceb07993d5865181c9df7a5ae0d4f407 /Source/TableDocument.m
parent9a0951a7dc44f93226e096423b76de48df2d50a0 (diff)
downloadsequelpro-f4bede9def108d8fd25334871ca00971687c4e51.tar.gz
sequelpro-f4bede9def108d8fd25334871ca00971687c4e51.tar.bz2
sequelpro-f4bede9def108d8fd25334871ca00971687c4e51.zip
Add back/forward history menu items to the view menu with the assigned shortcuts of cmd+[ and cmd+].
Diffstat (limited to 'Source/TableDocument.m')
-rw-r--r--Source/TableDocument.m36
1 files changed, 32 insertions, 4 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index a546333a..dbb4e2f7 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -496,6 +496,24 @@
[NSApp abortModal];
}
+/**
+ * Go backward or forward in the history depending on the menu item selected.
+ */
+- (IBAction)backForwardInHistory:(id)sender
+{
+ switch ([sender tag])
+ {
+ // Go backward
+ case 0:
+ [spHistoryControllerInstance goBackwardInHistory];
+ break;
+ // Go forward
+ case 1:
+ [spHistoryControllerInstance goForwardInHistory];
+ break;
+ }
+}
+
#pragma mark -
#pragma mark Connection callback and methods
@@ -2467,13 +2485,13 @@
// 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…")];
+ [menuItem setTitle:NSLocalizedString(@"Save Query…", @"Save Query…")];
return NO;
}
else if([customQueryInstance numberOfQueries] == 1)
- [menuItem setTitle:NSLocalizedString(@"Save Query…",@"Save Query…")];
+ [menuItem setTitle:NSLocalizedString(@"Save Query…", @"Save Query…")];
else
- [menuItem setTitle:NSLocalizedString(@"Save Queries…",@"Save Queries…")];
+ [menuItem setTitle:NSLocalizedString(@"Save Queries…", @"Save Queries…")];
return YES;
}
@@ -2502,7 +2520,17 @@
}
if ([menuItem action] == @selector(addConnectionToFavorites:)) {
- return ([connectionController selectedFavorite]?NO:YES);
+ return ([connectionController selectedFavorite] ? NO : YES);
+ }
+
+ // Backward in history menu item
+ if (([menuItem action] == @selector(backForwardInHistory:)) && ([menuItem tag] == 0)) {
+ return (([[spHistoryControllerInstance history] count]) && ([spHistoryControllerInstance historyPosition] > 0));
+ }
+
+ // Forward in history menu item
+ if (([menuItem action] == @selector(backForwardInHistory:)) && ([menuItem tag] == 1)) {
+ return (([[spHistoryControllerInstance history] count]) && (([spHistoryControllerInstance historyPosition] + 1) < [[spHistoryControllerInstance history] count]));
}
return [super validateMenuItem:menuItem];