From b4b81b2dd07674b7dc3208e3b79690f66b1bf113 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Tue, 14 Jun 2011 00:19:01 +0000 Subject: - Fix "Multiple selection" still being displayed after multiple tables are deleted - If multiple tables are selected when opening the SPFieldMapperController select the first to import into - Clean up tableName in tablesList - now returns nil if no tables are selected or multiple tables are selected, instead of returning an empty string for multiple tables --- Source/SPFieldMapperController.m | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'Source/SPFieldMapperController.m') diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m index ae76f8e2..6a558321 100644 --- a/Source/SPFieldMapperController.m +++ b/Source/SPFieldMapperController.m @@ -144,10 +144,9 @@ static NSString *SPTableViewSqlColumnID = @"sql"; [tableTargetPopup addItemsWithTitles:allTableNames]; // Select either the currently selected table, or the first item in the list, or if no table in db switch to "New Table" mode - if ([[theDelegate valueForKeyPath:@"tableDocumentInstance"] table] != nil - && ![[tablesListInstance tableName] isEqualToString:@""] - && [allTableNames containsObject:[tablesListInstance tableName]]) { - [tableTargetPopup selectItemWithTitle:[tablesListInstance tableName]]; + if ([[tablesListInstance selectedTableNames] count] + && [allTableNames containsObject:[[tablesListInstance selectedTableNames] objectAtIndex:0]]) { + [tableTargetPopup selectItemWithTitle:[[tablesListInstance selectedTableNames] objectAtIndex:0]]; } else { if([allTableNames count]) [tableTargetPopup selectItemAtIndex:3]; @@ -514,10 +513,9 @@ static NSString *SPTableViewSqlColumnID = @"sql"; } // Select either the currently selected table, or the first item in the list, or if no table in db switch to "New Table" mode - if ([[theDelegate valueForKeyPath:@"tableDocumentInstance"] table] != nil - && ![[tablesListInstance tableName] isEqualToString:@""] - && [allTableNames containsObject:[tablesListInstance tableName]]) { - [tableTargetPopup selectItemWithTitle:[tablesListInstance tableName]]; + if ([[tablesListInstance selectedTableNames] count] + && [allTableNames containsObject:[[tablesListInstance selectedTableNames] objectAtIndex:0]]) { + [tableTargetPopup selectItemWithTitle:[[tablesListInstance selectedTableNames] objectAtIndex:0]]; } else { if([allTableNames count]) [tableTargetPopup selectItemAtIndex:3]; -- cgit v1.2.3