From 11eb3e017d203af40c13ac2ff10d0f42a805f0c3 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Wed, 29 Sep 2010 07:39:43 +0000 Subject: =?UTF-8?q?=E2=80=A2=20Filter=20Table=20-=20added=20"Search=20whil?= =?UTF-8?q?e=20Typing"=20-=20added=20some=20keyboard=20short-cuts=20-=20fi?= =?UTF-8?q?xed=20some=20minor=20issues=20-=20Filter=20Table=20is=20now=20a?= =?UTF-8?q?=20normal=20NSWindow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Interfaces/English.lproj/DBView.xib | 454 +++++++++++++++++++++++++----------- Source/SPTableContent.h | 6 +- Source/SPTableContent.m | 103 ++++++-- Source/SPTablesList.m | 3 + 4 files changed, 409 insertions(+), 157 deletions(-) diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index 9729fba6..936b9ff3 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -23,7 +23,7 @@ YES - + YES @@ -47,7 +47,7 @@ NSApplication - + 274 YES @@ -86,6 +86,7 @@ 290 {{5, 2}, {204, 19}} + YES 343014976 @@ -178,6 +179,7 @@ 4362 {218, 38} + YES @@ -267,6 +269,7 @@ {{1, 1}, {218, 38}} + @@ -282,6 +285,7 @@ -2147483392 {{-100, -100}, {15, 8}} + _doScroller: 0.42105263471603394 @@ -291,6 +295,7 @@ -2147483392 {{-100, -100}, {223, 15}} + 1 _doScroller: @@ -299,6 +304,7 @@ {{-1, -13}, {220, 40}} + 2 @@ -309,6 +315,7 @@ {214, 26} + NSView @@ -331,6 +338,7 @@ 4352 {214, 354} + YES @@ -397,6 +405,7 @@ {214, 354} + @@ -407,6 +416,7 @@ -2147483392 {{197, 0}, {15, 292}} + _doScroller: 0.096045196056365967 @@ -417,6 +427,7 @@ -2147483392 {{-100, -100}, {141, 11}} + 257 _doScroller: @@ -425,6 +436,7 @@ {214, 354} + 528 @@ -435,11 +447,13 @@ {{0, 27}, {214, 354}} + NSView {214, 381} + 2 6 @@ -473,6 +487,7 @@ {214, 381} + NSView @@ -495,6 +510,7 @@ 4352 {214, 145} + YES @@ -561,6 +577,7 @@ {214, 145} + @@ -571,6 +588,7 @@ -2147483392 {{-100, -100}, {15, 20}} + _doScroller: 0.48965516686439514 @@ -581,6 +599,7 @@ -2147483392 {{-100, -100}, {141, 11}} + 257 _doScroller: @@ -589,6 +608,7 @@ {214, 145} + 512 @@ -599,11 +619,13 @@ {{0, 382}, {214, 145}} + NSView {{0, 23}, {214, 527}} + 2 NO @@ -654,6 +676,7 @@ 268 {{-1, -1}, {32, 24}} + YES 67239424 @@ -678,6 +701,7 @@ 268 {{30, -1}, {32, 24}} + YES 71433792 @@ -865,6 +889,7 @@ 268 {{61, -1}, {32, 24}} + YES 67239424 @@ -889,6 +914,7 @@ 268 {{92, -1}, {32, 24}} + YES -2080244224 @@ -915,6 +941,7 @@ {{0, 1}, {214, 23}} + YES YES NO @@ -923,6 +950,7 @@ {214, 550} + NSView @@ -935,6 +963,7 @@ 274 {{-7, -10}, {741, 564}} + YES @@ -2338,12 +2367,14 @@ 4352 {694, 450} + YES 256 {694, 17} + @@ -2351,6 +2382,7 @@ -2147483392 {{-26, 0}, {16, 17}} + YES @@ -2398,6 +2430,7 @@ {{1, 17}, {694, 450}} + @@ -2408,6 +2441,7 @@ -2147483392 {{611, 17}, {15, 439}} + _doScroller: 0.99557524919509888 @@ -2417,6 +2451,7 @@ -2147483392 {{1, 456}, {688, 15}} + 1 _doScroller: @@ -2432,6 +2467,7 @@ {{1, 0}, {694, 17}} + @@ -2441,6 +2477,7 @@ {{6, 33}, {696, 468}} + 562 @@ -2456,6 +2493,7 @@ {{680, 515}, {16, 16}} + 28938 100 @@ -2464,6 +2502,7 @@ 265 {{620, 513}, {54, 19}} + YES -2080244224 @@ -2488,6 +2527,7 @@ 292 {{6, 10}, {32, 25}} + YES 604110336 @@ -2509,6 +2549,7 @@ 292 {{100, 10}, {32, 25}} + YES 67239424 @@ -2530,6 +2571,7 @@ 292 {{37, 10}, {32, 25}} + YES 604110336 @@ -2551,6 +2593,7 @@ 292 {{68, 10}, {32, 25}} + YES 604110336 @@ -2584,6 +2627,7 @@ {{163, 11}, {539, 23}} + YES 130560 @@ -2601,6 +2645,7 @@ 292 {{131, 10}, {32, 25}} + YES 67239424 @@ -2629,6 +2674,7 @@ 290 {{166, 7}, {421, 22}} + YES 68288064 @@ -2655,6 +2701,7 @@ 264 {{7, 6}, {43, 14}} + YES 67239488 @@ -2671,6 +2718,7 @@ 266 {{51, 3}, {160, 20}} + YES -1539178944 @@ -2719,6 +2767,7 @@ 265 {{216, 0}, {95, 25}} + YES -1539178944 @@ -2764,6 +2813,7 @@ {313, 27} + NSView @@ -2776,6 +2826,7 @@ 266 {{5, 4}, {278, 19}} + YES 879885888 @@ -2839,6 +2890,7 @@ -2147483379 {{129, 6}, {28, 14}} + YES 68288064 @@ -2855,6 +2907,7 @@ -2147483378 {{5, 4}, {112, 19}} + YES 343014976 @@ -2916,6 +2969,7 @@ -2147483381 {{170, 4}, {111, 19}} + YES 343014976 @@ -2977,11 +3031,13 @@ {{322, 0}, {284, 27}} + NSView {{6, 509}, {606, 27}} + YES TableFilterSplitter @@ -2990,6 +3046,7 @@ 289 {{654, 10}, {32, 25}} + YES 67239424 @@ -3014,6 +3071,7 @@ 289 {{592, 10}, {32, 25}} + YES 67239424 @@ -3038,6 +3096,7 @@ 289 {{623, 10}, {32, 25}} + YES 67239424 @@ -3062,6 +3121,7 @@ 265 {{734, 507}, {160, 16}} + YES 67239424 @@ -3084,6 +3144,7 @@ {{10, 7}, {706, 544}} + Content @@ -6072,17 +6133,21 @@ {{215, 0}, {729, 550}} + NSView {{0, -1}, {944, 550}} + YES 2 DBViewSplitter {943, 549} + + NSView @@ -9271,35 +9336,35 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 MYSQL_HELP_WINDOW - 8347 + 139 2 - {{131, 159}, {480, 270}} + {{131, 160}, {480, 269}} -461896704 Filter - NSPanel + NSWindow {3.40282e+38, 3.40282e+38} - {340, 170} + {380, 170} - 256 + 274 YES - + - 4364 + 4386 YES - - + + 2304 YES - - + + 4352 - {478, 215} - + {478, 1002} + YES @@ -9308,66 +9373,99 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 YES + + 475 + 40 + 1000 + + 75628032 + 0 + + + + 3 + MC4zMzMzMzI5ODU2AA + + + + + 337772096 + 33556480 + Text Cell + + + + + 1 + MSAxIDEAA + + + 3 + YES + YES + + 3 2 - - 4 - MSAwLjE0MDAwMDAwMDYAA - + - 20 - -692060160 + 1000 + 1388314624 4 15 0 - YES + NO 0 - {478, 215} - - - - + {{1, 1}, {478, 53}} + + + + + 4 + MSAwLjE0MDAwMDAwMDYAA + 4 - - + + -2147483392 {{-100, -100}, {15, 120}} - + + YES 2 - + _doScroller: 0.99253731966018677 - - + + -2147483392 {{-100, -100}, {225, 15}} - + 1 - + _doScroller: 0.57142859697341919 - {{1, 55}, {478, 215}} + {480, 55} - - 560 - - - - QSAAAEEgAABBsAAAQbAAAA + + 65 + + + + QSAAAEEgAABEeoAARHqAAA 289 - {{380, 10}, {81, 28}} + {{380, 13}, {81, 28}} YES @@ -9387,7 +9485,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 289 - {{293, 10}, {81, 28}} + {{293, 13}, {81, 28}} YES @@ -9427,13 +9525,13 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 274 - {478, 87} + {480, 87} YES 256 - {478, 17} + {480, 17} @@ -9446,7 +9544,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 YES - 475 + 477 40 1000 @@ -9494,7 +9592,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1 - {{1, 17}, {478, 87}} + {{1, 17}, {480, 87}} @@ -9530,7 +9628,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 YES - {{1, 0}, {478, 17}} + {{1, 0}, {480, 17}} @@ -9539,7 +9637,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 - {480, 105} + {482, 105} 562 @@ -9551,7 +9649,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 QSAAAEEgAABBkAAAQZAAAA - {480, 106} + {482, 106} NSView @@ -9596,7 +9694,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 public.url - {478, 14} + {480, 14} @@ -9614,7 +9712,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 - 478 + 480 1 @@ -9657,12 +9755,12 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 6 - {478, 1e+07} + {480, 1e+07} {197, 4} - {{1, 1}, {478, 106}} + {{1, 1}, {480, 106}} @@ -9692,7 +9790,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 0.94565218687057495 - {480, 108} + {482, 108} 562 @@ -9701,12 +9799,12 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 - {{0, 107}, {480, 108}} + {{0, 107}, {482, 108}} NSView - {{0, 55}, {480, 215}} + {{-1, 55}, {482, 215}} 2 @@ -9739,7 +9837,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 292 - {{68, 27}, {158, 18}} + {{68, 25}, {158, 18}} YES @@ -9758,10 +9856,32 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 25 + + + 289 + {{302, 3}, {158, 18}} + + YES + + 67239424 + 131072 + Search while typing + + + 1211912703 + 268435586 + + + + t + 200 + 25 + + 292 - {{68, 9}, {158, 18}} + {{68, 7}, {158, 18}} YES @@ -9783,7 +9903,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 292 - {{14, 13}, {49, 31}} + {{18, 11}, {46, 31}} YES @@ -9866,9 +9986,9 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 + YES - 4 YES 1 YES @@ -9876,11 +9996,11 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 - {480, 270} + {480, 269} {{0, 0}, {1280, 778}} - {340, 189} + {380, 192} {3.40282e+38, 3.40282e+38} SPTableFilterPanel @@ -15402,14 +15522,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 7526 - - - filterTableWindow - - - - 7528 - filterTableWhereClause @@ -15442,14 +15554,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 7532 - - - showTableFilter: - - - - 7535 - initialFirstResponder @@ -15538,6 +15642,38 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 7582 + + + showFilterTable: + + + + 7586 + + + + filterTableLiveSearchCheckbox + + + + 7587 + + + + delegate + + + + 7588 + + + + filterTableWindow + + + + 7589 + @@ -21581,13 +21717,14 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 YES - - + + + @@ -21619,32 +21756,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 - - 7507 - - - YES - - - - - - - - 7508 - - - - - 7509 - - - - - 7510 - - - 7511 @@ -21847,6 +21958,64 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 + + 7583 + + + YES + + + + + + 7584 + + + + + 7602 + + + YES + + + + + + + + 7603 + + + + + 7604 + + + + + 7605 + + + YES + + + + + + 7606 + + + YES + + + + + + 7607 + + + @@ -23072,10 +23241,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 7505.IBPluginDependency 7506.IBAttributePlaceholdersKey 7506.IBPluginDependency - 7507.IBPluginDependency - 7508.IBPluginDependency - 7509.IBPluginDependency - 7510.IBPluginDependency 7511.IBPluginDependency 7512.IBPluginDependency 7513.IBPluginDependency @@ -23110,6 +23275,15 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 7577.IBAttributePlaceholdersKey 7577.IBPluginDependency 7578.IBPluginDependency + 7583.IBAttributePlaceholdersKey + 7583.IBPluginDependency + 7584.IBPluginDependency + 7602.IBPluginDependency + 7603.IBPluginDependency + 7604.IBPluginDependency + 7605.IBPluginDependency + 7606.IBPluginDependency + 7607.IBPluginDependency 858.IBPluginDependency 858.ImportedFromIB2 959.IBEditorWindowLastContentRect @@ -24757,12 +24931,12 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{85, 438}, {480, 270}} + {{87, 342}, {480, 269}} com.apple.InterfaceBuilder.CocoaPlugin - {{85, 438}, {480, 270}} + {{87, 342}, {480, 269}} - {340, 170} + {380, 170} com.apple.InterfaceBuilder.CocoaPlugin com.brandonwalkin.BWToolkit @@ -24787,10 +24961,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 com.brandonwalkin.BWToolkit com.brandonwalkin.BWToolkit com.brandonwalkin.BWToolkit - com.brandonwalkin.BWToolkit - com.brandonwalkin.BWToolkit - com.brandonwalkin.BWToolkit - com.brandonwalkin.BWToolkit com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -24818,7 +24988,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 com.brandonwalkin.BWToolkit com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{88, 384}, {228, 98}} + {{63, 420}, {228, 98}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -24835,6 +25005,22 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 com.brandonwalkin.BWToolkit com.brandonwalkin.BWToolkit + + ToolTip + + ToolTip + + If set negate entire WHERE clause (⌘N) + + + com.brandonwalkin.BWToolkit + com.brandonwalkin.BWToolkit + com.brandonwalkin.BWToolkit + com.brandonwalkin.BWToolkit + com.brandonwalkin.BWToolkit + com.brandonwalkin.BWToolkit + com.brandonwalkin.BWToolkit + com.brandonwalkin.BWToolkit com.apple.InterfaceBuilder.CocoaPlugin {{265, 489}, {405, 267}} @@ -24873,7 +25059,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 - 7582 + 7607 @@ -30247,10 +30433,9 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 removeRow: setCompareTypes: setDefaultOperator: - showTableFilter: + showFilterTable: swapFilterTable: tableFilterClear: - tableFilterExecute: toggleDistinctSelect: toggleFilterField: toggleLookAllFieldsMode: @@ -30275,7 +30460,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 id id id - id @@ -30290,10 +30474,9 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 removeRow: setCompareTypes: setDefaultOperator: - showTableFilter: + showFilterTable: swapFilterTable: tableFilterClear: - tableFilterExecute: toggleDistinctSelect: toggleFilterField: toggleLookAllFieldsMode: @@ -30335,7 +30518,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 id - showTableFilter: + showFilterTable: id @@ -30346,10 +30529,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 tableFilterClear: id - - tableFilterExecute: - id - toggleDistinctSelect: id @@ -30390,6 +30569,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 filterTableDistinctCheckbox filterTableFilterButton filterTableGearLookAllFields + filterTableLiveSearchCheckbox filterTableNegateCheckbox filterTableView filterTableWhereClause @@ -30433,9 +30613,10 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 NSButton NSMenuItem id + id SPCopyTable SPTextView - NSPanel + NSWindow id id id @@ -30477,6 +30658,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 filterTableDistinctCheckbox filterTableFilterButton filterTableGearLookAllFields + filterTableLiveSearchCheckbox filterTableNegateCheckbox filterTableView filterTableWhereClause @@ -30561,6 +30743,10 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 filterTableGearLookAllFields NSMenuItem + + filterTableLiveSearchCheckbox + id + filterTableNegateCheckbox id @@ -30575,7 +30761,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 filterTableWindow - NSPanel + NSWindow firstBetweenField @@ -31788,7 +31974,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 YES - {15, 15} + {10, 10} {8, 8} {32, 32} {128, 128} diff --git a/Source/SPTableContent.h b/Source/SPTableContent.h index 8e5b7af7..7a30ee76 100644 --- a/Source/SPTableContent.h +++ b/Source/SPTableContent.h @@ -67,12 +67,13 @@ IBOutlet NSStepper *paginationPageStepper; IBOutlet SPCopyTable *filterTableView; - IBOutlet NSPanel *filterTableWindow; + IBOutlet NSWindow *filterTableWindow; IBOutlet NSButton *filterTableFilterButton; IBOutlet NSButton *filterTableClearButton; IBOutlet SPTextView *filterTableWhereClause; IBOutlet id filterTableNegateCheckbox; IBOutlet id filterTableDistinctCheckbox; + IBOutlet id filterTableLiveSearchCheckbox; IBOutlet NSMenuItem *filterTableGearLookAllFields; MCPConnection *mySQLConnection; @@ -160,9 +161,8 @@ - (IBAction)removeRow:(id)sender; // Filter Table -- (IBAction)tableFilterExecute:(id)sender; - (IBAction)tableFilterClear:(id)sender; -- (IBAction)showTableFilter:(id)sender; +- (IBAction)showFilterTable:(id)sender; - (IBAction)toggleNegateClause:(id)sender; - (IBAction)toggleDistinctSelect:(id)sender; - (IBAction)setDefaultOperator:(id)sender; diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index d72a17dd..73441466 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -174,6 +174,7 @@ // Init Filter Table GUI [filterTableDistinctCheckbox setState:(filterTableDistinct) ? NSOnState : NSOffState]; [filterTableNegateCheckbox setState:(filterTableNegate) ? NSOnState : NSOffState]; + [filterTableLiveSearchCheckbox setState:NSOffState]; filterTableDefaultOperator = @"LIKE '%%%@%%'"; // Add observers for document task activity @@ -738,15 +739,22 @@ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance]; if ([mySQLConnection queryErrored] && ![mySQLConnection queryCancelled]) { - if(filterString) - SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [tableDocumentInstance parentWindow], self, nil, nil, - [NSString stringWithFormat:NSLocalizedString(@"The table data couldn't be loaded presumably due to used filter clause. \n\nMySQL said: %@", @"message of panel when loading of table failed and presumably due to used filter argument"), [mySQLConnection getLastErrorMessage]]); - else - SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [tableDocumentInstance parentWindow], self, nil, nil, - [NSString stringWithFormat:NSLocalizedString(@"The table data couldn't be loaded.\n\nMySQL said: %@", @"message of panel when loading of table failed"), [mySQLConnection getLastErrorMessage]]); + if(activeFilter == 0) { + if(filterString) + SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [tableDocumentInstance parentWindow], self, nil, nil, + [NSString stringWithFormat:NSLocalizedString(@"The table data couldn't be loaded presumably due to used filter clause. \n\nMySQL said: %@", @"message of panel when loading of table failed and presumably due to used filter argument"), [mySQLConnection getLastErrorMessage]]); + else + SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [tableDocumentInstance parentWindow], self, nil, nil, + [NSString stringWithFormat:NSLocalizedString(@"The table data couldn't be loaded.\n\nMySQL said: %@", @"message of panel when loading of table failed"), [mySQLConnection getLastErrorMessage]]); + } + // Filter task came from filter table + else if(activeFilter == 1){ + [filterTableWindow setTitle:[NSString stringWithFormat:@"%@ – %@", NSLocalizedString(@"Filter", @"filter table window title"), NSLocalizedString(@"WHERE clause not valid", @"WHERE clause not valid")]]; + } } else { // Trigger a full reload if required if (fullTableReloadRequired) [self reloadTable:self]; + [filterTableWindow setTitle:NSLocalizedString(@"Filter", @"filter table window title")]; } } @@ -2825,26 +2833,35 @@ #pragma mark - #pragma mark Filter Table -- (IBAction)tableFilterExecute:(id)sender -{ - -} - +/** + * Clear the filter table + */ - (IBAction)tableFilterClear:(id)sender { [filterTableView abortEditing]; - for(NSNumber *col in [filterTableData allKeys]) - [[filterTableData objectForKey:col] setObject:[NSMutableArray arrayWithObjects:@"", @"", @"", @"", @"", @"", @"", @"", @"", @"", nil] forKey:@"filter"]; + if(filterTableData && [filterTableData count]) { - [filterTableView reloadData]; - [filterTableView selectRowIndexes:[NSIndexSet indexSetWithIndex:0] byExtendingSelection:NO]; - [filterTableWhereClause setString:@""]; + // Clear filter data + for(NSNumber *col in [filterTableData allKeys]) + [[filterTableData objectForKey:col] setObject:[NSMutableArray arrayWithObjects:@"", @"", @"", @"", @"", @"", @"", @"", @"", @"", nil] forKey:@"filter"]; + + [filterTableView reloadData]; + [filterTableView selectRowIndexes:[NSIndexSet indexSetWithIndex:0] byExtendingSelection:NO]; + [filterTableWhereClause setString:@""]; + + // Reload table + [self filterTable:nil]; + + } } -- (IBAction)showTableFilter:(id)sender +/** + * Show filter table + */ +- (IBAction)showFilterTable:(id)sender { [filterTableWindow makeKeyAndOrderFront:nil]; [filterTableWhereClause setContinuousSpellCheckingEnabled:NO]; @@ -2859,16 +2876,35 @@ [[tableDocumentInstance parentWindow] makeFirstResponder:filterTableView]; } +/** + * Set filter table's Negate + */ - (IBAction)toggleNegateClause:(id)sender { filterTableNegate = !filterTableNegate; + + // If live search is set perform filtering + if([filterTableLiveSearchCheckbox state] == NSOnState) + [self filterTable:filterTableFilterButton]; + } +/** + * Set filter table's Distinct + */ - (IBAction)toggleDistinctSelect:(id)sender { filterTableDistinct = !filterTableDistinct; + + // If live search is set perform filtering + if([filterTableLiveSearchCheckbox state] == NSOnState) + [self filterTable:filterTableFilterButton]; + } +/** + * Set filter table's default operator + */ - (IBAction)setDefaultOperator:(id)sender { NSLog(@"DEFAULT"); @@ -2879,9 +2915,17 @@ NSLog(@"SWAP"); } +/** + * Generate WHERE clause to look for last typed pattern in all fields + */ - (IBAction)toggleLookAllFieldsMode:(id)sender { [self updateFilterTableClause:sender]; + + // If live search is set perform filtering + if([filterTableLiveSearchCheckbox state] == NSOnState) + [self filterTable:filterTableFilterButton]; + } #pragma mark - @@ -4120,10 +4164,21 @@ if(currentValue == nil) { filterCell = NSArrayObjectAtIndex([filterCellData objectForKey:@"filter"], i); } else if(lookInAllFields) { - if(lastEditedFilterTableValue && [lastEditedFilterTableValue length]) + if(lastEditedFilterTableValue && [lastEditedFilterTableValue length]) { + filterCell = lastEditedFilterTableValue; - else - break; + + } else { + + [filterTableWhereClause setString:@""]; + [filterTableWhereClause insertText:@""]; + [filterTableWhereClause scrollRangeToVisible:NSMakeRange(0, 0)]; + + // If live search is set perform filtering + if([filterTableLiveSearchCheckbox state] == NSOnState) + [self filterTable:filterTableFilterButton]; + + } } else if([currentValue isKindOfClass:[NSString class]]){ if(index == [filterTableView editedColumn] && i == [filterTableView editedRow]) filterCell = (NSString*)currentValue; @@ -4179,12 +4234,20 @@ if(numberOfValues) [clause appendString:@"\nOR\n"]; } + + // Remove last " OR " if any if([clause length] > 3) [filterTableWhereClause setString:[clause substringToIndex:([clause length]-4)]]; else [filterTableWhereClause setString:@""]; + + // Update syntax highlighting and uppercasing [filterTableWhereClause insertText:@""]; [filterTableWhereClause scrollRangeToVisible:NSMakeRange(0, 0)]; + + // If live search is set perform filtering + if([filterTableLiveSearchCheckbox state] == NSOnState) + [self filterTable:filterTableFilterButton]; } /** diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m index 9f409e57..c9192147 100644 --- a/Source/SPTablesList.m +++ b/Source/SPTablesList.m @@ -1516,6 +1516,9 @@ - (void)tableViewSelectionDidChange:(NSNotification *)aNotification { + // Clear Content's Filter Table + [tableContentInstance tableFilterClear:nil]; + if([tablesListView selectedRow] < 0) { // Reset all if (selectedTableName) [selectedTableName release]; -- cgit v1.2.3