aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2011-06-14 00:19:01 +0000
committerrowanbeentje <rowan@beent.je>2011-06-14 00:19:01 +0000
commitb4b81b2dd07674b7dc3208e3b79690f66b1bf113 (patch)
tree712709715094c00668e681e83d0ce91cfb061d26 /Source
parent876a4e359f72653a4be001b5bb41900253794b58 (diff)
downloadsequelpro-b4b81b2dd07674b7dc3208e3b79690f66b1bf113.tar.gz
sequelpro-b4b81b2dd07674b7dc3208e3b79690f66b1bf113.tar.bz2
sequelpro-b4b81b2dd07674b7dc3208e3b79690f66b1bf113.zip
- 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
Diffstat (limited to 'Source')
-rw-r--r--Source/SPFieldMapperController.m14
-rw-r--r--Source/SPTableData.m2
-rw-r--r--Source/SPTableInfo.m6
-rw-r--r--Source/SPTablesList.m20
4 files changed, 18 insertions, 24 deletions
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];
diff --git a/Source/SPTableData.m b/Source/SPTableData.m
index de253e57..1936d0b1 100644
--- a/Source/SPTableData.m
+++ b/Source/SPTableData.m
@@ -928,7 +928,7 @@
BOOL changeEncoding = ![[mySQLConnection encoding] isEqualToString:@"utf8"];
// Catch unselected tables and return false
- if ([[tableListInstance tableName] isEqualToString:@""] || ![tableListInstance tableName]) {
+ if (![tableListInstance tableName]) {
pthread_mutex_unlock(&dataProcessingLock);
return FALSE;
}
diff --git a/Source/SPTableInfo.m b/Source/SPTableInfo.m
index d06198b4..bb9abacd 100644
--- a/Source/SPTableInfo.m
+++ b/Source/SPTableInfo.m
@@ -126,9 +126,11 @@
[info removeAllObjects];
- if ([[tableListInstance tableName] isEqualToString:@""]) {
+ if (![tableListInstance tableName]) {
[info addObject:NSLocalizedString(@"INFORMATION", @"header for blank info pane")];
- [info addObject:NSLocalizedString(@"multiple selection", @"multiple selection")];
+ if ([[tableListInstance selectedTableItems] count]) {
+ [info addObject:NSLocalizedString(@"multiple selection", @"multiple selection")];
+ }
[infoTable reloadData];
return;
}
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m
index e81f78b1..fe43c845 100644
--- a/Source/SPTablesList.m
+++ b/Source/SPTablesList.m
@@ -760,17 +760,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
#endif
// Update the selected table name and type
if (selectedTableName) [selectedTableName release];
-
-#ifndef SP_REFACTOR /* ui manipulation */
- if ([indexes count]) {
- selectedTableName = [[NSString alloc] initWithString:@""];
- }
- else {
-#endif
- selectedTableName = nil;
-#ifndef SP_REFACTOR /* ui manipulation */
- }
-#endif
+ selectedTableName = nil;
#ifndef SP_REFACTOR /* ui manipulation */
// Set gear menu items Remove/Duplicate table/view according to the table types
@@ -1552,8 +1542,12 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
if ([tablesListView numberOfSelectedRows] != 1) {
// Ensure the state is cleared
- if ([tableDocumentInstance table]) [tableDocumentInstance loadTable:nil ofType:SPTableTypeNone];
- else [self setSelectionState:nil];
+ if ([tableDocumentInstance table]) {
+ [tableDocumentInstance loadTable:nil ofType:SPTableTypeNone];
+ } else {
+ [self setSelectionState:nil];
+ [tableInfoInstance tableChanged:nil];
+ }
if (selectedTableName) [selectedTableName release], selectedTableName = nil;
selectedTableType = SPTableTypeNone;
return;