aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPQueryConsole.h1
-rw-r--r--Source/SPQueryConsole.m21
-rw-r--r--Source/TableDocument.m7
3 files changed, 25 insertions, 4 deletions
diff --git a/Source/SPQueryConsole.h b/Source/SPQueryConsole.h
index 6381bb97..281f2d2e 100644
--- a/Source/SPQueryConsole.h
+++ b/Source/SPQueryConsole.h
@@ -30,6 +30,7 @@
IBOutlet NSView *saveLogView;
IBOutlet NSTableView *consoleTableView;
IBOutlet NSSearchField *consoleSearchField;
+ IBOutlet NSTextField *loggingDisabledTextField;
IBOutlet NSProgressIndicator *progressIndicator;
IBOutlet NSButton *includeTimeStampsButton, *saveConsoleButton, *clearConsoleButton;
IBOutlet NSMenuItem *showTimeStampsMenuItem, *showSelectShowStatementsMenuItem, *showHelpMenuItem;
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
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 56ca2422..ef0958ab 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -100,6 +100,9 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
[prefs addObserver:tableContentInstance forKeyPath:@"DisplayTableViewVerticalGridlines" options:NSKeyValueObservingOptionNew context:NULL];
[prefs addObserver:customQueryInstance forKeyPath:@"DisplayTableViewVerticalGridlines" options:NSKeyValueObservingOptionNew context:NULL];
+ // Register observers for when the preference changes
+ [prefs addObserver:[SPQueryConsole sharedQueryConsole] forKeyPath:@"ConsoleEnableLogging" options:NSKeyValueObservingOptionNew context:NULL];
+
// Register double click for the favorites view (double click favorite to connect)
[connectFavoritesTableView setTarget:self];
[connectFavoritesTableView setDoubleAction:@selector(initiateConnection:)];
@@ -2300,7 +2303,9 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
*/
- (void)willQueryString:(NSString *)query
{
- [[SPQueryConsole sharedQueryConsole] showMessageInConsole:query];
+ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"ConsoleEnableLogging"]) {
+ [[SPQueryConsole sharedQueryConsole] showMessageInConsole:query];
+ }
}
/**