diff options
author | stuconnolly <stuart02@gmail.com> | 2010-09-27 13:17:00 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2010-09-27 13:17:00 +0000 |
commit | f8ffeabf18d766c4072a9ddc672b24b631db96b8 (patch) | |
tree | fbfb6392c4536b40d19dae9dae0dd23b77d083d6 /Source | |
parent | 4923715783e20c4c1cf0a727d430d88c2f91ea7f (diff) | |
download | sequelpro-f8ffeabf18d766c4072a9ddc672b24b631db96b8.tar.gz sequelpro-f8ffeabf18d766c4072a9ddc672b24b631db96b8.tar.bz2 sequelpro-f8ffeabf18d766c4072a9ddc672b24b631db96b8.zip |
When checking for DB changes during an export, don't refresh the table list, which results in wiping the user's selection. Fix for issue #832.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPExportController.m | 110 |
1 files changed, 51 insertions, 59 deletions
diff --git a/Source/SPExportController.m b/Source/SPExportController.m index 1ae22ed9..55a5bbc8 100644 --- a/Source/SPExportController.m +++ b/Source/SPExportController.m @@ -41,7 +41,6 @@ - (void)_switchTab; - (void)_checkForDatabaseChanges; -- (NSUInteger)_refreshDatabaseTableList; - (void)_toggleExportButton:(id)uiStateDict; - (void)_toggleExportButtonOnBackgroundThread; @@ -376,7 +375,51 @@ */ - (IBAction)refreshTableList:(id)sender { - [self _refreshDatabaseTableList]; + [tables removeAllObjects]; + + // For all modes, retrieve table and view names + NSArray *tablesAndViews = [tablesListInstance allTableAndViewNames]; + + for (id itemName in tablesAndViews) { + [tables addObject:[NSMutableArray arrayWithObjects: + itemName, + [NSNumber numberWithBool:YES], + [NSNumber numberWithBool:YES], + [NSNumber numberWithBool:YES], + [NSNumber numberWithInt:SPTableTypeTable], + nil]]; + } + + // For SQL only, add procedures and functions + if (exportType == SPSQLExport) { + NSArray *procedures = [tablesListInstance allProcedureNames]; + + for (id procName in procedures) + { + [tables addObject:[NSMutableArray arrayWithObjects: + procName, + [NSNumber numberWithBool:YES], + [NSNumber numberWithBool:YES], + [NSNumber numberWithBool:YES], + [NSNumber numberWithInt:SPTableTypeProc], + nil]]; + } + + NSArray *functions = [tablesListInstance allFunctionNames]; + + for (id funcName in functions) + { + [tables addObject:[NSMutableArray arrayWithObjects: + funcName, + [NSNumber numberWithBool:YES], + [NSNumber numberWithBool:YES], + [NSNumber numberWithBool:YES], + [NSNumber numberWithInt:SPTableTypeFunc], + nil]]; + } + } + + [exportTableList reloadData]; } /** @@ -711,8 +754,13 @@ [tablesListInstance updateTables:self]; - NSUInteger j = [self _refreshDatabaseTableList]; + NSUInteger j = [[tablesListInstance allTableAndViewNames] count]; + // If this is an SQL export, include procs and functions + if (exportType == SPSQLExport) { + j += ([[tablesListInstance allProcedureNames] count] + [[tablesListInstance allFunctionNames] count]); + } + if (j > i) { NSUInteger diff = (j - i); @@ -728,62 +776,6 @@ } /** - * Refreshes the database table list. - * - * @return An unsigned integer indicating the number of items within the list. - */ -- (NSUInteger)_refreshDatabaseTableList -{ - [tables removeAllObjects]; - - // For all modes, retrieve table and view names - NSArray *tablesAndViews = [tablesListInstance allTableAndViewNames]; - - for (id itemName in tablesAndViews) { - [tables addObject:[NSMutableArray arrayWithObjects: - itemName, - [NSNumber numberWithBool:YES], - [NSNumber numberWithBool:YES], - [NSNumber numberWithBool:YES], - [NSNumber numberWithInt:SPTableTypeTable], - nil]]; - } - - // For SQL only, add procedures and functions - if (exportType == SPSQLExport) { - NSArray *procedures = [tablesListInstance allProcedureNames]; - - for (id procName in procedures) - { - [tables addObject:[NSMutableArray arrayWithObjects: - procName, - [NSNumber numberWithBool:YES], - [NSNumber numberWithBool:YES], - [NSNumber numberWithBool:YES], - [NSNumber numberWithInt:SPTableTypeProc], - nil]]; - } - - NSArray *functions = [tablesListInstance allFunctionNames]; - - for (id funcName in functions) - { - [tables addObject:[NSMutableArray arrayWithObjects: - funcName, - [NSNumber numberWithBool:YES], - [NSNumber numberWithBool:YES], - [NSNumber numberWithBool:YES], - [NSNumber numberWithInt:SPTableTypeFunc], - nil]]; - } - } - - [exportTableList reloadData]; - - return [tables count]; -} - -/** * Enables or disables the export button based on the state of various interface controls. * * @param uiStateDict A dictionary containing the state of various UI controls. |