aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTablesList.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-03-07 20:12:52 +0000
committerstuconnolly <stuart02@gmail.com>2011-03-07 20:12:52 +0000
commit1e5288e9840e201a00bcb5ca3035d7aa807f1f8d (patch)
tree0c1a47953f57b71c41cc7a63e156629c6c9d645b /Source/SPTablesList.m
parent915a3831525bf3a9350648d82f86dd54ae366292 (diff)
downloadsequelpro-1e5288e9840e201a00bcb5ca3035d7aa807f1f8d.tar.gz
sequelpro-1e5288e9840e201a00bcb5ca3035d7aa807f1f8d.tar.bz2
sequelpro-1e5288e9840e201a00bcb5ca3035d7aa807f1f8d.zip
Bring outline view branch up to date with trunk (r3203:r3224).
Diffstat (limited to 'Source/SPTablesList.m')
-rw-r--r--Source/SPTablesList.m24
1 files changed, 17 insertions, 7 deletions
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m
index a0a9bf92..cc840e30 100644
--- a/Source/SPTablesList.m
+++ b/Source/SPTablesList.m
@@ -25,6 +25,7 @@
#import "SPTablesList.h"
#import "SPDatabaseDocument.h"
+#import "SPDatabaseViewController.h"
#import "SPTableStructure.h"
#import "SPTableContent.h"
#import "SPTableData.h"
@@ -62,18 +63,21 @@
{
MCPResult *theResult;
NSArray *resultRow;
- NSInteger i;
+ NSUInteger 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 +260,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 +278,7 @@
}
if (previousSelectedTable) [previousSelectedTable release];
+ if (previousFilterString) [previousFilterString release];
// Query the structure of all databases in the background
if (sender == self)
@@ -1219,7 +1230,6 @@
- (BOOL)selectItemsWithNames:(NSArray *)theNames
{
NSInteger i, tableType;
- NSInteger itemIndex = NSNotFound;
NSMutableIndexSet *selectionIndexSet = [NSMutableIndexSet indexSet];
// Loop through the unfiltered tables/views to find the desired item