diff options
-rw-r--r-- | Interfaces/English.lproj/DBView.xib | 405 | ||||
-rw-r--r-- | Source/CustomQuery.h | 11 | ||||
-rw-r--r-- | Source/CustomQuery.m | 180 |
3 files changed, 432 insertions, 164 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index 8125f93b..cfe974b4 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -8,10 +8,9 @@ <string key="IBDocument.HIToolboxVersion">353.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="3987"/> - <integer value="5428"/> - <integer value="3994"/> <integer value="662"/> + <integer value="5429"/> + <integer value="3994"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -4540,7 +4539,7 @@ <nil key="NSViewClass"/> <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <object class="NSView" key="NSWindowView" id="661948784"> - <reference key="NSNextResponder"/> + <nil key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -4803,7 +4802,6 @@ </object> <string key="NSFrameSize">{588, 316}</string> <reference key="NSSuperview" ref="541887300"/> - <reference key="NSNextKeyView" ref="798764405"/> <reference key="NSDocView" ref="798764405"/> <object class="NSColor" key="NSBGColor"> <int key="NSColorSpace">1</int> @@ -4835,7 +4833,6 @@ </object> <string key="NSFrame">{{0, 34}, {588, 316}}</string> <reference key="NSSuperview" ref="661948784"/> - <reference key="NSNextKeyView" ref="593223452"/> <int key="NSsFlags">528</int> <reference key="NSVScroller" ref="142711676"/> <reference key="NSHScroller" ref="705947940"/> @@ -4863,7 +4860,6 @@ </object> </object> <string key="NSFrameSize">{588, 350}</string> - <reference key="NSSuperview"/> </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> @@ -6241,7 +6237,7 @@ <reference key="NSControlView" ref="269606631"/> <int key="NSButtonFlags">-2030812929</int> <int key="NSButtonFlags2">34</int> - <object class="NSCustomResource" key="NSNormalImage"> + <object class="NSCustomResource" key="NSNormalImage" id="22507558"> <string key="NSClassName">NSImage</string> <string key="NSResourceName">NSGoLeftTemplate</string> </object> @@ -7884,130 +7880,168 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string key="NSWindowContentMinSize">{100, 100}</string> <object class="NSView" key="NSWindowView" id="539508428"> <reference key="NSNextResponder"/> - <int key="NSvFlags">256</int> + <int key="NSvFlags">274</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSButton" id="731759531"> + <object class="WebView" id="177792895"> <reference key="NSNextResponder" ref="539508428"/> - <int key="NSvFlags">-2147483380</int> - <string key="NSFrame">{{3, 2}, {121, 18}}</string> + <int key="NSvFlags">274</int> + <object class="NSMutableSet" key="NSDragTypes"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="set.sortedObjects"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>Apple HTML pasteboard type</string> + <string>Apple PICT pasteboard type</string> + <string>Apple URL pasteboard type</string> + <string>Apple Web Archive pasteboard type</string> + <string>NSColor pasteboard type</string> + <string>NSFilenamesPboardType</string> + <string>NSStringPboardType</string> + <string>NeXT RTFD pasteboard type</string> + <string>NeXT Rich Text Format v1.0 pasteboard type</string> + <string>NeXT TIFF v4.0 pasteboard type</string> + <string>WebURLsWithTitlesPboardType</string> + <string>public.png</string> + <string>public.url</string> + <string>public.url-name</string> + </object> + </object> + <string key="NSFrame">{{0, 36}, {445, 273}}</string> <reference key="NSSuperview" ref="539508428"/> - <bool key="NSEnabled">YES</bool> - <object class="NSButtonCell" key="NSCell" id="404617653"> - <int key="NSCellFlags">-2080244224</int> - <int key="NSCellFlags2">262144</int> - <string key="NSContents">Live monitoring</string> - <object class="NSFont" key="NSSupport"> - <string key="NSName">LucidaGrande</string> - <double key="NSSize">9.000000e+00</double> - <int key="NSfFlags">3614</int> + <reference key="NSNextKeyView"/> + <string key="FrameName"/> + <string key="GroupName"/> + <object class="WebPreferences" key="Preferences"> + <string key="Identifier"/> + <object class="NSMutableDictionary" key="Values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>WebKitDefaultFixedFontSize</string> + <string>WebKitDefaultFontSize</string> + <string>WebKitMinimumFontSize</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <integer value="12" id="225288033"/> + <reference ref="225288033"/> + <reference ref="9"/> + </object> </object> - <reference key="NSControlView" ref="731759531"/> - <int key="NSButtonFlags">1211912703</int> - <int key="NSButtonFlags2">130</int> - <reference key="NSNormalImage" ref="226227784"/> - <reference key="NSAlternateImage" ref="386686735"/> - <string key="NSAlternateContents"/> - <string key="NSKeyEquivalent"/> - <int key="NSPeriodicDelay">200</int> - <int key="NSPeriodicInterval">25</int> </object> + <bool key="UseBackForwardList">YES</bool> + <bool key="AllowsUndo">YES</bool> </object> - <object class="NSScrollView" id="1066391744"> + <object class="NSSearchField" id="375350404"> <reference key="NSNextResponder" ref="539508428"/> - <int key="NSvFlags">274</int> - <object class="NSMutableArray" key="NSSubviews"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSClipView" id="531974335"> - <reference key="NSNextResponder" ref="1066391744"/> - <int key="NSvFlags">2304</int> - <object class="NSMutableArray" key="NSSubviews"> + <int key="NSvFlags">292</int> + <string key="NSFrame">{{53, 9}, {171, 19}}</string> + <reference key="NSSuperview" ref="539508428"/> + <bool key="NSEnabled">YES</bool> + <object class="NSSearchFieldCell" key="NSCell" id="980282163"> + <int key="NSCellFlags">343014976</int> + <int key="NSCellFlags2">268567552</int> + <string key="NSContents"/> + <reference key="NSSupport" ref="26"/> + <string key="NSPlaceholderString">search in the MySQL help</string> + <reference key="NSControlView" ref="375350404"/> + <bool key="NSDrawsBackground">YES</bool> + <int key="NSTextBezelStyle">1</int> + <reference key="NSBackgroundColor" ref="480189472"/> + <reference key="NSTextColor" ref="454249633"/> + <object class="NSButtonCell" key="NSSearchButtonCell"> + <int key="NSCellFlags">130560</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">search</string> + <string key="NSAction">_searchFieldSearch:</string> + <reference key="NSTarget" ref="980282163"/> + <reference key="NSControlView" ref="375350404"/> + <int key="NSButtonFlags">138690815</int> + <int key="NSButtonFlags2">0</int> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">400</int> + <int key="NSPeriodicInterval">75</int> + </object> + <object class="NSButtonCell" key="NSCancelButtonCell"> + <int key="NSCellFlags">130560</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">clear</string> + <object class="NSMutableArray" key="NSAccessibilityOverriddenAttributes"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="WebView" id="980404156"> - <reference key="NSNextResponder" ref="531974335"/> - <int key="NSvFlags">274</int> - <object class="NSMutableSet" key="NSDragTypes"> + <object class="NSMutableDictionary"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="set.sortedObjects"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>Apple HTML pasteboard type</string> - <string>Apple PICT pasteboard type</string> - <string>Apple URL pasteboard type</string> - <string>Apple Web Archive pasteboard type</string> - <string>NSColor pasteboard type</string> - <string>NSFilenamesPboardType</string> - <string>NSStringPboardType</string> - <string>NeXT RTFD pasteboard type</string> - <string>NeXT Rich Text Format v1.0 pasteboard type</string> - <string>NeXT TIFF v4.0 pasteboard type</string> - <string>WebURLsWithTitlesPboardType</string> - <string>public.png</string> - <string>public.url</string> - <string>public.url-name</string> - </object> + <string>AXDescription</string> + <string>NSAccessibilityEncodedAttributesValueType</string> </object> - <string key="NSFrameSize">{460, 288}</string> - <reference key="NSSuperview" ref="531974335"/> - <reference key="NSNextKeyView"/> - <string key="FrameName"/> - <string key="GroupName"/> - <object class="WebPreferences" key="Preferences"> - <string key="Identifier"/> - <object class="NSMutableDictionary" key="Values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>WebKitDefaultFixedFontSize</string> - <string>WebKitDefaultFontSize</string> - <string>WebKitMinimumFontSize</string> - </object> - <object class="NSMutableArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="12" id="225288033"/> - <reference ref="225288033"/> - <reference ref="9"/> - </object> - </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>cancel</string> + <reference ref="9"/> </object> - <bool key="UseBackForwardList">YES</bool> - <bool key="AllowsUndo">YES</bool> </object> </object> - <string key="NSFrame">{{1, 1}, {460, 288}}</string> - <reference key="NSSuperview" ref="1066391744"/> - <reference key="NSNextKeyView" ref="980404156"/> - <reference key="NSDocView" ref="980404156"/> - <reference key="NSBGColor" ref="62854682"/> - <int key="NScvFlags">4</int> + <string key="NSAction">_searchFieldCancel:</string> + <reference key="NSTarget" ref="980282163"/> + <reference key="NSControlView" ref="375350404"/> + <int key="NSButtonFlags">138690815</int> + <int key="NSButtonFlags2">0</int> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">400</int> + <int key="NSPeriodicInterval">75</int> </object> - <object class="NSScroller" id="301150110"> - <reference key="NSNextResponder" ref="1066391744"/> - <int key="NSvFlags">-2147483392</int> - <string key="NSFrame">{{446, 1}, {15, 273}}</string> - <reference key="NSSuperview" ref="1066391744"/> - <reference key="NSTarget" ref="1066391744"/> - <string key="NSAction">_doScroller:</string> - <double key="NSCurValue">1.000000e+00</double> - <double key="NSPercent">9.636363e-01</double> + <int key="NSMaximumRecents">255</int> + </object> + </object> + <object class="NSButton" id="946363074"> + <reference key="NSNextResponder" ref="539508428"/> + <int key="NSvFlags">292</int> + <string key="NSFrame">{{20, 11}, {22, 17}}</string> + <reference key="NSSuperview" ref="539508428"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="1295"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">134479872</int> + <string key="NSContents"/> + <object class="NSFont" key="NSSupport" id="22"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">9.000000e+00</double> + <int key="NSfFlags">3614</int> </object> - <object class="NSScroller" id="919939604"> - <reference key="NSNextResponder" ref="1066391744"/> - <int key="NSvFlags">-2147483392</int> - <string key="NSFrame">{{1, 274}, {445, 15}}</string> - <reference key="NSSuperview" ref="1066391744"/> - <int key="NSsFlags">1</int> - <reference key="NSTarget" ref="1066391744"/> - <string key="NSAction">_doScroller:</string> - <double key="NSPercent">5.060241e-01</double> + <reference key="NSControlView" ref="946363074"/> + <int key="NSButtonFlags">-2033958657</int> + <int key="NSButtonFlags2">134</int> + <object class="NSCustomResource" key="NSNormalImage"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">NSPathTemplate</string> </object> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">400</int> + <int key="NSPeriodicInterval">75</int> </object> - <string key="NSFrame">{{-1, 20}, {462, 290}}</string> + </object> + <object class="NSButton" id="321782713"> + <reference key="NSNextResponder" ref="539508428"/> + <int key="NSvFlags">-2147483356</int> + <string key="NSFrame">{{277, 10}, {22, 17}}</string> <reference key="NSSuperview" ref="539508428"/> - <reference key="NSNextKeyView" ref="531974335"/> - <int key="NSsFlags">562</int> - <reference key="NSVScroller" ref="301150110"/> - <reference key="NSHScroller" ref="919939604"/> - <reference key="NSContentView" ref="531974335"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="5430109"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">134479872</int> + <string key="NSContents"/> + <reference key="NSSupport" ref="22"/> + <reference key="NSControlView" ref="321782713"/> + <int key="NSButtonFlags">-2033958657</int> + <int key="NSButtonFlags2">70</int> + <reference key="NSNormalImage" ref="22507558"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">400</int> + <int key="NSPeriodicInterval">75</int> + </object> </object> </object> <string key="NSFrameSize">{445, 309}</string> @@ -12906,9 +12940,49 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <object class="IBOutletConnection" key="connection"> <string key="label">helpWebView</string> <reference key="source" ref="601471102"/> - <reference key="destination" ref="980404156"/> + <reference key="destination" ref="177792895"/> + </object> + <int key="connectionID">5442</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">policyDelegate</string> + <reference key="source" ref="177792895"/> + <reference key="destination" ref="601471102"/> + </object> + <int key="connectionID">5451</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">helpSearchField</string> + <reference key="source" ref="601471102"/> + <reference key="destination" ref="375350404"/> </object> - <int key="connectionID">5435</int> + <int key="connectionID">5454</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">showHelpForSearchString:</string> + <reference key="source" ref="601471102"/> + <reference key="destination" ref="375350404"/> + </object> + <int key="connectionID">5455</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">showHelpContent:</string> + <reference key="source" ref="601471102"/> + <reference key="destination" ref="946363074"/> + </object> + <int key="connectionID">5458</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">showLastHelp:</string> + <reference key="source" ref="601471102"/> + <reference key="destination" ref="321782713"/> + </object> + <int key="connectionID">5461</int> </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> @@ -18200,50 +18274,59 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <reference key="object" ref="539508428"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="731759531"/> - <reference ref="1066391744"/> + <reference ref="177792895"/> + <reference ref="321782713"/> + <reference ref="375350404"/> + <reference ref="946363074"/> </object> <reference key="parent" ref="78186995"/> </object> <object class="IBObjectRecord"> - <int key="objectID">5431</int> - <reference key="object" ref="731759531"/> + <int key="objectID">5441</int> + <reference key="object" ref="177792895"/> + <reference key="parent" ref="539508428"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">5452</int> + <reference key="object" ref="375350404"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="404617653"/> + <reference ref="980282163"/> </object> <reference key="parent" ref="539508428"/> </object> <object class="IBObjectRecord"> - <int key="objectID">5432</int> - <reference key="object" ref="404617653"/> - <reference key="parent" ref="731759531"/> + <int key="objectID">5453</int> + <reference key="object" ref="980282163"/> + <reference key="parent" ref="375350404"/> </object> <object class="IBObjectRecord"> - <int key="objectID">5436</int> - <reference key="object" ref="1066391744"/> + <int key="objectID">5456</int> + <reference key="object" ref="946363074"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="301150110"/> - <reference ref="919939604"/> - <reference ref="980404156"/> + <reference ref="1295"/> </object> <reference key="parent" ref="539508428"/> </object> <object class="IBObjectRecord"> - <int key="objectID">5437</int> - <reference key="object" ref="301150110"/> - <reference key="parent" ref="1066391744"/> + <int key="objectID">5457</int> + <reference key="object" ref="1295"/> + <reference key="parent" ref="946363074"/> </object> <object class="IBObjectRecord"> - <int key="objectID">5438</int> - <reference key="object" ref="919939604"/> - <reference key="parent" ref="1066391744"/> + <int key="objectID">5459</int> + <reference key="object" ref="321782713"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="5430109"/> + </object> + <reference key="parent" ref="539508428"/> </object> <object class="IBObjectRecord"> - <int key="objectID">5430</int> - <reference key="object" ref="980404156"/> - <reference key="parent" ref="1066391744"/> + <int key="objectID">5460</int> + <reference key="object" ref="5430109"/> + <reference key="parent" ref="321782713"/> </object> </object> </object> @@ -19375,12 +19458,15 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string>5428.windowTemplate.hasMinSize</string> <string>5428.windowTemplate.minSize</string> <string>5429.IBPluginDependency</string> - <string>5430.IBPluginDependency</string> - <string>5431.IBPluginDependency</string> - <string>5432.IBPluginDependency</string> - <string>5436.IBPluginDependency</string> - <string>5437.IBPluginDependency</string> - <string>5438.IBPluginDependency</string> + <string>5441.IBPluginDependency</string> + <string>5452.IBPluginDependency</string> + <string>5453.IBPluginDependency</string> + <string>5456.IBAttributePlaceholdersKey</string> + <string>5456.IBPluginDependency</string> + <string>5457.IBPluginDependency</string> + <string>5459.IBAttributePlaceholdersKey</string> + <string>5459.IBPluginDependency</string> + <string>5460.IBPluginDependency</string> <string>557.IBPluginDependency</string> <string>557.ImportedFromIB2</string> <string>565.IBEditorWindowLastContentRect</string> @@ -20408,7 +20494,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{1615, 266}, {200, 32}}</string> + <string>{{1384, 275}, {200, 32}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{628, 654}</string> <string>{{284, 769}, {200, 32}}</string> @@ -21024,8 +21110,8 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{641, 392}, {445, 309}}</string> - <string>{{641, 392}, {445, 309}}</string> + <string>{{482, 578}, {445, 309}}</string> + <string>{{482, 578}, {445, 309}}</string> <boolean value="NO"/> <boolean value="YES"/> <string>{100, 100}</string> @@ -21033,8 +21119,25 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</string> <string>com.apple.WebKitIBPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <object class="NSMutableDictionary"> + <string key="NS.key.0">ToolTip</string> + <object class="IBToolTipAttribute" key="NS.object.0"> + <string key="name">ToolTip</string> + <reference key="object" ref="946363074"/> + <string key="toolTip">Show MySQL main categories</string> + </object> + </object> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <object class="NSMutableDictionary"> + <string key="NS.key.0">ToolTip</string> + <object class="IBToolTipAttribute" key="NS.object.0"> + <string key="name">ToolTip</string> + <reference key="object" ref="321782713"/> + <string key="toolTip">Show MySQL main categories</string> + </object> + </object> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> @@ -21307,7 +21410,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string> </object> </object> <nil key="sourceID"/> - <int key="maxID">5439</int> + <int key="maxID">5461</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -22437,6 +22540,9 @@ Y2hhbmdlIHRoZSBvcmRlcg</string> <string>removeQueryFavorite:</string> <string>runAllQueries:</string> <string>runSelectedQueries:</string> + <string>showHelpContent:</string> + <string>showHelpForSearchString:</string> + <string>showLastHelp:</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -22451,6 +22557,9 @@ Y2hhbmdlIHRoZSBvcmRlcg</string> <string>id</string> <string>id</string> <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> </object> </object> <object class="NSMutableDictionary" key="outlets"> @@ -22467,6 +22576,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string> <string>customQueryView</string> <string>editorFontMenuItem</string> <string>errorText</string> + <string>helpSearchField</string> <string>helpWebView</string> <string>helpWebViewWindow</string> <string>queryFavoritesButton</string> @@ -22496,6 +22606,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string> <string>CMCopyTable</string> <string>NSMenuItem</string> <string>id</string> + <string>NSSearchField</string> <string>id</string> <string>NSWindow</string> <string>id</string> diff --git a/Source/CustomQuery.h b/Source/CustomQuery.h index e1906fd1..4f8fd468 100644 --- a/Source/CustomQuery.h +++ b/Source/CustomQuery.h @@ -60,6 +60,8 @@ IBOutlet NSWindow *helpWebViewWindow; IBOutlet id helpWebView; + IBOutlet NSSearchField *helpSearchField; + NSString *lastHelpString; NSArray *queryResult; NSUserDefaults *prefs; @@ -80,6 +82,10 @@ - (IBAction)closeSheet:(id)sender; - (IBAction)gearMenuItemSelected:(id)sender; - (IBAction)getHelpForCurrentWord:(id)sender; +- (IBAction)showHelpForSearchString:(id)sender; +- (IBAction)showHelpContent:(id)sender; +- (IBAction)showLastHelp:(id)sender; + // queryFavoritesSheet methods - (IBAction)addQueryFavorite:(id)sender; @@ -96,10 +102,15 @@ // Accessors - (NSArray *)currentResult; +// MySQL Help +- (void)showHelpFor:(NSString *)aString; +- (NSString *)getHTMLHelpFor:(NSString *)aString; + // Other - (void)setConnection:(CMMCPConnection *)theConnection; - (void)setFavorites; - (void)doPerformQueryService:(NSString *)query; - (NSString *)usedQuery; + @end diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index 51880119..d0f0f606 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -114,72 +114,218 @@ } /* - * Return the help string formatted from executing "HELP 'aString'" + * Retrieve and show the data for "HELP 'search word'" + */ + +- (IBAction)showHelpForSearchString:(id)sender +{ + [self showHelpFor:[[helpSearchField stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]]; +} + +/* + * Retrieve and show the data for "HELP 'currentWord'" */ - (IBAction)getHelpForCurrentWord:(id)sender { NSString *aString = [[textView string] substringWithRange:[textView getRangeForCurrentWord]]; - if(![aString length]) return; + // if(![aString length]) return; + + [self showHelpFor:aString]; + +} + +/* + * Retrieve and show the data for "HELP 'contents' (MySQL help root)". + */ + +- (IBAction)showHelpContent:(id)sender +{ + [self showHelpFor:@"contents"]; +} + +- (IBAction)showLastHelp:(id)sender +{ + NSLog(@"%@", lastHelpString); + if([lastHelpString length]) + [self showHelpFor:lastHelpString]; +} + + +/* + * Retrieve and show the data for "HELP 'aString'". + */ +- (void)showHelpFor:(NSString *)aString +{ + NSString * helpString = [self getHTMLHelpFor:aString]; + lastHelpString = [[NSString stringWithString:aString] retain]; + // Order out the Help window + if(![helpWebViewWindow isVisible]) + { + + // Get the major MySQL server version in the form of x.x, which is basically the first 3 characters of the returned version string + //get mysql version + CMMCPResult *theResult = nil; + NSString *mySQLVersion; + theResult = [mySQLConnection queryString:@"SHOW VARIABLES LIKE 'version'"]; + NSString *version = [[theResult fetchRowAsArray] objectAtIndex:1]; + if ( [version isKindOfClass:[NSData class]] ) { + // starting with MySQL 4.1.14 the mysql variables are returned as nsdata + mySQLVersion = [[NSString alloc] initWithData:version encoding:[mySQLConnection encoding]]; + } else { + mySQLVersion = [[NSString stringWithString:version] retain]; + } + + [helpWebViewWindow setTitle:[NSString stringWithFormat:@"%@ (%@ %@)", NSLocalizedString(@"MySQL Help", @"mysql help"), NSLocalizedString(@"version", @"version"), [mySQLVersion substringToIndex:3]]]; + [helpWebViewWindow orderFront:helpWebView]; + } + + if(![helpString length]) return; + + [[helpWebView mainFrame] loadHTMLString:helpString baseURL:nil]; + +} + + +/* + * Return the help string HTML formatted from executing "HELP 'aString'". + * If more than one help topic was found return a link list. + */ +- (NSString *)getHTMLHelpFor:(NSString *)aString +{ + + if(![aString length]) return(@""); CMMCPResult *theResult = nil; NSDictionary *tableDetails; + NSRange aRange; NSMutableString *theHelp = [NSMutableString string]; [theHelp setString: @"<html>" @"<head>" @" <style type='text/css' media='screen'>" @" body {" - @" margin: 0px;" - @" padding: 20px;" - @" overflow: hidden;" - @" display: table-cell;" + @" margin: 2px;" + @" padding: 10px;" + @" font-family:'Helvetica';" + @" font-size:9pt;" + @" }" + @" .internallink {" + @" color:#6A81DD;" + @" text-decoration:none;" @" }" @" .code {" @" font-family:Monaco;" @" }" @" .header {" - @" background-color:#eeeeee;" @" padding:5mm;" @" }" @" </style>" @"</head>" @"<body>" + ]; theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"HELP '%@'", aString]]; - if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] || ![theResult numOfRows]) return; + if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] || ![theResult numOfRows]) return @""; tableDetails = [[NSDictionary alloc] initWithDictionary:[theResult fetchRowAsDictionary]]; - if ([tableDetails objectForKey:@"description"]) { // help found + if ([tableDetails objectForKey:@"description"]) { // one single help topic found if ([tableDetails objectForKey:@"name"]) { - [theHelp appendString:@"<h2 class='header'>"]; + [theHelp appendString:@"<h2 class='header'> "]; [theHelp appendString:[[[tableDetails objectForKey:@"name"] copy] autorelease]]; [theHelp appendString:@"</h2>"]; } if ([tableDetails objectForKey:@"description"]) { + NSMutableString *desc = [NSMutableString string]; + NSError *err1 = NULL; + NSString *aUrl; + + [desc setString:[[[tableDetails objectForKey:@"description"] copy] autorelease]]; + + // Look for an URL and create an HTML link out of it + aRange = [desc rangeOfRegex:@"URL: +(.*)" options:RKLNoOptions inRange:NSMakeRange(0, [desc length]) capture:1 error:&err1]; + if(aRange.location != NSNotFound) { + aUrl = [desc substringWithRange:aRange]; + [desc replaceCharactersInRange:aRange withString:[NSString stringWithFormat:@"<a href='%@'>%@</a>", aUrl, aUrl]]; + } + // aRange = NSMakeRange(0,0); + // int safeCnt = 0; + // while(1){ + // aRange = [desc rangeOfRegex:@"(http.*?)\\s" options:RKLNoOptions inRange:NSMakeRange(aRange.location+aRange.length, [desc length]-aRange.location-aRange.length) capture:1 error:&err1]; + // if(aRange.location != NSNotFound) { + // aUrl = [desc substringWithRange:aRange]; + // [desc replaceCharactersInRange:aRange withString:[NSString stringWithFormat:@"<a href='%@'>%@</a>", aUrl, aUrl]]; + // } + // else + // break; + // safeCnt++; + // if(safeCnt > 20) + // break; + // } + [theHelp appendString:@"<pre class='code'>"]; - [theHelp appendString:[[[tableDetails objectForKey:@"description"] copy] autorelease]]; + [theHelp appendString:desc]; [theHelp appendString:@"</pre>"]; } if([tableDetails objectForKey:@"example"]){ NSString *examples = [[[tableDetails objectForKey:@"example"] copy] autorelease]; if([examples length]){ - [theHelp appendString:@"<br><br><i><b>Example:</b></i><br><pre class='code'>"]; + [theHelp appendString:@"<br><br><i><b>Example:</b></i><br><br><pre class='code'>"]; [theHelp appendString:examples]; [theHelp appendString:@"</pre>"]; } } - [theHelp appendString:@"</body></html>"]; - + } else { // list all found topics + int i; + int r = [theResult numOfRows]; + if (r) [theResult dataSeek:0]; + + if(![aString isEqualToString:@"contents"]) + [theHelp appendString:[NSString stringWithFormat:@"<br><i>%@ “%@”</i><br>", NSLocalizedString(@"Help topics for", @"help topics for"), aString]]; + else + [theHelp appendString:[NSString stringWithFormat:@"<br><b>%@:</b><br>", NSLocalizedString(@"MySQL Help – Categories", @"mysql help categories"), aString]]; + + [theHelp appendString:@"<ul>"]; + for ( i = 0 ; i < r ; i++ ) { + NSArray *anArray = [theResult fetchRowAsArray]; + NSString *topic = [anArray objectAtIndex:[anArray count]-2]; + [theHelp appendString: + [NSString stringWithFormat:@"<li><a title='%@ “%@”' href='%@' class='internallink'>%@</a></li>", NSLocalizedString(@"Show MySQL help for", @"show mysql help for"), topic, topic, topic]]; + } + [theHelp appendString:@"</ul>"]; } - + [theHelp appendString:@"</body></html>"]; + [tableDetails release]; - [[helpWebView mainFrame] loadHTMLString:theHelp baseURL:nil]; - [helpWebViewWindow orderFront:self]; + return theHelp; + +} +/* + * Link detector: If user clicked at an http link open it in the default browser, + * otherwise search for it in the MySQL help. + */ +- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id<WebPolicyDecisionListener>)listener +{ + int navigationType = [[actionInformation objectForKey:WebActionNavigationTypeKey] intValue]; + if([[[request URL] scheme] isEqualToString:@"applewebdata"]){ + [self showHelpFor:[[[request URL] path] substringWithRange:NSMakeRange(1,[[[request URL] path] length]-1)]]; + [listener ignore]; + } else { + if (navigationType == WebNavigationTypeOther) { + [listener use]; + } else if (navigationType == WebNavigationTypeLinkClicked) { + [[NSWorkspace sharedWorkspace] openURL:[actionInformation objectForKey:WebActionOriginalURLKey]]; + [listener ignore]; + } else { + // Ignore WebNavigationTypeFormSubmitted, WebNavigationTypeBackForward, + // WebNavigationTypeReload and WebNavigationTypeFormResubmitted. + [listener ignore]; + } + } } |