diff options
Diffstat (limited to 'Source/TableContent.m')
-rw-r--r-- | Source/TableContent.m | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/Source/TableContent.m b/Source/TableContent.m index 369cfaec..f5b0fa47 100644 --- a/Source/TableContent.m +++ b/Source/TableContent.m @@ -774,7 +774,7 @@ - (IBAction)toggleFilterField:(id)sender { - // Check if user called "Edit filter…" + // Check if user called "Edit Filter…" if([[compareField selectedItem] tag] == [[contentFilters objectForKey:compareType] count]) { [self openContentFilterManager]; return; @@ -784,10 +784,11 @@ lastSelectedContentFilterIndex = [[compareField selectedItem] tag]; NSDictionary *filter = [[contentFilters objectForKey:compareType] objectAtIndex:lastSelectedContentFilterIndex]; + NSUInteger numOfArgs = [[filter objectForKey:@"NumberOfArguments"] intValue]; if ([[filter objectForKey:@"NumberOfArguments"] intValue] == 2) { [argumentField setHidden:YES]; - if([filter objectForKey:@"ConjunctionLabels"] && [[filter objectForKey:@"ConjunctionLabels"] count] == 1) + if(numOfArgs == 1) [betweenTextField setStringValue:[[filter objectForKey:@"ConjunctionLabels"] objectAtIndex:0]]; [betweenTextField setHidden:NO]; [firstBetweenField setHidden:NO]; @@ -797,7 +798,7 @@ [secondBetweenField setEnabled:YES]; [firstBetweenField selectText:self]; } - else if ([[filter objectForKey:@"NumberOfArguments"] intValue] == 1){ + else if (numOfArgs == 1){ [argumentField setHidden:NO]; [argumentField setEnabled:YES]; [argumentField selectText:self]; @@ -815,7 +816,8 @@ [secondBetweenField setHidden:YES]; // Start search if no argument is required - [self filterTable:self]; + if(numOfArgs == 0) + [self filterTable:self]; } } @@ -1200,7 +1202,7 @@ } } - // Load user-defined content filters + // Load global user-defined content filters if([prefs objectForKey:@"ContentFilters"] && [contentFilters objectForKey:compareType] && [[prefs objectForKey:@"ContentFilters"] objectForKey:compareType]) @@ -1208,6 +1210,13 @@ [[contentFilters objectForKey:compareType] addObjectsFromArray:[[prefs objectForKey:@"ContentFilters"] objectForKey:compareType]]; } + // Load doc-based user-defined content filters + if([[SPQueryController sharedQueryController] contentFilterForFileURL:[tableDocumentInstance fileURL]]) { + id filters = [[SPQueryController sharedQueryController] contentFilterForFileURL:[tableDocumentInstance fileURL]]; + if([filters objectForKey:compareType]) + [[contentFilters objectForKey:compareType] addObjectsFromArray:[filters objectForKey:compareType]]; + } + // Rebuild operator popup menu NSUInteger i = 0; NSMenu *menu = [compareField menu]; @@ -1255,9 +1264,6 @@ { [compareField selectItemWithTag:lastSelectedContentFilterIndex]; - [SPTooltip showWithObject:@"<h1><font color='#0000FB'> Please be patient. Under constructions. <span style='font-size:50pt'>☺</span> </font></h1>" atLocation:[NSEvent mouseLocation] ofType:@"html"]; - return; - // init query favorites controller [prefs synchronize]; if(contentFilterManager) [contentFilterManager release]; @@ -1858,6 +1864,7 @@ if (![fieldField isEnabled]) return nil; theDictionary = [NSDictionary dictionaryWithObjectsAndKeys: + [self tableFilterString], @"menuLabel", [[fieldField selectedItem] title], @"filterField", [[compareField selectedItem] title], @"filterComparison", [NSNumber numberWithInt:[[compareField selectedItem] tag]], @"filterComparisonTag", |