aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPQueryConsole.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2009-06-11 08:45:53 +0000
committerstuconnolly <stuart02@gmail.com>2009-06-11 08:45:53 +0000
commit94a35280d5f542211abdef0e8c9de83a4e374d10 (patch)
treefdd35ed8f4190865d8a353f4ad86c9bbe3a97d97 /Source/SPQueryConsole.m
parentf54791648b44925321f2d9c631d9782574fecf51 (diff)
downloadsequelpro-94a35280d5f542211abdef0e8c9de83a4e374d10.tar.gz
sequelpro-94a35280d5f542211abdef0e8c9de83a4e374d10.tar.bz2
sequelpro-94a35280d5f542211abdef0e8c9de83a4e374d10.zip
Add a very basic preference to disable all query logging. This can be expanded upon to disable different types of queries.
Diffstat (limited to 'Source/SPQueryConsole.m')
-rw-r--r--Source/SPQueryConsole.m21
1 files changed, 18 insertions, 3 deletions
diff --git a/Source/SPQueryConsole.m b/Source/SPQueryConsole.m
index 04d031f7..a7c7263d 100644
--- a/Source/SPQueryConsole.m
+++ b/Source/SPQueryConsole.m
@@ -118,11 +118,16 @@ static SPQueryConsole *sharedQueryConsole = nil;
*/
- (void)awakeFromNib
{
+ NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
+
[self setWindowFrameAutosaveName:CONSOLE_WINDOW_AUTO_SAVE_NAME];
- [[consoleTableView tableColumnWithIdentifier:TABLEVIEW_DATE_COLUMN_IDENTIFIER] setHidden:![[NSUserDefaults standardUserDefaults] boolForKey:@"ConsoleShowTimestamps"]];
- showSelectStatementsAreDisabled = ![[NSUserDefaults standardUserDefaults] boolForKey:@"ConsoleShowSelectsAndShows"];
- showHelpStatementsAreDisabled = ![[NSUserDefaults standardUserDefaults] boolForKey:@"ConsoleShowHelps"];
+ [[consoleTableView tableColumnWithIdentifier:TABLEVIEW_DATE_COLUMN_IDENTIFIER] setHidden:![prefs boolForKey:@"ConsoleShowTimestamps"]];
+ showSelectStatementsAreDisabled = ![prefs boolForKey:@"ConsoleShowSelectsAndShows"];
+ showHelpStatementsAreDisabled = ![prefs boolForKey:@"ConsoleShowHelps"];
+
[self _updateFilterState];
+
+ [loggingDisabledTextField setStringValue:([prefs boolForKey:@"ConsoleEnableLogging"]) ? @"" : @"Query logging is currently disabled"];
}
/**
@@ -335,6 +340,16 @@ static SPQueryConsole *sharedQueryConsole = nil;
}
/**
+ * This method is called as part of Key Value Observing which is used to watch for prefernce changes which effect the interface.
+ */
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+{
+ if ([keyPath isEqualToString:@"ConsoleEnableLogging"]) {
+ [loggingDisabledTextField setStringValue:([[change objectForKey:NSKeyValueChangeNewKey] boolValue]) ? @"" : @"Query logging is currently disabled"];
+ }
+}
+
+/**
* Menu item validation for console table view contextual menu.
*/
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem