diff options
author | Max <dmoagx@users.noreply.github.com> | 2018-05-11 00:38:35 +0200 |
---|---|---|
committer | Max <dmoagx@users.noreply.github.com> | 2018-05-11 00:38:35 +0200 |
commit | 1ac52c38f1b819fa28610c74661a5fd4dbab21f9 (patch) | |
tree | 65e669d3e812b7804b4db4bc16dcc35f971db67e /Source/SPTableContentFilterController.m | |
parent | 1318bce4cd58d8aaa31c6c386c6b709713e1dde9 (diff) | |
download | sequelpro-1ac52c38f1b819fa28610c74661a5fd4dbab21f9.tar.gz sequelpro-1ac52c38f1b819fa28610c74661a5fd4dbab21f9.tar.bz2 sequelpro-1ac52c38f1b819fa28610c74661a5fd4dbab21f9.zip |
#63: Move some UI around and add proper icon
Clarify some variable names
Diffstat (limited to 'Source/SPTableContentFilterController.m')
-rw-r--r-- | Source/SPTableContentFilterController.m | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/Source/SPTableContentFilterController.m b/Source/SPTableContentFilterController.m index c8efa952..a2d6b2d2 100644 --- a/Source/SPTableContentFilterController.m +++ b/Source/SPTableContentFilterController.m @@ -186,6 +186,7 @@ static void _addIfNotNil(NSMutableArray *array, id toAdd); - (BOOL)_focusOnFieldInSubtree:(NSDictionary *)dict; - (void)_resize; - (void)openContentFilterManagerForFilterType:(NSString *)filterType; +- (IBAction)filterTable:(id)sender; @end @@ -305,6 +306,9 @@ static void _addIfNotNil(NSMutableArray *array, id toAdd); // make the rule editor reload the criteria [filterRuleEditor reloadCriteria]; + + // disable UI if no criteria exist + [self setEnabled:([columns count] != 0)]; } - (NSInteger)ruleEditor:(NSRuleEditor *)editor numberOfChildrenForCriterion:(nullable id)criterion withRowType:(NSRuleEditorRowType)rowType @@ -472,10 +476,15 @@ static void _addIfNotNil(NSMutableArray *array, id toAdd); // if the action was caused by pressing return or enter, trigger filtering NSEvent *event = [NSApp currentEvent]; if(event && [event type] == NSKeyDown && ([event keyCode] == 36 || [event keyCode] == 76)) { - if(target && action) [target performSelector:action withObject:self]; + [self filterTable:nil]; } } +- (IBAction)filterTable:(id)sender +{ + if(target && action) [target performSelector:action withObject:self]; +} + - (void)_resize { // The situation with the sizing is a bit f'ed up: @@ -740,6 +749,18 @@ static void _addIfNotNil(NSMutableArray *array, id toAdd); return filterRuleEditor; } +- (BOOL)isEnabled +{ + return enabled; +} + +- (void)setEnabled:(BOOL)_enabled +{ + enabled = _enabled; + [filterButton setEnabled:_enabled]; + [filterRuleEditor setEnabled:_enabled]; +} + - (NSString *)sqlWhereExpressionWithBinary:(BOOL)isBINARY error:(NSError **)err { NSMutableString *filterString = [[NSMutableString alloc] init]; @@ -926,7 +947,7 @@ void _addIfNotNil(NSMutableArray *array, id toAdd) NSString *curFilterType = [[op settings] objectForKey:@"filterType"]; NSString *serFilterType = [serialized objectForKey:SerFilterExprType]; // this is optional if(serFilterType && ![curFilterType isEqualToString:serFilterType]) { - SPLog(@"mistmatch in filter types for operator %@: current=%@, serialized=%@",op,curFilterType,serFilterType); + SPLog(@"mismatch in filter types for operator %@: current=%@, serialized=%@",op,curFilterType,serFilterType); goto fail; } |