diff options
author | rowanbeentje <rowan@beent.je> | 2012-12-23 20:59:18 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2012-12-23 20:59:18 +0000 |
commit | 714a06ae49c50e89638d67dcb39efbee630d3325 (patch) | |
tree | 79e3a5cd54e197f15f87d1d9ec36921fd3efff51 /Source | |
parent | c65704f3a87c14b9dbe16c976d7afcb0f175a63f (diff) | |
download | sequelpro-714a06ae49c50e89638d67dcb39efbee630d3325.tar.gz sequelpro-714a06ae49c50e89638d67dcb39efbee630d3325.tar.bz2 sequelpro-714a06ae49c50e89638d67dcb39efbee630d3325.zip |
Make some improvements to the Table Content Filter, particularly for text fields:
- Rename all "IS" entries to "=", to make the intended purpose clearer, and switch the underlying command to use "= BINARY" instead of "LIKE", producing an exact match instead of replicating LIKE functionality. Move LIKE p to just below the = options. This addresses Issue #1441.
- Add entries for "matches RegExp" and "does not match RegExp", implementing Issue #1508.
- When adding custom filters, add them by default to the Global group if the favourite isn't an on-disk document, addressing filter loss between sessions; this addresses Issue #1381
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPContentFilterManager.m | 20 | ||||
-rw-r--r-- | Source/SPTableContent.m | 2 |
2 files changed, 18 insertions, 4 deletions
diff --git a/Source/SPContentFilterManager.m b/Source/SPContentFilterManager.m index cf12ebe0..a0755b92 100644 --- a/Source/SPContentFilterManager.m +++ b/Source/SPContentFilterManager.m @@ -35,6 +35,7 @@ #import "RegexKitLite.h" #import "SPQueryController.h" #import "SPQueryDocumentsController.h" +#import "SPDatabaseDocument.h" #import "SPTableContent.h" #import "SPConnectionController.h" #import "SPSplitView.h" @@ -246,12 +247,25 @@ else filter = [NSMutableDictionary dictionaryWithObjects:[NSArray arrayWithObjects:NSLocalizedString(@"New Filter",@"Content Filter Manager : Initial name for new filter"), @"", @"", nil] forKeys:[NSArray arrayWithObjects:@"MenuLabel", @"Clause", @"ConjunctionLabel", nil]]; - if([contentFilterTableView numberOfSelectedRows] > 0) { + // If a favourite is currently selected, add the new favourite next to it + if ([contentFilterTableView numberOfSelectedRows] > 0) { insertIndex = [[contentFilterTableView selectedRowIndexes] lastIndex]+1; [contentFilters insertObject:filter atIndex:insertIndex]; - } else { - [contentFilters addObject:filter]; + } + + // If the DatabaseDocument is an on-disk document, add the favourite to the bottom of that document's favourites + else if (![tableDocumentInstance isUntitled]) { insertIndex = [contentFilters count] - 1; + [contentFilters addObject:filter]; + } + + // Otherwise, add to the bottom of the Global list by default + else { + insertIndex = 1; + while (![[contentFilters objectAtIndex:insertIndex] objectForKey:@"headerOfFileURL"]) { + insertIndex++; + } + [contentFilters insertObject:filter atIndex:insertIndex]; } [contentFilterArrayController rearrangeObjects]; diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index dceea288..71657916 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -444,7 +444,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper [fieldField addItemWithTitle:NSLocalizedString(@"field", @"popup menuitem for field (showing only if disabled)")]; [compareField setEnabled:NO]; [compareField removeAllItems]; - [compareField addItemWithTitle:NSLocalizedString(@"is", @"popup menuitem for field IS value")]; + [compareField addItemWithTitle:@"="]; [argumentField setHidden:NO]; [argumentField setEnabled:NO]; [firstBetweenField setEnabled:NO]; |