aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-09-04 13:44:32 +0000
committerBibiko <bibiko@eva.mpg.de>2009-09-04 13:44:32 +0000
commite00013ffbf5fb252a11fc6e2c68a1af0b9886317 (patch)
tree62888a4cb0a66b1c1e705d160f30588060d47804
parent3352744652a821093ef1138187609cdca5c9fef7 (diff)
downloadsequelpro-e00013ffbf5fb252a11fc6e2c68a1af0b9886317.tar.gz
sequelpro-e00013ffbf5fb252a11fc6e2c68a1af0b9886317.tar.bz2
sequelpro-e00013ffbf5fb252a11fc6e2c68a1af0b9886317.zip
• first steps to support global/document-based query favorites
- not yet fully implemented but workable
-rw-r--r--Interfaces/English.lproj/DBView.xib89
-rw-r--r--Source/CustomQuery.m70
-rw-r--r--Source/SPQueryController.h3
-rw-r--r--Source/SPQueryController.m11
4 files changed, 140 insertions, 33 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index fa2e8746..4e1298ea 100644
--- a/Interfaces/English.lproj/DBView.xib
+++ b/Interfaces/English.lproj/DBView.xib
@@ -46,7 +46,7 @@
<string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{780, 480}</string>
<object class="NSView" key="NSWindowView" id="579726586">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -100,6 +100,7 @@
<int key="NSvFlags">266</int>
<string key="NSFrame">{{5, 2}, {202, 19}}</string>
<reference key="NSSuperview" ref="643201879"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSSearchFieldCell" key="NSCell" id="134854992">
<int key="NSCellFlags">343014976</int>
@@ -180,11 +181,13 @@
</object>
<string key="NSFrameSize">{212, 26}</string>
<reference key="NSSuperview" ref="588922296"/>
+ <reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
</object>
<string key="NSFrameSize">{212, 26}</string>
<reference key="NSSuperview" ref="199860064"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="643201879"/>
<reference key="NSDocView" ref="643201879"/>
<object class="NSColor" key="NSBGColor" id="529261656">
@@ -203,6 +206,7 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{-100, -100}, {15, 94}}</string>
<reference key="NSSuperview" ref="199860064"/>
+ <reference key="NSWindow"/>
<reference key="NSTarget" ref="199860064"/>
<string key="NSAction">_doScroller:</string>
<double key="NSCurValue">1.000000e+00</double>
@@ -213,6 +217,7 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{-100, -100}, {166, 15}}</string>
<reference key="NSSuperview" ref="199860064"/>
+ <reference key="NSWindow"/>
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="199860064"/>
<string key="NSAction">_doScroller:</string>
@@ -221,6 +226,7 @@
</object>
<string key="NSFrameSize">{212, 26}</string>
<reference key="NSSuperview" ref="801427893"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="588922296"/>
<int key="NSsFlags">0</int>
<reference key="NSVScroller" ref="540853896"/>
@@ -230,6 +236,7 @@
</object>
<string key="NSFrameSize">{212, 26}</string>
<reference key="NSSuperview" ref="213762440"/>
+ <reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
<object class="BWCustomView" id="1017775084">
@@ -252,6 +259,7 @@
<int key="NSvFlags">4352</int>
<string key="NSFrameSize">{212, 354}</string>
<reference key="NSSuperview" ref="73685676"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="_NSCornerView" key="NSCornerView">
<nil key="NSNextResponder"/>
@@ -336,6 +344,7 @@
</object>
<string key="NSFrameSize">{212, 354}</string>
<reference key="NSSuperview" ref="233472824"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="251040077"/>
<reference key="NSDocView" ref="251040077"/>
<object class="NSColor" key="NSBGColor" id="1024678221">
@@ -351,6 +360,7 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{197, 0}, {15, 292}}</string>
<reference key="NSSuperview" ref="233472824"/>
+ <reference key="NSWindow"/>
<reference key="NSTarget" ref="233472824"/>
<string key="NSAction">_doScroller:</string>
<double key="NSPercent">9.965870e-01</double>
@@ -360,6 +370,7 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{-100, -100}, {141, 11}}</string>
<reference key="NSSuperview" ref="233472824"/>
+ <reference key="NSWindow"/>
<int key="NSsFlags">257</int>
<reference key="NSTarget" ref="233472824"/>
<string key="NSAction">_doScroller:</string>
@@ -368,6 +379,7 @@
</object>
<string key="NSFrameSize">{212, 354}</string>
<reference key="NSSuperview" ref="1017775084"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="73685676"/>
<int key="NSsFlags">528</int>
<reference key="NSVScroller" ref="693168867"/>
@@ -378,11 +390,13 @@
</object>
<string key="NSFrame">{{0, 27}, {212, 354}}</string>
<reference key="NSSuperview" ref="213762440"/>
+ <reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
</object>
<string key="NSFrameSize">{212, 381}</string>
<reference key="NSSuperview" ref="131633443"/>
+ <reference key="NSWindow"/>
<int key="NSDividerStyle">2</int>
<reference key="BWSVColor" ref="529261656"/>
<bool key="BWSVColorIsEnabled">YES</bool>
@@ -408,6 +422,7 @@
</object>
<string key="NSFrameSize">{212, 381}</string>
<reference key="NSSuperview" ref="298095498"/>
+ <reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
<object class="BWCustomView" id="192579410">
@@ -430,6 +445,7 @@
<int key="NSvFlags">4352</int>
<string key="NSFrameSize">{212, 145}</string>
<reference key="NSSuperview" ref="685057119"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="_NSCornerView" key="NSCornerView">
<nil key="NSNextResponder"/>
@@ -493,6 +509,7 @@
</object>
<string key="NSFrameSize">{212, 145}</string>
<reference key="NSSuperview" ref="298226231"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="347093764"/>
<reference key="NSDocView" ref="347093764"/>
<reference key="NSBGColor" ref="1024678221"/>
@@ -503,6 +520,7 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{-100, -100}, {15, 20}}</string>
<reference key="NSSuperview" ref="298226231"/>
+ <reference key="NSWindow"/>
<reference key="NSTarget" ref="298226231"/>
<string key="NSAction">_doScroller:</string>
<double key="NSPercent">9.473684e-01</double>
@@ -512,6 +530,7 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{-100, -100}, {141, 11}}</string>
<reference key="NSSuperview" ref="298226231"/>
+ <reference key="NSWindow"/>
<int key="NSsFlags">257</int>
<reference key="NSTarget" ref="298226231"/>
<string key="NSAction">_doScroller:</string>
@@ -520,6 +539,7 @@
</object>
<string key="NSFrameSize">{212, 145}</string>
<reference key="NSSuperview" ref="192579410"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="685057119"/>
<int key="NSsFlags">512</int>
<reference key="NSVScroller" ref="245346414"/>
@@ -530,11 +550,13 @@
</object>
<string key="NSFrame">{{0, 382}, {212, 145}}</string>
<reference key="NSSuperview" ref="298095498"/>
+ <reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
</object>
<string key="NSFrame">{{0, 23}, {212, 527}}</string>
<reference key="NSSuperview" ref="372294785"/>
+ <reference key="NSWindow"/>
<int key="NSDividerStyle">2</int>
<reference key="BWSVColor" ref="304829493"/>
<bool key="BWSVColorIsEnabled">NO</bool>
@@ -585,6 +607,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{-1, -1}, {32, 24}}</string>
<reference key="NSSuperview" ref="28219887"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="BWAnchoredButtonCell" key="NSCell" id="283448047">
<int key="NSCellFlags">67239424</int>
@@ -609,6 +632,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{30, -1}, {32, 24}}</string>
<reference key="NSSuperview" ref="28219887"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="BWAnchoredPopUpButtonCell" key="NSCell" id="321871356">
<int key="NSCellFlags">71433792</int>
@@ -718,6 +742,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{61, -1}, {32, 24}}</string>
<reference key="NSSuperview" ref="28219887"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="BWAnchoredButtonCell" key="NSCell" id="227511715">
<int key="NSCellFlags">67239424</int>
@@ -742,6 +767,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{92, -1}, {32, 24}}</string>
<reference key="NSSuperview" ref="28219887"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="BWAnchoredButtonCell" key="NSCell" id="708016222">
<int key="NSCellFlags">-2080244224</int>
@@ -768,6 +794,7 @@
</object>
<string key="NSFrameSize">{212, 23}</string>
<reference key="NSSuperview" ref="372294785"/>
+ <reference key="NSWindow"/>
<bool key="BWABBIsResizable">YES</bool>
<bool key="BWABBIsAtBottom">YES</bool>
<bool key="BWABBHandleIsRightAligned">NO</bool>
@@ -776,6 +803,7 @@
</object>
<string key="NSFrameSize">{212, 550}</string>
<reference key="NSSuperview" ref="937377983"/>
+ <reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
<object class="NSCustomView" id="604818293">
@@ -788,6 +816,7 @@
<int key="NSvFlags">274</int>
<string key="NSFrame">{{-7, -10}, {735, 564}}</string>
<reference key="NSSuperview" ref="604818293"/>
+ <reference key="NSWindow"/>
<object class="NSMutableArray" key="NSTabViewItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSTabViewItem" id="831053945">
@@ -2861,8 +2890,32 @@
<object class="NSTextView" id="1055190999">
<reference key="NSNextResponder" ref="1072692119"/>
<int key="NSvFlags">6418</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 PDF pasteboard type</string>
+ <string>Apple PICT pasteboard type</string>
+ <string>Apple PNG pasteboard type</string>
+ <string>Apple URL pasteboard type</string>
+ <string>CorePasteboardFlavorType 0x6D6F6F76</string>
+ <string>CorePasteboardFlavorType 0x75726C20</string>
+ <string>NSColor pasteboard type</string>
+ <string>NSFilenamesPboardType</string>
+ <string>NSStringPboardType</string>
+ <string>NeXT Encapsulated PostScript v1.2 pasteboard type</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>NeXT font pasteboard type</string>
+ <string>NeXT ruler pasteboard type</string>
+ <string>WebURLsWithTitlesPboardType</string>
+ </object>
+ </object>
<string key="NSFrameSize">{688, 14}</string>
<reference key="NSSuperview" ref="1072692119"/>
+ <reference key="NSWindow"/>
<object class="NSTextContainer" key="NSTextContainer" id="326170846">
<object class="NSLayoutManager" key="NSLayoutManager">
<object class="NSTextStorage" key="NSTextStorage">
@@ -2921,6 +2974,7 @@
</object>
<string key="NSFrame">{{1, 1}, {688, 155}}</string>
<reference key="NSSuperview" ref="71560786"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1055190999"/>
<reference key="NSDocView" ref="1055190999"/>
<reference key="NSBGColor" ref="449903125"/>
@@ -2935,6 +2989,7 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{598, 1}, {15, 68}}</string>
<reference key="NSSuperview" ref="71560786"/>
+ <reference key="NSWindow"/>
<reference key="NSTarget" ref="71560786"/>
<string key="NSAction">_doScroller:</string>
<double key="NSCurValue">1.000000e+00</double>
@@ -2944,6 +2999,7 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{-100, -100}, {601, 11}}</string>
<reference key="NSSuperview" ref="71560786"/>
+ <reference key="NSWindow"/>
<int key="NSsFlags">257</int>
<reference key="NSTarget" ref="71560786"/>
<string key="NSAction">_doScroller:</string>
@@ -2953,6 +3009,7 @@
</object>
<string key="NSFrameSize">{690, 157}</string>
<reference key="NSSuperview" ref="873437769"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1072692119"/>
<int key="NSsFlags">530</int>
<reference key="NSVScroller" ref="413233170"/>
@@ -2962,6 +3019,7 @@
</object>
<string key="NSFrameSize">{690, 156}</string>
<reference key="NSSuperview" ref="894339536"/>
+ <reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
<object class="NSCustomView" id="345834048">
@@ -2984,12 +3042,14 @@
<int key="NSvFlags">4352</int>
<string key="NSFrameSize">{688, 228}</string>
<reference key="NSSuperview" ref="90844306"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTableHeaderView" key="NSHeaderView" id="1038415606">
<reference key="NSNextResponder" ref="533922066"/>
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{688, 17}</string>
<reference key="NSSuperview" ref="533922066"/>
+ <reference key="NSWindow"/>
<reference key="NSTableView" ref="581095761"/>
</object>
<object class="_NSCornerView" key="NSCornerView" id="151074124">
@@ -2997,6 +3057,7 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{-26, 0}, {16, 17}}</string>
<reference key="NSSuperview" ref="678281118"/>
+ <reference key="NSWindow"/>
</object>
<object class="NSMutableArray" key="NSTableColumns">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -3040,6 +3101,7 @@
</object>
<string key="NSFrame">{{1, 17}, {688, 228}}</string>
<reference key="NSSuperview" ref="678281118"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="581095761"/>
<reference key="NSDocView" ref="581095761"/>
<reference key="NSBGColor" ref="1024678221"/>
@@ -3050,6 +3112,7 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{611, 17}, {15, 30}}</string>
<reference key="NSSuperview" ref="678281118"/>
+ <reference key="NSWindow"/>
<reference key="NSTarget" ref="678281118"/>
<string key="NSAction">_doScroller:</string>
<double key="NSPercent">9.375000e-01</double>
@@ -3059,6 +3122,7 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{1, 47}, {610, 15}}</string>
<reference key="NSSuperview" ref="678281118"/>
+ <reference key="NSWindow"/>
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="678281118"/>
<string key="NSAction">_doScroller:</string>
@@ -3073,6 +3137,7 @@
</object>
<string key="NSFrame">{{1, 0}, {688, 17}}</string>
<reference key="NSSuperview" ref="678281118"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1038415606"/>
<reference key="NSDocView" ref="1038415606"/>
<reference key="NSBGColor" ref="1024678221"/>
@@ -3082,6 +3147,7 @@
</object>
<string key="NSFrameSize">{690, 246}</string>
<reference key="NSSuperview" ref="345834048"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="90844306"/>
<int key="NSsFlags">562</int>
<reference key="NSVScroller" ref="472831765"/>
@@ -3096,6 +3162,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{156, 246}, {98, 22}}</string>
<reference key="NSSuperview" ref="345834048"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="830957297">
<int key="NSCellFlags">-2076049856</int>
@@ -3155,6 +3222,7 @@
<int key="NSvFlags">264</int>
<string key="NSFrame">{{38, 246}, {108, 22}}</string>
<reference key="NSSuperview" ref="345834048"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="416049103">
<int key="NSCellFlags">-2076049856</int>
@@ -3195,7 +3263,7 @@
<reference key="NSOnImage" ref="450876295"/>
<reference key="NSMixedImage" ref="414351669"/>
<string key="NSAction">_popUpItemAction:</string>
- <int key="NSTag">1000</int>
+ <int key="NSTag">100000</int>
<reference key="NSTarget" ref="416049103"/>
</object>
<object class="NSMenuItem" id="336702336">
@@ -3207,7 +3275,7 @@
<reference key="NSOnImage" ref="450876295"/>
<reference key="NSMixedImage" ref="414351669"/>
<string key="NSAction">_popUpItemAction:</string>
- <int key="NSTag">1001</int>
+ <int key="NSTag">100001</int>
<reference key="NSTarget" ref="416049103"/>
</object>
<object class="NSMenuItem" id="560786252">
@@ -3257,6 +3325,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{-10, 245}, {46, 25}}</string>
<reference key="NSSuperview" ref="345834048"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="984501775">
<int key="NSCellFlags">-2076049856</int>
@@ -3550,6 +3619,7 @@
<int key="NSvFlags">265</int>
<string key="NSFrame">{{591, 248}, {90, 17}}</string>
<reference key="NSSuperview" ref="345834048"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="177866566">
<int key="NSCellFlags">-2080244224</int>
@@ -3571,6 +3641,7 @@
<int key="NSvFlags">265</int>
<string key="NSFrame">{{473, 248}, {110, 17}}</string>
<reference key="NSSuperview" ref="345834048"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="588489390">
<int key="NSCellFlags">604110336</int>
@@ -3603,6 +3674,7 @@
</object>
<string key="NSFrame">{{32, 246}, {658, 23}}</string>
<reference key="NSSuperview" ref="345834048"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSImageCell" key="NSCell" id="76236597">
<int key="NSCellFlags">130560</int>
@@ -3618,6 +3690,7 @@
</object>
<string key="NSFrame">{{0, 165}, {690, 269}}</string>
<reference key="NSSuperview" ref="894339536"/>
+ <reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
<object class="NSCustomView" id="875002707">
@@ -3630,6 +3703,7 @@
<int key="NSvFlags">266</int>
<string key="NSFrame">{{242, 64}, {431, 17}}</string>
<reference key="NSSuperview" ref="875002707"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="401235649">
<int key="NSCellFlags">67239424</int>
@@ -3646,6 +3720,7 @@
<int key="NSvFlags">264</int>
<string key="NSFrame">{{17, 67}, {143, 14}}</string>
<reference key="NSSuperview" ref="875002707"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="194978207">
<int key="NSCellFlags">67239424</int>
@@ -3662,6 +3737,7 @@
<int key="NSvFlags">274</int>
<string key="NSFrame">{{17, 20}, {656, 43}}</string>
<reference key="NSSuperview" ref="875002707"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="948571736">
<int key="NSCellFlags">67239424</int>
@@ -3676,15 +3752,18 @@
</object>
<string key="NSFrame">{{0, 443}, {690, 87}}</string>
<reference key="NSSuperview" ref="894339536"/>
+ <reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
</object>
<string key="NSFrame">{{6, 10}, {690, 530}}</string>
<reference key="NSSuperview" ref="746504912"/>
+ <reference key="NSWindow"/>
</object>
</object>
<string key="NSFrame">{{10, 7}, {700, 544}}</string>
<reference key="NSSuperview" ref="714795046"/>
+ <reference key="NSWindow"/>
</object>
<string key="NSLabel">Custom Query</string>
<reference key="NSColor" ref="62854682"/>
@@ -4737,16 +4816,20 @@
</object>
<string key="NSFrame">{{221, 0}, {723, 550}}</string>
<reference key="NSSuperview" ref="937377983"/>
+ <reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
</object>
<string key="NSFrameSize">{944, 550}</string>
<reference key="NSSuperview" ref="579726586"/>
+ <reference key="NSWindow"/>
<bool key="NSIsVertical">YES</bool>
<string key="NSAutosaveName">DBViewSplitter</string>
</object>
</object>
<string key="NSFrameSize">{944, 550}</string>
+ <reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
<string key="NSMinSize">{780, 502}</string>
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index bbad9edc..67741669 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -1103,6 +1103,10 @@
[queryHistoryButton addItemsWithTitles:[[SPQueryController sharedQueryController] historyForFileURL:[tableDocumentInstance fileURL]]];
}
+ // Populate query favorites
+ [self queryFavoritesHaveBeenUpdated:nil];
+
+
// Disable runSelectionMenuItem in the gear menu
[runSelectionMenuItem setEnabled:NO];
}
@@ -2403,36 +2407,60 @@
- (void)queryFavoritesHaveBeenUpdated:(id)manager
{
- NSMutableArray *favorites = [[NSMutableArray alloc] init];
+ NSMutableArray *globalFavorites = [[NSMutableArray alloc] init];
// Invoked after adding a favorite from inside CustomQuery
if(manager == nil) {
- [favorites addObjectsFromArray:[prefs objectForKey:@"queryFavorites"]];
+ [globalFavorites addObjectsFromArray:[prefs objectForKey:@"queryFavorites"]];
}
// Invoked by the query favorite manager
else if(manager == favoritesManager){
- // Update global query favorites
- [favorites addObjectsFromArray:[favoritesManager globalQueryFavorites]];
- [prefs setObject:favorites forKey:@"queryFavorites"];
- [prefs synchronize];
+ // Update global query favorites
+ [globalFavorites addObjectsFromArray:[favoritesManager globalQueryFavorites]];
+ [prefs setObject:globalFavorites forKey:@"queryFavorites"];
}
// Remove all favorites beginning from the end
while([queryFavoritesButton numberOfItems] > 6)
[queryFavoritesButton removeItemAtIndex:[queryFavoritesButton numberOfItems]-1];
- // Re-add favorites and allow menu items with the same name
+ // Insert new favorites and allow menu items with the same name
NSMenu *menu = [queryFavoritesButton menu];
int i = 6;
- for (NSDictionary *favorite in favorites) {
+
+ NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:@"Global" action:NULL keyEquivalent:@""];
+ [item setTag:200000];
+ [item setToolTip:@"All global favorites"];
+ [item setIndentationLevel:0];
+ [menu addItem:item];
+ [item release];
+
+ for (NSDictionary *favorite in globalFavorites) {
+ NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithString:[favorite objectForKey:@"name"]] action:NULL keyEquivalent:@""];
+ [item setTag:i++];
+ [item setToolTip:[NSString stringWithString:[favorite objectForKey:@"query"]]];
+ [item setIndentationLevel:1];
+ [menu addItem:item];
+ [item release];
+ }
+
+ item = [[NSMenuItem alloc] initWithTitle:@"Document" action:NULL keyEquivalent:@""];
+ [item setTag:200000];
+ [item setToolTip:@"All document-based favorites"];
+ [item setIndentationLevel:0];
+ [menu addItem:item];
+ [item release];
+
+ for (NSDictionary *favorite in [[SPQueryController sharedQueryController] favoritesForFileURL:[tableDocumentInstance fileURL]]) {
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithString:[favorite objectForKey:@"name"]] action:NULL keyEquivalent:@""];
[item setTag:i++];
[item setToolTip:[NSString stringWithString:[favorite objectForKey:@"query"]]];
+ [item setIndentationLevel:1];
[menu addItem:item];
[item release];
}
- [favorites release];
+ [globalFavorites release];
[prefs synchronize];
@@ -2497,7 +2525,9 @@
[prefs setObject:favorites forKey:@"queryFavorites"];
} else {
- [SPTooltip showWithObject:@"Not yet implemented"];
+ [[SPQueryController sharedQueryController] addFavorite:[NSDictionary dictionaryWithObjects:
+ [NSArray arrayWithObjects:[queryFavoriteNameTextField stringValue], queryToBeAddded, nil]
+ forKeys:[NSArray arrayWithObjects:@"name", @"query", nil]] forFileURL:[tableDocumentInstance fileURL]];
}
[saveQueryFavoriteGlobal setState:NSOffState];
@@ -2516,7 +2546,7 @@
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
{
// Control "Save ... to Favorites" = tag is set to 1000
- if ( [menuItem tag] == 1000 ) {
+ if ( [menuItem tag] == 100000 ) {
if ([[textView string] length] < 1) return NO;
if([textView selectedRange].length)
[menuItem setTitle:NSLocalizedString(@"Save Selection to Favorites",@"Save Selection to Favorites")];
@@ -2526,9 +2556,12 @@
[menuItem setTitle:NSLocalizedString(@"Save All to Favorites",@"Save All to Favorites")];
}
// Control "Save All to Favorites" = tag is set to 1001
- if ( [menuItem tag] == 1001 ) {
+ if ( [menuItem tag] == 100001 ) {
if ([[textView string] length] < 1) return NO;
}
+ if ( [menuItem tag] == 200000 ) {
+ return NO;
+ }
return YES;
}
@@ -2594,19 +2627,6 @@
{
// Set the structure and index view's vertical gridlines if required
[customQueryView setGridStyleMask:([prefs boolForKey:@"DisplayTableViewVerticalGridlines"]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
-
- // Populate the query favorites popup button
- NSMenu *menu = [queryFavoritesButton menu];
- 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];
- }
-
}
- (void)dealloc
diff --git a/Source/SPQueryController.h b/Source/SPQueryController.h
index bce03109..df842745 100644
--- a/Source/SPQueryController.h
+++ b/Source/SPQueryController.h
@@ -81,10 +81,13 @@
// DocumentsController
- (NSURL *)registerDocumentWithFileURL:(NSURL *)fileURL andContextInfo:(NSMutableDictionary *)contextInfo;
- (void)removeRegisteredDocumentWithFileURL:(NSURL *)fileURL;
+
- (void)addFavorite:(NSDictionary *)favorite forFileURL:(NSURL *)fileURL;
- (void)replaceFavoritesByArray:(NSArray *)favoritesArray forFileURL:(NSURL *)fileURL;
+
- (void)addHistory:(NSString *)history forFileURL:(NSURL *)fileURL;
- (void)replaceHistoryByArray:(NSArray *)historyArray forFileURL:(NSURL *)fileURL;
+
- (NSMutableArray *)favoritesForFileURL:(NSURL *)fileURL;
- (NSMutableArray *)historyForFileURL:(NSURL *)fileURL;
diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m
index 807f5444..4345f616 100644
--- a/Source/SPQueryController.m
+++ b/Source/SPQueryController.m
@@ -493,11 +493,6 @@ static SPQueryController *sharedQueryController = nil;
}
-- (void)addFavorite:(NSDictionary *)favorite forFileURL:(NSURL *)fileURL
-{
-
-}
-
- (void)replaceFavoritesByArray:(NSArray *)favoritesArray forFileURL:(NSURL *)fileURL
{
if([favoritesContainer objectForKey:[fileURL absoluteString]])
@@ -510,6 +505,12 @@ static SPQueryController *sharedQueryController = nil;
[historyContainer setObject:historyArray forKey:[fileURL absoluteString]];
}
+- (void)addFavorite:(NSDictionary *)favorite forFileURL:(NSURL *)fileURL
+{
+ if([favoritesContainer objectForKey:[fileURL absoluteString]])
+ [[favoritesContainer objectForKey:[fileURL absoluteString]] addObject:favorite];
+}
+
- (void)addHistory:(NSString *)history forFileURL:(NSURL *)fileURL
{