aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2011-02-20 20:59:01 +0000
committerrowanbeentje <rowan@beent.je>2011-02-20 20:59:01 +0000
commit73f0f83a2eb41874212c7165bfd535bdf607d5b0 (patch)
tree05d206333285b02a7e51513227f3b969168c978f /Source
parent877d17d13ed242203393a4cf3d35231674bcb78a (diff)
downloadsequelpro-73f0f83a2eb41874212c7165bfd535bdf607d5b0.tar.gz
sequelpro-73f0f83a2eb41874212c7165bfd535bdf607d5b0.tar.bz2
sequelpro-73f0f83a2eb41874212c7165bfd535bdf607d5b0.zip
- Preserve the current filter string when refreshing the table list if one is set. This also fixes the filter text being reset when performing a SQL export.
Diffstat (limited to 'Source')
-rw-r--r--Source/SPTablesList.m20
1 files changed, 15 insertions, 5 deletions
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m
index a0a9bf92..79df1a4d 100644
--- a/Source/SPTablesList.m
+++ b/Source/SPTablesList.m
@@ -64,16 +64,19 @@
NSArray *resultRow;
NSInteger i;
NSString *previousSelectedTable = nil;
+ NSString *previousFilterString = nil;
BOOL previousTableListIsSelectable = tableListIsSelectable;
BOOL changeEncoding = ![[mySQLConnection encoding] isEqualToString:@"utf8"];
if (selectedTableName) previousSelectedTable = [[NSString alloc] initWithString:selectedTableName];
if (isTableListFiltered) {
+ previousFilterString = [[NSString alloc] initWithString:[listFilterField stringValue]];
if (filteredTables) [filteredTables release];
filteredTables = tables;
if (filteredTableTypes) [filteredTableTypes release];
filteredTableTypes = tableTypes;
isTableListFiltered = NO;
+ [[self onMainThread] clearFilter];
}
tableListContainsViews = NO;
@@ -256,11 +259,17 @@
selectedTableType = SPTableTypeNone;
}
- // Determine whether or not to show the list filter based on the number of tables, and clear it
- [[self onMainThread] clearFilter];
-
- if ([tables count] > 20) [self showFilter];
- else [self hideFilter];
+ // Determine whether or not to preserve the existing filter, and whether to
+ // show or hide the list filter based on the number of tables
+ if ([tables count] > 20) {
+ [self showFilter];
+ if (previousFilterString) {
+ [[listFilterField onMainThread] setStringValue:previousFilterString];
+ [[self onMainThread] updateFilter:self];
+ }
+ } else {
+ [self hideFilter];
+ }
// Set the filter placeholder text
if ([tableDocumentInstance database]) {
@@ -268,6 +277,7 @@
}
if (previousSelectedTable) [previousSelectedTable release];
+ if (previousFilterString) [previousFilterString release];
// Query the structure of all databases in the background
if (sender == self)