diff options
author | rowanbeentje <rowan@beent.je> | 2010-05-22 12:21:54 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2010-05-22 12:21:54 +0000 |
commit | 76633d986085d3b9d05f73db8d51aefdf1f68dfb (patch) | |
tree | e36758acc38f519560b1fe0b1b0c476b03b27d46 | |
parent | bd78aaeadb8dfd0eb83a896727e6376109c12e22 (diff) | |
download | sequelpro-76633d986085d3b9d05f73db8d51aefdf1f68dfb.tar.gz sequelpro-76633d986085d3b9d05f73db8d51aefdf1f68dfb.tar.bz2 sequelpro-76633d986085d3b9d05f73db8d51aefdf1f68dfb.zip |
- Fix an issue when truncating tables using the right-click menu, by improving the truncation reload code and by removing a problem in TableContent tracking the active table name. This addresses Issue #700 and a number of crash reports.
- Rename SPHistoryView* constants to SPTableView* constants and use them more widely rather than hard-coded tab indexes
- Fix a problem preventing history navigation if a triggers view was the previous item in the history
-rw-r--r-- | Source/SPConstants.h | 14 | ||||
-rw-r--r-- | Source/SPHistoryController.m | 26 | ||||
-rw-r--r-- | Source/TableContent.m | 2 | ||||
-rw-r--r-- | Source/TableDocument.m | 12 | ||||
-rw-r--r-- | Source/TablesList.m | 34 |
5 files changed, 46 insertions, 42 deletions
diff --git a/Source/SPConstants.h b/Source/SPConstants.h index ca84e103..a547d6c1 100644 --- a/Source/SPConstants.h +++ b/Source/SPConstants.h @@ -77,13 +77,13 @@ typedef enum // History views typedef enum { - SPHistoryViewStructure = 0, - SPHistoryViewContent = 1, - SPHistoryViewCustomQuery = 2, - SPHistoryViewStatus = 3, - SPHistoryViewRelations = 4, - SPHistoryViewTriggers = 5 -} SPHistoryViewType; + SPTableViewStructure = 0, + SPTableViewContent = 1, + SPTableViewCustomQuery = 2, + SPTableViewStatus = 3, + SPTableViewRelations = 4, + SPTableViewTriggers = 5 +} SPTableViewType; // SSH tunnel password modes typedef enum diff --git a/Source/SPHistoryController.m b/Source/SPHistoryController.m index 567ebd7a..b8128a0f 100644 --- a/Source/SPHistoryController.m +++ b/Source/SPHistoryController.m @@ -172,18 +172,18 @@ NSString *viewName = [[[theDocument valueForKey:@"tableTabView"] selectedTabViewItem] identifier]; if ([viewName isEqualToString:@"source"]) { - theView = SPHistoryViewStructure; + theView = SPTableViewStructure; } else if ([viewName isEqualToString:@"content"]) { - theView = SPHistoryViewContent; + theView = SPTableViewContent; } else if ([viewName isEqualToString:@"customQuery"]) { - theView = SPHistoryViewCustomQuery; + theView = SPTableViewCustomQuery; } else if ([viewName isEqualToString:@"status"]) { - theView = SPHistoryViewStatus; + theView = SPTableViewStatus; } else if ([viewName isEqualToString:@"relations"]) { - theView = SPHistoryViewRelations; + theView = SPTableViewRelations; } else if ([viewName isEqualToString:@"triggers"]) { - theView = SPHistoryViewTriggers; + theView = SPTableViewTriggers; } return theView; @@ -402,7 +402,7 @@ // If the database, table, and view are the same and content - just trigger a table reload (filters) if ([[theDocument database] isEqualToString:[historyEntry objectForKey:@"database"]] && [historyEntry objectForKey:@"table"] && [[theDocument table] isEqualToString:[historyEntry objectForKey:@"table"]] - && [[historyEntry objectForKey:@"view"] integerValue] == [self currentlySelectedView] == SPHistoryViewContent) + && [[historyEntry objectForKey:@"view"] integerValue] == [self currentlySelectedView] == SPTableViewContent) { [tableContentInstance loadTable:[historyEntry objectForKey:@"table"]]; modifyingState = NO; @@ -433,22 +433,22 @@ // Check and set the view if ([self currentlySelectedView] != [[historyEntry objectForKey:@"view"] integerValue]) { switch ([[historyEntry objectForKey:@"view"] integerValue]) { - case SPHistoryViewStructure: + case SPTableViewStructure: [theDocument viewStructure:self]; break; - case SPHistoryViewContent: + case SPTableViewContent: [theDocument viewContent:self]; break; - case SPHistoryViewCustomQuery: + case SPTableViewCustomQuery: [theDocument viewQuery:self]; break; - case SPHistoryViewStatus: + case SPTableViewStatus: [theDocument viewStatus:self]; break; - case SPHistoryViewRelations: + case SPTableViewRelations: [theDocument viewRelations:self]; break; - case SPTriggersViewMode: + case SPTableViewTriggers: [theDocument viewTriggers:self]; break; } diff --git a/Source/TableContent.m b/Source/TableContent.m index 096e18bb..3e9c933a 100644 --- a/Source/TableContent.m +++ b/Source/TableContent.m @@ -1042,7 +1042,7 @@ [tableDataInstance resetColumnData]; // Load the table's data - [self loadTable:selectedTable]; + [self loadTable:[tablesListInstance tableName]]; [tableDocumentInstance endTask]; diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 1b5d3a1f..385e9781 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -2987,22 +2987,22 @@ [session setObject:[tableContentInstance sortColumnName] forKey:@"contentSortCol"]; switch([spHistoryControllerInstance currentlySelectedView]){ - case SPHistoryViewStructure: + case SPTableViewStructure: aString = @"SP_VIEW_STRUCTURE"; break; - case SPHistoryViewContent: + case SPTableViewContent: aString = @"SP_VIEW_CONTENT"; break; - case SPHistoryViewCustomQuery: + case SPTableViewCustomQuery: aString = @"SP_VIEW_CUSTOMQUERY"; break; - case SPHistoryViewStatus: + case SPTableViewStatus: aString = @"SP_VIEW_STATUS"; break; - case SPHistoryViewRelations: + case SPTableViewRelations: aString = @"SP_VIEW_RELATIONS"; break; - case SPHistoryViewTriggers: + case SPTableViewTriggers: aString = @"SP_VIEW_TRIGGERS"; break; default: diff --git a/Source/TablesList.m b/Source/TablesList.m index aae23689..2a77db53 100644 --- a/Source/TablesList.m +++ b/Source/TablesList.m @@ -698,20 +698,20 @@ statusLoaded = NO; triggersLoaded = NO; if( selectedTableType == SPTableTypeView || selectedTableType == SPTableTypeTable) { - if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 0 ) { + if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == SPTableViewStructure ) { [tableSourceInstance loadTable:selectedTableName]; structureLoaded = YES; - } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 1 ) { + } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == SPTableViewContent ) { if(tableEncoding == nil) { [tableContentInstance loadTable:nil]; } else { [tableContentInstance loadTable:selectedTableName]; } contentLoaded = YES; - } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 3 ) { + } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == SPTableViewStatus ) { [[extendedTableInfoInstance onMainThread] loadTable:selectedTableName]; statusLoaded = YES; - } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 5 ) { + } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == SPTableViewTriggers ) { [[tableTriggersInstance onMainThread] loadTriggers]; triggersLoaded = YES; } @@ -1360,19 +1360,19 @@ contentLoaded = NO; triggersLoaded = NO; switch ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]]) { - case 0: + case SPTableViewStructure: [tableSourceInstance loadTable:newTableName]; structureLoaded = YES; break; - case 1: + case SPTableViewContent: [tableContentInstance loadTable:newTableName]; contentLoaded = YES; break; - case 3: + case SPTableViewStatus: [extendedTableInfoInstance loadTable:newTableName]; statusLoaded = YES; break; - case 5: + case SPTableViewTriggers: [tableTriggersInstance loadTriggers]; triggersLoaded = YES; break; @@ -1564,22 +1564,22 @@ && ([self tableType] == SPTableTypeTable || [self tableType] == SPTableTypeView) ) { - if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 0) && !structureLoaded ) { + if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == SPTableViewStructure) && !structureLoaded ) { [tableSourceInstance loadTable:selectedTableName]; structureLoaded = YES; } - if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 1) && !contentLoaded ) { + if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == SPTableViewContent) && !contentLoaded ) { [tableContentInstance loadTable:selectedTableName]; contentLoaded = YES; } - if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 3) && !statusLoaded ) { + if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == SPTableViewStatus) && !statusLoaded ) { [[extendedTableInfoInstance onMainThread] loadTable:selectedTableName]; statusLoaded = YES; } - if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 5) && !triggersLoaded ) { + if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == SPTableViewTriggers) && !triggersLoaded ) { [[tableTriggersInstance onMainThread] loadTriggers]; triggersLoaded = YES; } @@ -2010,10 +2010,14 @@ currentIndex = [indexes indexLessThanIndex:currentIndex]; } - // Reload the table's content view to show that it has been truncated - [tableContentInstance reloadTable:self]; - [tableDataInstance resetStatusData]; + // Ensure the the table's content view is updated to show that it has been truncated + if ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == SPTableViewContent) { + [tableContentInstance reloadTable:self]; + } else { + [self setContentRequiresReload:YES]; + } + [tableDataInstance resetStatusData]; } /** |