aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPHistoryController.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2012-03-22 01:18:18 +0000
committerrowanbeentje <rowan@beent.je>2012-03-22 01:18:18 +0000
commit24f89a873caf37947f0447ff870ca4c8d55c453e (patch)
tree22162a0e1eead7190e316c384ff8c6c1b98661b3 /Source/SPHistoryController.m
parent3916b4227d1e02942504e13a2d36b3e6f57670bb (diff)
downloadsequelpro-24f89a873caf37947f0447ff870ca4c8d55c453e.tar.gz
sequelpro-24f89a873caf37947f0447ff870ca4c8d55c453e.tar.bz2
sequelpro-24f89a873caf37947f0447ff870ca4c8d55c453e.zip
- Rework SPTableData PRIMARY KEY and UNIQUE KEY parsing to use SPSQLParser instead of regexes
- Support multiple primary keys in the SPTableData parse - If possible, use primary keys to preserve table content selection instead of row indexes - Improve SPTableData primary keys method to use cached value instead of using another query - Preserve selection when filtering tables if appropriate
Diffstat (limited to 'Source/SPHistoryController.m')
-rw-r--r--Source/SPHistoryController.m12
1 files changed, 6 insertions, 6 deletions
diff --git a/Source/SPHistoryController.m b/Source/SPHistoryController.m
index 3bd3b0b3..2729397c 100644
--- a/Source/SPHistoryController.m
+++ b/Source/SPHistoryController.m
@@ -267,7 +267,7 @@
NSString *contentSortCol = [tableContentInstance sortColumnName];
BOOL contentSortColIsAsc = [tableContentInstance sortColumnIsAscending];
NSUInteger contentPageNumber = [tableContentInstance pageNumber];
- NSIndexSet *contentSelectedIndexSet = [tableContentInstance selectedRowIndexes];
+ NSDictionary *contentSelectedRows = [tableContentInstance selectionDetailsAllowingIndexSelection:YES];
NSRect contentViewport = [tableContentInstance viewport];
NSDictionary *contentFilter = [tableContentInstance filterSettings];
NSData *filterTableData = [tableContentInstance filterTableData];
@@ -283,7 +283,7 @@
[NSNumber numberWithBool:contentSortColIsAsc], @"sortIsAsc",
nil];
if (contentSortCol) [contentState setObject:contentSortCol forKey:@"sortCol"];
- if (contentSelectedIndexSet) [contentState setObject:contentSelectedIndexSet forKey:@"selection"];
+ if (contentSelectedRows) [contentState setObject:contentSelectedRows forKey:@"selection"];
if (contentFilter) [contentState setObject:contentFilter forKey:@"filter"];
if (filterTableData) [contentState setObject:filterTableData forKey:@"filterTable"];
@@ -322,7 +322,7 @@
|| ![[currentHistoryEntry objectForKey:@"contentFilter"] isEqualToDictionary:contentFilter])))
{
[currentHistoryEntry setObject:[NSValue valueWithRect:contentViewport] forKey:@"contentViewport"];
- if (contentSelectedIndexSet) [currentHistoryEntry setObject:contentSelectedIndexSet forKey:@"contentSelectedIndexSet"];
+ if (contentSelectedRows) [currentHistoryEntry setObject:contentSelectedRows forKey:@"contentSelection"];
// Special case: if the last history item is currently active, and has no table,
// but the new selection does - delete the last entry, in order to replace it.
@@ -344,7 +344,7 @@
[NSValue valueWithRect:contentViewport], @"contentViewport",
nil];
if (contentSortCol) [newEntry setObject:contentSortCol forKey:@"contentSortCol"];
- if (contentSelectedIndexSet) [newEntry setObject:contentSelectedIndexSet forKey:@"contentSelectedIndexSet"];
+ if (contentSelectedRows) [newEntry setObject:contentSelectedRows forKey:@"contentSelection"];
if (contentFilter) [newEntry setObject:contentFilter forKey:@"contentFilter"];
[history addObject:newEntry];
@@ -397,7 +397,7 @@
// Set table content details for restore
[tableContentInstance setSortColumnNameToRestore:[historyEntry objectForKey:@"contentSortCol"] isAscending:[[historyEntry objectForKey:@"contentSortColIsAsc"] boolValue]];
[tableContentInstance setPageToRestore:[[historyEntry objectForKey:@"contentPageNumber"] integerValue]];
- [tableContentInstance setSelectedRowIndexesToRestore:[historyEntry objectForKey:@"contentSelectedIndexSet"]];
+ [tableContentInstance setSelectionToRestore:[historyEntry objectForKey:@"contentSelection"]];
[tableContentInstance setViewportToRestore:[[historyEntry objectForKey:@"contentViewport"] rectValue]];
[tableContentInstance setFiltersToRestore:[historyEntry objectForKey:@"contentFilter"]];
@@ -514,7 +514,7 @@
// Restore the content view state
[tableContentInstance setSortColumnNameToRestore:[contentState objectForKey:@"sortCol"] isAscending:[[contentState objectForKey:@"sortIsAsc"] boolValue]];
[tableContentInstance setPageToRestore:[[contentState objectForKey:@"page"] unsignedIntegerValue]];
- [tableContentInstance setSelectedRowIndexesToRestore:[contentState objectForKey:@"selection"]];
+ [tableContentInstance setSelectionToRestore:[contentState objectForKey:@"selection"]];
[tableContentInstance setViewportToRestore:[[contentState objectForKey:@"viewport"] rectValue]];
[tableContentInstance setFiltersToRestore:[contentState objectForKey:@"filter"]];
}