From f51f2b3d87a59a94d5bc16850debfec5128b50ed Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Thu, 25 Nov 2010 01:16:43 +0000 Subject: - Fix interface updates when multiple tables are selected --- Source/SPDatabaseViewController.m | 6 ++---- Source/SPTablesList.h | 2 +- Source/SPTablesList.m | 5 ++++- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'Source') diff --git a/Source/SPDatabaseViewController.m b/Source/SPDatabaseViewController.m index 0ea8216e..c1b1bdbf 100644 --- a/Source/SPDatabaseViewController.m +++ b/Source/SPDatabaseViewController.m @@ -276,9 +276,7 @@ selectedTableType = SPTableTypeNone; // Clear the views - if ([[tablesListInstance selectedTableNames] count] == 1) { - [[tablesListInstance onMainThread] setSelection:nil]; - } + [[tablesListInstance onMainThread] setSelectionState:nil]; [tableSourceInstance loadTable:nil]; [tableContentInstance loadTable:nil]; [[extendedTableInfoInstance onMainThread] loadTable:nil]; @@ -315,7 +313,7 @@ } // Update the tables list interface - also updates menus to reflect the selected table type - [[tablesListInstance onMainThread] setSelection:[NSDictionary dictionaryWithObjectsAndKeys:aTable, @"name", [NSNumber numberWithInteger:aTableType], @"type", nil]]; + [[tablesListInstance onMainThread] setSelectionState:[NSDictionary dictionaryWithObjectsAndKeys:aTable, @"name", [NSNumber numberWithInteger:aTableType], @"type", nil]]; // If on the main thread, fire up a thread to deal with view changes and data loading; // if already on a background thread, make the changes on the existing thread. diff --git a/Source/SPTablesList.h b/Source/SPTablesList.h index 8487358d..e53fb178 100644 --- a/Source/SPTablesList.h +++ b/Source/SPTablesList.h @@ -119,7 +119,7 @@ // Additional methods - (void)setConnection:(MCPConnection *)theConnection; - (void)doPerformQueryService:(NSString *)query; -- (void)setSelection:(NSDictionary *)selectionDetails; +- (void)setSelectionState:(NSDictionary *)selectionDetails; - (void)selectTableAtIndex:(NSNumber *)row; - (void)makeTableListFilterHaveFocus; diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m index 2071f793..45999ea1 100644 --- a/Source/SPTablesList.m +++ b/Source/SPTablesList.m @@ -685,12 +685,14 @@ } /** + * Updates application state to match the current selection, including + * updating the interface selection if appropriate. * Takes a dictionary of selection details, containing the selection name * and type, and updates stored variables and the table list interface to * match. * Should be called on the main thread. */ -- (void)setSelection:(NSDictionary *)selectionDetails +- (void)setSelectionState:(NSDictionary *)selectionDetails { // First handle empty or multiple selections if (!selectionDetails || ![selectionDetails objectForKey:@"name"]) { @@ -1390,6 +1392,7 @@ // Ensure the state is cleared if ([tableDocumentInstance table]) [tableDocumentInstance loadTable:nil ofType:SPTableTypeNone]; + else [self setSelectionState:nil]; if (selectedTableName) [selectedTableName release], selectedTableName = nil; selectedTableType = SPTableTypeNone; return; -- cgit v1.2.3