diff options
Diffstat (limited to 'Source/TableDocument.m')
-rw-r--r-- | Source/TableDocument.m | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m index ece7d376..84aad499 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -71,6 +71,7 @@ _mainNibLoaded = NO; _encoding = [[NSString alloc] initWithString:@"utf8"]; _isConnected = NO; + _queryMode = SP_QUERYMODE_INTERFACE; chooseDatabaseButton = nil; chooseDatabaseToolbarItem = nil; connectionController = nil; @@ -1051,6 +1052,14 @@ [[SPQueryConsole sharedQueryConsole] clearConsole:sender]; } +/** + * Set a query mode, used to control logging dependant on preferences + */ +- (void) setQueryMode:(int)theQueryMode +{ + _queryMode = theQueryMode; +} + #pragma mark - #pragma mark Encoding Methods @@ -2802,9 +2811,15 @@ * Invoked when the framework is about to perform a query. */ - (void)willQueryString:(NSString *)query connection:(id)connection -{ - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"ConsoleEnableLogging"]) { - [[SPQueryConsole sharedQueryConsole] showMessageInConsole:query]; +{ + NSLog(@"Mode is %i, bool is %@", _queryMode, [prefs boolForKey:@"ConsoleEnableImportExportLogging"]?@"on":@"off"); + if ([prefs boolForKey:@"ConsoleEnableLogging"]) { + if ((_queryMode == SP_QUERYMODE_INTERFACE && [prefs boolForKey:@"ConsoleEnableInterfaceLogging"]) + || (_queryMode == SP_QUERYMODE_CUSTOMQUERY && [prefs boolForKey:@"ConsoleEnableCustomQueryLogging"]) + || (_queryMode == SP_QUERYMODE_IMPORTEXPORT && [prefs boolForKey:@"ConsoleEnableImportExportLogging"])) + { + [[SPQueryConsole sharedQueryConsole] showMessageInConsole:query]; + } } } @@ -2813,7 +2828,9 @@ */ - (void)queryGaveError:(NSString *)error connection:(id)connection { - [[SPQueryConsole sharedQueryConsole] showErrorInConsole:error]; + if ([prefs boolForKey:@"ConsoleEnableLogging"] && [prefs boolForKey:@"ConsoleEnableErrorLogging"]) { + [[SPQueryConsole sharedQueryConsole] showErrorInConsole:error]; + } } /** |