diff options
-rw-r--r-- | Interfaces/English.lproj/DBView.xib | 370 | ||||
-rw-r--r-- | Resources/PreferenceDefaults.plist | 2 | ||||
-rw-r--r-- | Source/CustomQuery.h | 6 | ||||
-rw-r--r-- | Source/CustomQuery.m | 37 |
4 files changed, 391 insertions, 24 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index aeb70ad6..f150633a 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.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="1182"/> + <integer value="6431"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -47,7 +47,7 @@ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{780, 480}</string> <object class="NSView" key="NSWindowView" id="579726586"> - <reference key="NSNextResponder"/> + <nil key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -2242,8 +2242,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> @@ -3214,6 +3214,16 @@ <string key="NSAction">_popUpItemAction:</string> <reference key="NSTarget" ref="416049103"/> </object> + <object class="NSMenuItem" id="601952975"> + <reference key="NSMenu" ref="960790892"/> + <string key="NSTitle">Replace Editor Content</string> + <string key="NSKeyEquiv"/> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="450876295"/> + <reference key="NSMixedImage" ref="414351669"/> + <string key="NSAction">_popUpItemAction:</string> + <reference key="NSTarget" ref="416049103"/> + </object> <object class="NSMenuItem" id="560786252"> <reference key="NSMenu" ref="960790892"/> <string key="NSTitle">Edit Favorites...</string> @@ -3237,9 +3247,18 @@ <string key="NSAction">_popUpItemAction:</string> <reference key="NSTarget" ref="416049103"/> </object> + <object class="NSMenuItem" id="50932569"> + <reference key="NSMenu" ref="960790892"/> + <string key="NSTitle">..placeholder for seachfield..</string> + <string key="NSKeyEquiv"/> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="450876295"/> + <reference key="NSMixedImage" ref="414351669"/> + <string key="NSAction">_popUpItemAction:</string> + <reference key="NSTarget" ref="416049103"/> + </object> </object> </object> - <int key="NSSelectedIndex">-1</int> <bool key="NSPullDown">YES</bool> <int key="NSPreferredEdge">3</int> <bool key="NSUsesItemFromMenu">YES</bool> @@ -3260,7 +3279,7 @@ <reference key="NSControlView" ref="363916571"/> <int key="NSButtonFlags">-2042609409</int> <int key="NSButtonFlags2">35</int> - <object class="NSCustomResource" key="NSNormalImage"> + <object class="NSCustomResource" key="NSNormalImage" id="1031579662"> <string key="NSClassName">NSImage</string> <string key="NSResourceName">button_action</string> </object> @@ -3275,10 +3294,7 @@ <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> - <object class="NSCustomResource" key="NSImage"> - <string key="NSClassName">NSImage</string> - <string key="NSResourceName">button_action</string> - </object> + <reference key="NSImage" ref="1031579662"/> <string key="NSAction">_popUpItemAction:</string> <reference key="NSTarget" ref="984501775"/> </object> @@ -4713,7 +4729,6 @@ </object> </object> <string key="NSFrameSize">{944, 550}</string> - <reference key="NSSuperview"/> </object> <string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string> <string key="NSMinSize">{780, 502}</string> @@ -9679,7 +9694,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">272892928</int> <string key="NSContents">May block server during export</string> - <object class="NSFont" key="NSSupport"> + <object class="NSFont" key="NSSupport" id="22"> <string key="NSName">LucidaGrande</string> <double key="NSSize">9.000000e+00</double> <int key="NSfFlags">3614</int> @@ -11323,6 +11338,80 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string key="NSFrameSize">{352, 84}</string> <string key="NSClassName">NSView</string> </object> + <object class="NSCustomView" id="532635418"> + <reference key="NSNextResponder"/> + <int key="NSvFlags">4364</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSSearchField" id="57646700"> + <reference key="NSNextResponder" ref="532635418"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{20, 1}, {176, 19}}</string> + <reference key="NSSuperview" ref="532635418"/> + <bool key="NSEnabled">YES</bool> + <object class="NSSearchFieldCell" key="NSCell" id="1072338815"> + <int key="NSCellFlags">343014976</int> + <int key="NSCellFlags2">272925696</int> + <string key="NSContents"/> + <reference key="NSSupport" ref="22"/> + <string key="NSPlaceholderString">search for names (as regexp)</string> + <reference key="NSControlView" ref="57646700"/> + <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="1072338815"/> + <reference key="NSControlView" ref="57646700"/> + <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="NSMutableDictionary"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>AXDescription</string> + <string>NSAccessibilityEncodedAttributesValueType</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>cancel</string> + <reference ref="9"/> + </object> + </object> + </object> + <string key="NSAction">_searchFieldCancel:</string> + <reference key="NSTarget" ref="1072338815"/> + <reference key="NSControlView" ref="57646700"/> + <int key="NSButtonFlags">138690815</int> + <int key="NSButtonFlags2">0</int> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">400</int> + <int key="NSPeriodicInterval">75</int> + </object> + <string key="NSRecentsAutosaveName">SPQueryFavoriteSearchField</string> + <int key="NSMaximumRecents">10</int> + <bytes key="NSSearchFieldFlags">CAAAAA</bytes> + </object> + </object> + </object> + <string key="NSFrameSize">{217, 20}</string> + <reference key="NSSuperview"/> + <string key="NSClassName">NSView</string> + </object> <object class="NSUserDefaultsController" id="461189245"> <bool key="NSSharedInstance">YES</bool> </object> @@ -15094,6 +15183,62 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <int key="connectionID">6421</int> </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.QueryFavoriteReplacesContent</string> + <reference key="source" ref="601952975"/> + <reference key="destination" ref="461189245"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="601952975"/> + <reference key="NSDestination" ref="461189245"/> + <string key="NSLabel">value: values.QueryFavoriteReplacesContent</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.QueryFavoriteReplacesContent</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">6428</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">queryFavoritesSearchMenuItem</string> + <reference key="source" ref="601471102"/> + <reference key="destination" ref="50932569"/> + </object> + <int key="connectionID">6430</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">queryFavoritesSearchField</string> + <reference key="source" ref="601471102"/> + <reference key="destination" ref="57646700"/> + </object> + <int key="connectionID">6434</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">queryFavoritesSearchFieldView</string> + <reference key="source" ref="601471102"/> + <reference key="destination" ref="532635418"/> + </object> + <int key="connectionID">6435</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">filterQueryFavorites:</string> + <reference key="source" ref="601471102"/> + <reference key="destination" ref="57646700"/> + </object> + <int key="connectionID">6436</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">delegate</string> + <reference key="source" ref="57646700"/> + <reference key="destination" ref="601471102"/> + </object> + <int key="connectionID">6437</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -17993,6 +18138,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <reference ref="5128219"/> <reference ref="560786252"/> <reference ref="17413925"/> + <reference ref="601952975"/> + <reference ref="50932569"/> </object> <reference key="parent" ref="416049103"/> </object> @@ -21256,6 +21403,40 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <reference key="object" ref="17413925"/> <reference key="parent" ref="960790892"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">6423</int> + <reference key="object" ref="601952975"/> + <reference key="parent" ref="960790892"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">6424</int> + <reference key="object" ref="50932569"/> + <reference key="parent" ref="960790892"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">6431</int> + <reference key="object" ref="532635418"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="57646700"/> + </object> + <reference key="parent" ref="1043842561"/> + <string key="objectName">Query Favorite Search</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">6432</int> + <reference key="object" ref="57646700"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="1072338815"/> + </object> + <reference key="parent" ref="532635418"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">6433</int> + <reference key="object" ref="1072338815"/> + <reference key="parent" ref="57646700"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -22532,6 +22713,13 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string>6413.IBPluginDependency</string> <string>6414.IBPluginDependency</string> <string>6422.IBPluginDependency</string> + <string>6423.IBPluginDependency</string> + <string>6424.IBPluginDependency</string> + <string>6431.IBEditorWindowLastContentRect</string> + <string>6431.IBPluginDependency</string> + <string>6432.IBAttributePlaceholdersKey</string> + <string>6432.IBPluginDependency</string> + <string>6433.IBPluginDependency</string> <string>654.IBPluginDependency</string> <string>654.ImportedFromIB2</string> <string>655.IBPluginDependency</string> @@ -22860,7 +23048,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> - <string>{{324, 555}, {188, 64}}</string> + <string>{{351, 701}, {215, 98}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -24338,8 +24526,8 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{869, 432}, {260, 112}}</string> - <string>{{869, 432}, {260, 112}}</string> + <string>{{719, 432}, {260, 112}}</string> + <string>{{719, 432}, {260, 112}}</string> <reference ref="9"/> <reference ref="5"/> <reference ref="9"/> @@ -24361,6 +24549,21 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</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>{{419, 772}, {217, 20}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <object class="NSMutableDictionary"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> @@ -24556,7 +24759,7 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</string> </object> </object> <nil key="sourceID"/> - <int key="maxID">6422</int> + <int key="maxID">6439</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -25878,6 +26081,141 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</string> </object> </object> </object> + <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBPartialClassDescription"> + <string key="className">CustomQuery</string> + <string key="superclassName">NSObject</string> + <object class="NSMutableDictionary" key="actions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>chooseQueryFavorite:</string> + <string>chooseQueryHistory:</string> + <string>closeSheet:</string> + <string>filterQueryFavorites:</string> + <string>gearMenuItemSelected:</string> + <string>helpSearchFindNextInPage:</string> + <string>helpSearchFindPreviousInPage:</string> + <string>helpSegmentDispatcher:</string> + <string>helpSelectHelpTargetMySQL:</string> + <string>helpSelectHelpTargetPage:</string> + <string>helpSelectHelpTargetWeb:</string> + <string>helpTargetDispatcher:</string> + <string>runAllQueries:</string> + <string>runSelectedQueries:</string> + <string>showHelpForCurrentWord:</string> + <string>showHelpForSearchString:</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> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</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"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>affectedRowsText</string> + <string>autohelpMenuItem</string> + <string>autoindentMenuItem</string> + <string>autopairMenuItem</string> + <string>autouppercaseKeywordsMenuItem</string> + <string>clearHistoryMenuItem</string> + <string>commentCurrentQueryMenuItem</string> + <string>commentLineOrSelectionMenuItem</string> + <string>completionListMenuItem</string> + <string>customQueryView</string> + <string>editorFontMenuItem</string> + <string>errorText</string> + <string>helpNavigator</string> + <string>helpSearchField</string> + <string>helpSearchFieldCell</string> + <string>helpTargetSelector</string> + <string>helpWebView</string> + <string>helpWebViewWindow</string> + <string>multipleLineEditingButton</string> + <string>queryFavoriteNameTextField</string> + <string>queryFavoritesButton</string> + <string>queryFavoritesSearchField</string> + <string>queryFavoritesSearchFieldView</string> + <string>queryFavoritesSearchMenuItem</string> + <string>queryFavoritesSheet</string> + <string>queryHistoryButton</string> + <string>runAllButton</string> + <string>runSelectionButton</string> + <string>runSelectionMenuItem</string> + <string>saveQueryFavoriteButton</string> + <string>shiftLeftMenuItem</string> + <string>shiftRightMenuItem</string> + <string>tableDocumentInstance</string> + <string>tableWindow</string> + <string>textView</string> + <string>valueSheet</string> + <string>valueTextField</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>NSMenuItem</string> + <string>NSMenuItem</string> + <string>NSMenuItem</string> + <string>NSMenuItem</string> + <string>NSMenuItem</string> + <string>NSMenuItem</string> + <string>NSMenuItem</string> + <string>NSMenuItem</string> + <string>CMCopyTable</string> + <string>NSMenuItem</string> + <string>id</string> + <string>NSSegmentedControl</string> + <string>NSSearchField</string> + <string>NSSearchFieldCell</string> + <string>NSSegmentedControl</string> + <string>WebView</string> + <string>NSWindow</string> + <string>id</string> + <string>NSTextField</string> + <string>id</string> + <string>NSSearchField</string> + <string>id</string> + <string>NSMenuItem</string> + <string>NSWindow</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>NSMenuItem</string> + <string>NSButton</string> + <string>NSMenuItem</string> + <string>NSMenuItem</string> + <string>id</string> + <string>id</string> + <string>CMTextView</string> + <string>id</string> + <string>id</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBDocumentRelativeSource</string> + <string key="minorKey">../../Source/CustomQuery.h</string> + </object> + </object> + </object> </object> <int key="IBDocument.localizationMode">0</int> <string key="IBDocument.LastKnownRelativeProjectPath">../../sequel-pro.xcodeproj</string> diff --git a/Resources/PreferenceDefaults.plist b/Resources/PreferenceDefaults.plist index f56b7432..5db7e463 100644 --- a/Resources/PreferenceDefaults.plist +++ b/Resources/PreferenceDefaults.plist @@ -40,6 +40,8 @@ <false/> <key>EditInSheetEnabled</key> <false/> + <key>QueryFavoriteReplacesContent</key> + <false/> <key>CustomQueryEditorFont</key> <data>BAtzdHJlYW10eXBlZIHoA4QBQISEhAZOU0ZvbnQehIQITlNPYmplY3QAhYQBaRiEBVsyNGNdBgAAAA4AAAD//k0AbwBuAGEAYwBvAAAAhAFmCoQBYwCYAZgAmACG</data> <key>CustomQueryEditorBackgroundColor</key> diff --git a/Source/CustomQuery.h b/Source/CustomQuery.h index eae2de5c..522cdd0d 100644 --- a/Source/CustomQuery.h +++ b/Source/CustomQuery.h @@ -39,8 +39,13 @@ { IBOutlet id tableDocumentInstance; IBOutlet id tableWindow; + IBOutlet id queryFavoritesButton; + IBOutlet NSMenuItem *queryFavoritesSearchMenuItem; + IBOutlet id queryFavoritesSearchFieldView; + IBOutlet NSSearchField *queryFavoritesSearchField; IBOutlet id queryHistoryButton; + IBOutlet CMTextView *textView; IBOutlet CMCopyTable *customQueryView; IBOutlet id errorText; @@ -122,6 +127,7 @@ - (IBAction)helpSelectHelpTargetMySQL:(id)sender; - (IBAction)helpSelectHelpTargetPage:(id)sender; - (IBAction)helpSelectHelpTargetWeb:(id)sender; +- (IBAction)filterQueryFavorites:(id)sender; // Query actions - (void)performQueries:(NSArray *)queries; diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index 4e02fd53..b1ac72d0 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -153,8 +153,8 @@ modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"addNewQueryFavorite"]; - } - else if ([queryFavoritesButton indexOfSelectedItem] == 2) { + } + else if ([queryFavoritesButton indexOfSelectedItem] == 3) { // Open query favorite manager [NSApp beginSheet:[favoritesManager window] modalForWindow:tableWindow @@ -162,9 +162,12 @@ didEndSelector:nil contextInfo:nil]; } - else if ([queryFavoritesButton indexOfSelectedItem] > 3) { + else if ([queryFavoritesButton indexOfSelectedItem] > 5) { // Choose favorite - [textView insertText:[[[prefs objectForKey:@"queryFavorites"] objectAtIndex:([queryFavoritesButton indexOfSelectedItem] - 4)] objectForKey:@"query"]]; + if([prefs boolForKey:@"QueryFavoriteReplacesContent"]) + [textView setSelectedRange:NSMakeRange(0,[[textView string] length])]; + + [textView insertText:[[[prefs objectForKey:@"queryFavorites"] objectAtIndex:([queryFavoritesButton indexOfSelectedItem] - 6)] objectForKey:@"query"]]; } } @@ -1808,13 +1811,17 @@ #pragma mark TextField delegate methods /** - * Called whenever the user changes the name of the new query favorite. + * Called whenever the user changes the name of the new query favorite or + * the user changed the query favorite search string. */ - (void)controlTextDidChange:(NSNotification *)notification { if ([notification object] == queryFavoriteNameTextField) { [saveQueryFavoriteButton setEnabled:[[queryFavoriteNameTextField stringValue] length]]; } + else if ([notification object] == queryFavoritesSearchField) { + [self filterQueryFavorites:nil]; + } } #pragma mark - @@ -2342,15 +2349,16 @@ NSMutableArray *favorites = ([favoritesManager queryFavorites]) ? [favoritesManager queryFavorites] : [prefs objectForKey:@"queryFavorites"]; // Remove all favorites beginning from the end - while([queryFavoritesButton numberOfItems] > 4) + while([queryFavoritesButton numberOfItems] > 6) [queryFavoritesButton removeItemAtIndex:[queryFavoritesButton numberOfItems]-1]; // Re-add favorites and allow menu items with the same name NSMenu *menu = [queryFavoritesButton menu]; - int i = 4; + int i = 6; for (NSDictionary *favorite in favorites) { NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[favorite objectForKey:@"name"] action:NULL keyEquivalent:@""]; [item setTag:i++]; + [item setToolTip:[favorite objectForKey:@"query"]]; [menu addItem:item]; [item release]; } @@ -2470,18 +2478,31 @@ return self; } +- (IBAction)filterQueryFavorites:(id)sender +{ + int i; + NSMenu *menu = [queryFavoritesButton menu]; + for (i=6; i< [menu numberOfItems]; i++) + [[menu itemAtIndex:i] setHidden:(![[[menu itemAtIndex:i] title] isMatchedByRegex:[NSString stringWithFormat:@"(?i).*%@.*", [queryFavoritesSearchField stringValue]]])]; + +} + - (void)awakeFromNib { // Set the structure and index view's vertical gridlines if required [customQueryView setGridStyleMask:([prefs boolForKey:@"DisplayTableViewVerticalGridlines"]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone]; + // Add the searchfield to the Query Favorite popup button list + [queryFavoritesSearchMenuItem setView:queryFavoritesSearchFieldView]; + // Populate the query favorites popup button NSMenu *menu = [queryFavoritesButton menu]; - int i = 4; + int i = 6; for (NSDictionary *favorite in [prefs objectForKey:@"queryFavorites"]) { NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[favorite objectForKey:@"name"] action:NULL keyEquivalent:@""]; [item setTag:i++]; + [item setToolTip:[favorite objectForKey:@"query"]]; [menu addItem:item]; [item release]; } |