aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-08-23 17:22:40 +0000
committerBibiko <bibiko@eva.mpg.de>2009-08-23 17:22:40 +0000
commitc636a4d36f0fd1b3749ee6de77452e9491030313 (patch)
tree3d747d5cfc6d18c32722f8fea0b62130c0d15135
parent8d419d7f623067a9cf4dbe9330dd4785721c2e58 (diff)
downloadsequelpro-c636a4d36f0fd1b3749ee6de77452e9491030313.tar.gz
sequelpro-c636a4d36f0fd1b3749ee6de77452e9491030313.tar.bz2
sequelpro-c636a4d36f0fd1b3749ee6de77452e9491030313.zip
• modified SPHistoryController to handle the new BETWEEN operator
• after changing the operator in TableContent set focus to first argument field
-rw-r--r--Source/TableContent.h2
-rw-r--r--Source/TableContent.m17
2 files changed, 15 insertions, 4 deletions
diff --git a/Source/TableContent.h b/Source/TableContent.h
index 03aaeafa..98360660 100644
--- a/Source/TableContent.h
+++ b/Source/TableContent.h
@@ -72,7 +72,7 @@
unsigned int limitStartPositionToRestore;
NSIndexSet *selectionIndexToRestore;
NSRect selectionViewportToRestore;
- NSString *filterFieldToRestore, *filterComparisonToRestore, *filterValueToRestore;
+ NSString *filterFieldToRestore, *filterComparisonToRestore, *filterValueToRestore, *betweenFilterValueToRestore;
}
// Table loading methods and information
diff --git a/Source/TableContent.m b/Source/TableContent.m
index 9437d42b..a60a8582 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -74,6 +74,7 @@
filterFieldToRestore = nil;
filterComparisonToRestore = nil;
filterValueToRestore = nil;
+ betweenFilterValueToRestore = nil;
isFiltered = NO;
isLimited = NO;
@@ -321,7 +322,9 @@
|| [compareField itemWithTitle:filterComparisonToRestore]))
{
if (filterComparisonToRestore) [compareField selectItemWithTitle:filterComparisonToRestore];
+ [self toggleFilterField:self];
if (filterValueToRestore) [argumentField setStringValue:filterValueToRestore];
+ if (betweenFilterValueToRestore) [betweenTextField setStringValue:betweenFilterValueToRestore];
}
}
@@ -699,7 +702,7 @@
/*
* Update the table count/selection text
*/
-- (void) updateCountText
+- (void)updateCountText
{
NSString *rowString;
NSMutableString *countString = [NSMutableString string];
@@ -805,16 +808,19 @@
[secondBetweenField setHidden:NO];
[firstBetweenField setEnabled:YES];
[secondBetweenField setEnabled:YES];
+ [firstBetweenField selectText:self];
}
else {
[argumentField setHidden:NO];
[betweenTextField setHidden:YES];
[firstBetweenField setHidden:YES];
[secondBetweenField setHidden:YES];
+ [argumentField selectText:self];
}
-
+
// If the user is filtering for NULLs then disable the filter field, otherwise enable it.
[argumentField setEnabled:(![[[compareField selectedItem] title] hasSuffix:@"NULL"])];
+
}
- (NSString *)usedQuery
@@ -1740,6 +1746,7 @@
[[compareField selectedItem] title], @"filterComparison",
[NSNumber numberWithInt:[[compareField selectedItem] tag]], @"filterComparisonTag",
[argumentField stringValue], @"filterValue",
+ [betweenTextField stringValue], @"betweenFilterValue",
nil];
return theDictionary;
@@ -1792,6 +1799,7 @@
if (filterFieldToRestore) [filterFieldToRestore release], filterFieldToRestore = nil;
if (filterComparisonToRestore) [filterComparisonToRestore release], filterComparisonToRestore = nil;
if (filterValueToRestore) [filterValueToRestore release], filterValueToRestore = nil;
+ if (betweenFilterValueToRestore) [betweenFilterValueToRestore release], betweenFilterValueToRestore = nil;
if (filterSettings) {
if ([filterSettings objectForKey:@"filterField"])
@@ -1800,6 +1808,8 @@
filterComparisonToRestore = [[NSString alloc] initWithString:[filterSettings objectForKey:@"filterComparison"]];
if ([filterSettings objectForKey:@"filterValue"])
filterValueToRestore = [[NSString alloc] initWithString:[filterSettings objectForKey:@"filterValue"]];
+ if ([filterSettings objectForKey:@"betweenFilterValue"])
+ betweenFilterValueToRestore = [[NSString alloc] initWithString:[filterSettings objectForKey:@"filterValue"]];
}
}
@@ -2362,7 +2372,8 @@
if (filterFieldToRestore) filterFieldToRestore = nil;
if (filterComparisonToRestore) filterComparisonToRestore = nil;
if (filterValueToRestore) filterValueToRestore = nil;
-
+ if (betweenFilterValueToRestore) betweenFilterValueToRestore = nil;
+
[super dealloc];
}