diff options
author | stuconnolly <stuart02@gmail.com> | 2009-06-11 08:45:53 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2009-06-11 08:45:53 +0000 |
commit | 94a35280d5f542211abdef0e8c9de83a4e374d10 (patch) | |
tree | fdd35ed8f4190865d8a353f4ad86c9bbe3a97d97 | |
parent | f54791648b44925321f2d9c631d9782574fecf51 (diff) | |
download | sequelpro-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.
-rw-r--r-- | Interfaces/English.lproj/Console.xib | 127 | ||||
-rw-r--r-- | Interfaces/English.lproj/Preferences.xib | 105 | ||||
-rw-r--r-- | Resources/PreferenceDefaults.plist | 2 | ||||
-rw-r--r-- | Source/SPQueryConsole.h | 1 | ||||
-rw-r--r-- | Source/SPQueryConsole.m | 21 | ||||
-rw-r--r-- | Source/TableDocument.m | 7 |
6 files changed, 164 insertions, 99 deletions
diff --git a/Interfaces/English.lproj/Console.xib b/Interfaces/English.lproj/Console.xib index 37ed1da0..810fe19c 100644 --- a/Interfaces/English.lproj/Console.xib +++ b/Interfaces/English.lproj/Console.xib @@ -2,13 +2,13 @@ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03"> <data> <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">9G55</string> + <string key="IBDocument.SystemVersion">9J61</string> <string key="IBDocument.InterfaceBuilderVersion">677</string> - <string key="IBDocument.AppKitVersion">949.43</string> + <string key="IBDocument.AppKitVersion">949.46</string> <string key="IBDocument.HIToolboxVersion">353.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="79"/> + <integer value="4"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -237,7 +237,7 @@ <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">controlBackgroundColor</string> - <object class="NSColor" key="NSColor"> + <object class="NSColor" key="NSColor" id="577284939"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MC42NjY2NjY2OQA</bytes> </object> @@ -451,13 +451,34 @@ </object> </object> </object> - <int key="NSSelectedIndex">3</int> + <int key="NSSelectedIndex">1</int> <bool key="NSPullDown">YES</bool> <int key="NSPreferredEdge">1</int> <bool key="NSUsesItemFromMenu">YES</bool> <bool key="NSAltersState">YES</bool> </object> </object> + <object class="NSTextField" id="301104034"> + <reference key="NSNextResponder" ref="215475093"/> + <int key="NSvFlags">290</int> + <string key="NSFrame">{{67, 5}, {375, 14}}</string> + <reference key="NSSuperview" ref="215475093"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="1054523894"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">272761856</int> + <string key="NSContents"/> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="301104034"/> + <object class="NSColor" key="NSBackgroundColor"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">controlColor</string> + <reference key="NSColor" ref="577284939"/> + </object> + <reference key="NSTextColor" ref="22056724"/> + </object> + </object> </object> <string key="NSFrameSize">{575, 203}</string> <reference key="NSSuperview"/> @@ -518,10 +539,6 @@ </object> </object> <object class="NSUserDefaultsController" id="320962651"> - <object class="NSMutableArray" key="NSDeclaredKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>ConsoleShowHelps</string> - </object> <bool key="NSSharedInstance">YES</bool> </object> </object> @@ -752,6 +769,14 @@ </object> <int key="connectionID">107</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">loggingDisabledTextField</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="301104034"/> + </object> + <int key="connectionID">110</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -804,6 +829,7 @@ <reference ref="223792049"/> <reference ref="591384017"/> <reference ref="544468485"/> + <reference ref="301104034"/> </object> <reference key="parent" ref="209913341"/> </object> @@ -1020,6 +1046,20 @@ <reference key="object" ref="60345708"/> <reference key="parent" ref="636769899"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">108</int> + <reference key="object" ref="301104034"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="1054523894"/> + </object> + <reference key="parent" ref="215475093"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">109</int> + <reference key="object" ref="1054523894"/> + <reference key="parent" ref="301104034"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -1030,6 +1070,8 @@ <string>-2.IBPluginDependency</string> <string>-3.IBPluginDependency</string> <string>103.IBPluginDependency</string> + <string>108.IBPluginDependency</string> + <string>109.IBPluginDependency</string> <string>12.IBPluginDependency</string> <string>13.IBPluginDependency</string> <string>14.IBPluginDependency</string> @@ -1084,6 +1126,8 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{341, 238}, {575, 203}}</string> <string>{{341, 238}, {575, 203}}</string> <reference ref="6"/> @@ -1156,7 +1200,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">107</int> + <int key="maxID">110</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -1192,63 +1236,6 @@ <string>clearConsole:</string> <string>copy:</string> <string>saveConsoleAs:</string> - <string>toggleShowSelectShowStatements:</string> - <string>toggleShowTimeStamps:</string> - </object> - <object class="NSMutableArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - </object> - </object> - <object class="NSMutableDictionary" key="outlets"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>clearConsoleButton</string> - <string>consoleSearchField</string> - <string>consoleTableView</string> - <string>includeTimeStampsButton</string> - <string>progressIndicator</string> - <string>saveConsoleButton</string> - <string>saveLogView</string> - <string>showSelectShowStatementsMenuItem</string> - <string>showTimeStampsMenuItem</string> - </object> - <object class="NSMutableArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>NSButton</string> - <string>NSSearchField</string> - <string>NSTableView</string> - <string>NSButton</string> - <string>NSProgressIndicator</string> - <string>NSButton</string> - <string>NSView</string> - <string>NSMenuItem</string> - <string>NSMenuItem</string> - </object> - </object> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBProjectSource</string> - <string key="minorKey">Source/SPQueryConsole.h</string> - </object> - </object> - </object> - <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="IBPartialClassDescription"> - <string key="className">SPQueryConsole</string> - <string key="superclassName">NSWindowController</string> - <object class="NSMutableDictionary" key="actions"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>clearConsole:</string> - <string>copy:</string> - <string>saveConsoleAs:</string> <string>toggleShowHelpStatements:</string> <string>toggleShowSelectShowStatements:</string> <string>toggleShowTimeStamps:</string> @@ -1271,6 +1258,7 @@ <string>consoleSearchField</string> <string>consoleTableView</string> <string>includeTimeStampsButton</string> + <string>loggingDisabledTextField</string> <string>progressIndicator</string> <string>saveConsoleButton</string> <string>saveLogView</string> @@ -1284,6 +1272,7 @@ <string>NSSearchField</string> <string>NSTableView</string> <string>NSButton</string> + <string>NSTextField</string> <string>NSProgressIndicator</string> <string>NSButton</string> <string>NSView</string> @@ -1293,8 +1282,8 @@ </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBDocumentRelativeSource</string> - <string key="minorKey">../../Source/SPQueryConsole.h</string> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">Source/SPQueryConsole.h</string> </object> </object> </object> diff --git a/Interfaces/English.lproj/Preferences.xib b/Interfaces/English.lproj/Preferences.xib index 8bbcad15..78716f44 100644 --- a/Interfaces/English.lproj/Preferences.xib +++ b/Interfaces/English.lproj/Preferences.xib @@ -8,7 +8,7 @@ <string key="IBDocument.HIToolboxVersion">353.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="802"/> + <integer value="17"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -53,14 +53,14 @@ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSCustomView" id="594324362"> - <nil key="NSNextResponder"/> + <reference key="NSNextResponder"/> <int key="NSvFlags">268</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSPopUpButton" id="258765966"> <reference key="NSNextResponder" ref="594324362"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{151, 121}, {254, 26}}</string> + <string key="NSFrame">{{151, 141}, {254, 26}}</string> <reference key="NSSuperview" ref="594324362"/> <bool key="NSEnabled">YES</bool> <object class="NSPopUpButtonCell" key="NSCell" id="562129977"> @@ -387,7 +387,7 @@ <object class="NSButton" id="521332722"> <reference key="NSNextResponder" ref="594324362"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{152, 168}, {209, 18}}</string> + <string key="NSFrame">{{152, 188}, {209, 18}}</string> <reference key="NSSuperview" ref="594324362"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="964808674"> @@ -414,7 +414,7 @@ <object class="NSTextField" id="140067361"> <reference key="NSNextResponder" ref="594324362"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{40, 196}, {108, 17}}</string> + <string key="NSFrame">{{40, 216}, {108, 17}}</string> <reference key="NSSuperview" ref="594324362"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="996600667"> @@ -446,7 +446,7 @@ <object class="NSPopUpButton" id="331339372"> <reference key="NSNextResponder" ref="594324362"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{151, 190}, {254, 26}}</string> + <string key="NSFrame">{{151, 210}, {254, 26}}</string> <reference key="NSSuperview" ref="594324362"/> <bool key="NSEnabled">YES</bool> <object class="NSPopUpButtonCell" key="NSCell" id="406329678"> @@ -478,7 +478,7 @@ <object class="NSTextField" id="63384418"> <reference key="NSNextResponder" ref="594324362"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{33, 127}, {116, 17}}</string> + <string key="NSFrame">{{33, 147}, {116, 17}}</string> <reference key="NSSuperview" ref="594324362"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="163779676"> @@ -494,7 +494,7 @@ <object class="NSButton" id="929785803"> <reference key="NSNextResponder" ref="594324362"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{152, 82}, {166, 18}}</string> + <string key="NSFrame">{{152, 102}, {166, 18}}</string> <reference key="NSSuperview" ref="594324362"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="530413242"> @@ -516,7 +516,7 @@ <object class="NSButton" id="302000957"> <reference key="NSNextResponder" ref="594324362"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{152, 62}, {254, 18}}</string> + <string key="NSFrame">{{152, 82}, {254, 18}}</string> <reference key="NSSuperview" ref="594324362"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="218042555"> @@ -538,7 +538,7 @@ <object class="NSBox" id="101736468"> <reference key="NSNextResponder" ref="594324362"/> <int key="NSvFlags">12</int> - <string key="NSFrame">{{154, 156}, {326, 5}}</string> + <string key="NSFrame">{{154, 176}, {326, 5}}</string> <reference key="NSSuperview" ref="594324362"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> @@ -568,7 +568,7 @@ <object class="NSBox" id="666474856"> <reference key="NSNextResponder" ref="594324362"/> <int key="NSvFlags">12</int> - <string key="NSFrame">{{154, 108}, {326, 5}}</string> + <string key="NSFrame">{{154, 128}, {326, 5}}</string> <reference key="NSSuperview" ref="594324362"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> @@ -686,8 +686,8 @@ <bool key="NS.raise.underflow">YES</bool> <bool key="NS.raise.dividebyzero">YES</bool> </object> - <string key="NS.decimal">,</string> - <string key="NS.thousand">.</string> + <string key="NS.decimal">.</string> + <string key="NS.thousand">,</string> <bool key="NS.hasthousands">NO</bool> <bool key="NS.localized">YES</bool> <bool key="NS.allowsfloats">NO</bool> @@ -719,8 +719,31 @@ <reference key="NSTextColor" ref="1035618107"/> </object> </object> + <object class="NSButton" id="845467695"> + <reference key="NSNextResponder" ref="594324362"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{152, 62}, {300, 18}}</string> + <reference key="NSSuperview" ref="594324362"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="68480866"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Log all query activity to the console (slower)</string> + <reference key="NSSupport" ref="320262838"/> + <reference key="NSControlView" ref="845467695"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">130</int> + <reference key="NSNormalImage" ref="752798171"/> + <reference key="NSAlternateImage" ref="888311049"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> </object> - <string key="NSFrameSize">{500, 234}</string> + <string key="NSFrameSize">{500, 254}</string> + <reference key="NSSuperview"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="395894064"> @@ -921,8 +944,8 @@ <bool key="NS.raise.underflow">YES</bool> <bool key="NS.raise.dividebyzero">YES</bool> </object> - <string key="NS.decimal">,</string> - <string key="NS.thousand">.</string> + <string key="NS.decimal">.</string> + <string key="NS.thousand">,</string> <bool key="NS.hasthousands">NO</bool> <bool key="NS.localized">YES</bool> <bool key="NS.allowsfloats">NO</bool> @@ -2083,8 +2106,8 @@ AQAAAAA</bytes> <bool key="NS.raise.underflow">YES</bool> <bool key="NS.raise.dividebyzero">YES</bool> </object> - <string key="NS.decimal">,</string> - <string key="NS.thousand">.</string> + <string key="NS.decimal">.</string> + <string key="NS.thousand">,</string> <bool key="NS.hasthousands">NO</bool> <bool key="NS.localized">YES</bool> <bool key="NS.allowsfloats">YES</bool> @@ -2139,7 +2162,7 @@ AQAAAAA</bytes> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="1033452264"> - <reference key="NSNextResponder"/> + <nil key="NSNextResponder"/> <int key="NSvFlags">268</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -2846,14 +2869,9 @@ AQAAAAA</bytes> </object> </object> <string key="NSFrameSize">{500, 395}</string> - <reference key="NSSuperview"/> <string key="NSClassName">NSView</string> </object> <object class="NSUserDefaultsController" id="151174232"> - <object class="NSMutableArray" key="NSDeclaredKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>CustomQueryEditorHighlightQueryColor</string> - </object> <bool key="NSSharedInstance">YES</bool> </object> <object class="NSArrayController" id="937123943"> @@ -4467,6 +4485,22 @@ AQAAAAA</bytes> </object> <int key="connectionID">1136</int> </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.ConsoleEnableLogging</string> + <reference key="source" ref="845467695"/> + <reference key="destination" ref="151174232"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="845467695"/> + <reference key="NSDestination" ref="151174232"/> + <string key="NSLabel">value: values.ConsoleEnableLogging</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.ConsoleEnableLogging</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">1142</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -4530,6 +4564,7 @@ AQAAAAA</bytes> <reference ref="95243153"/> <reference ref="155059"/> <reference ref="302000957"/> + <reference ref="845467695"/> </object> <reference key="parent" ref="1002"/> <string key="objectName">General</string> @@ -6257,6 +6292,20 @@ AQAAAAA</bytes> <reference key="object" ref="496801621"/> <reference key="parent" ref="787536920"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">1137</int> + <reference key="object" ref="845467695"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="68480866"/> + </object> + <reference key="parent" ref="594324362"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">1138</int> + <reference key="object" ref="68480866"/> + <reference key="parent" ref="845467695"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -6332,6 +6381,8 @@ AQAAAAA</bytes> <string>1127.IBPluginDependency</string> <string>1128.IBPluginDependency</string> <string>1129.IBPluginDependency</string> + <string>1137.IBPluginDependency</string> + <string>1138.IBPluginDependency</string> <string>117.IBPluginDependency</string> <string>17.IBEditorWindowLastContentRect</string> <string>17.IBPluginDependency</string> @@ -6672,7 +6723,9 @@ AQAAAAA</bytes> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{408, 292}, {500, 234}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>{{408, 272}, {500, 254}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <object class="NSMutableArray"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -7072,7 +7125,7 @@ AQAAAAA</bytes> </object> </object> <nil key="sourceID"/> - <int key="maxID">1136</int> + <int key="maxID">1142</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> diff --git a/Resources/PreferenceDefaults.plist b/Resources/PreferenceDefaults.plist index f5825c11..ec642bbd 100644 --- a/Resources/PreferenceDefaults.plist +++ b/Resources/PreferenceDefaults.plist @@ -76,6 +76,8 @@ <true/> <key>LastFavoriteIndex</key> <integer>0</integer> + <key>ConsoleEnableLogging</key> + <true/> <key>ConsoleShowTimestamps</key> <true/> <key>ConsoleShowSelectsAndShows</key> 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]; + } } /** |