diff options
author | rowanbeentje <rowan@beent.je> | 2012-11-21 01:18:22 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2012-11-21 01:18:22 +0000 |
commit | 7622f195887765e0a77d43bdeebec2d2992753f1 (patch) | |
tree | f3e752d2311d7b3617e3ad9ce53e2180fed1c097 /Source/SPTableContent.m | |
parent | c2edb061df742199a55892f69fa582bb8a6d9b1c (diff) | |
download | sequelpro-7622f195887765e0a77d43bdeebec2d2992753f1.tar.gz sequelpro-7622f195887765e0a77d43bdeebec2d2992753f1.tar.bz2 sequelpro-7622f195887765e0a77d43bdeebec2d2992753f1.zip |
- Allow table content pagination to preserve the current filter type, including URL schemes and advanced table-based filters, addressing Issue #1492. (The filter code in question probably needs refactoring to allow it to be simplified in future, but does currently function)
Diffstat (limited to 'Source/SPTableContent.m')
-rw-r--r-- | Source/SPTableContent.m | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index 9d598ae1..dceea288 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -1488,6 +1488,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper */ - (IBAction)filterTable:(id)sender { + BOOL senderIsPaginationButton = (sender == paginationPreviousButton || sender == paginationNextButton || sender == paginationGoButton); // Record whether the filter is being triggered by using delete/backspace in the filter field, which // can trigger the effect of clicking the "clear filter" button in the field. @@ -1496,15 +1497,23 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper #ifndef SP_REFACTOR - if(sender == filterTableFilterButton) + // If the filter table is being used - the advanced filter - switch type + if(sender == filterTableFilterButton) { activeFilter = 1; - else if([sender isKindOfClass:[NSString class]] && [(NSString *)sender length]) { + } + + // If a string was supplied, use a custom query from that URL scheme + else if ([sender isKindOfClass:[NSString class]] && [(NSString *)sender length]) { if(schemeFilter) [schemeFilter release], schemeFilter = nil; schemeFilter = [sender retain]; activeFilter = 2; } - else + + // If a button other than the pagination buttons was used, set the active filter type to + // the standard filter field. + else if (!senderIsPaginationButton) { activeFilter = 0; + } #endif NSString *taskString; @@ -1529,7 +1538,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper // Select the correct pagination value. // If the filter button was used, or if pagination is disabled, reset to page one - if ([sender isKindOfClass:[NSButton class]] || [sender isKindOfClass:[NSTextField class]] || ![prefs boolForKey:SPLimitResults] || [paginationPageField integerValue] <= 0) + if (!senderIsPaginationButton && ([sender isKindOfClass:[NSButton class]] || [sender isKindOfClass:[NSTextField class]] || ![prefs boolForKey:SPLimitResults] || [paginationPageField integerValue] <= 0)) contentPage = 1; // If the current page is out of bounds, move it within bounds @@ -1738,7 +1747,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper [paginationPageField setIntegerValue:(contentPage + 1)]; } - [self filterTable:self]; + [self filterTable:sender]; } /** |