From 7622f195887765e0a77d43bdeebec2d2992753f1 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Wed, 21 Nov 2012 01:18:22 +0000 Subject: - 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) --- Interfaces/English.lproj/ContentPaginationView.xib | 301 ++++++++++----------- Source/SPTableContent.h | 1 + Source/SPTableContent.m | 19 +- 3 files changed, 161 insertions(+), 160 deletions(-) diff --git a/Interfaces/English.lproj/ContentPaginationView.xib b/Interfaces/English.lproj/ContentPaginationView.xib index 882e6157..3e12e6fc 100644 --- a/Interfaces/English.lproj/ContentPaginationView.xib +++ b/Interfaces/English.lproj/ContentPaginationView.xib @@ -2,9 +2,9 @@ 1050 - 11E53 + 11G63b 851 - 1138.47 + 1138.51 569.00 com.apple.InterfaceBuilder.CocoaPlugin @@ -692,6 +692,14 @@ 57 + + + paginationGoButton + + + + 58 + @@ -1045,7 +1053,7 @@ - 57 + 58 @@ -1092,13 +1100,6 @@ Frameworks/PSMTabBar/PSMTabBarController.h - - NSObject - - IBProjectSource - Source/SPConnectionController.h - - NSObject @@ -1141,24 +1142,6 @@ Source/SPQueryFavoriteManager.h - - NSObject - - toggleCollapse: - id - - - toggleCollapse: - - toggleCollapse: - id - - - - IBProjectSource - Source/SPTablesList.h - - NSTextView @@ -1402,7 +1385,6 @@ showCompletionList: showHelpForCurrentWord: showHelpForSearchString: - toggleQueryInfoPaneCollapse: YES @@ -1428,7 +1410,6 @@ id id id - NSButton @@ -1457,7 +1438,6 @@ showCompletionList: showHelpForCurrentWord: showHelpForSearchString: - toggleQueryInfoPaneCollapse: YES @@ -1549,10 +1529,6 @@ showHelpForSearchString: id - - toggleQueryInfoPaneCollapse: - NSButton - @@ -1581,9 +1557,9 @@ helpTargetSelector helpWebView helpWebViewWindow - multipleLineEditingButton nextHistoryMenuItem previousHistoryMenuItem + queryEditorSplitView queryFavoriteNameTextField queryFavoritesButton queryFavoritesSaveAllMenuItem @@ -1637,9 +1613,9 @@ NSSegmentedControl WebView NSWindow - id NSMenuItem NSMenuItem + SPSplitView NSTextField id NSMenuItem @@ -1653,7 +1629,7 @@ id NSMenuItem NSButton - NSSplitView + SPSplitView id NSMenuItem id @@ -1696,9 +1672,9 @@ helpTargetSelector helpWebView helpWebViewWindow - multipleLineEditingButton nextHistoryMenuItem previousHistoryMenuItem + queryEditorSplitView queryFavoriteNameTextField queryFavoritesButton queryFavoritesSaveAllMenuItem @@ -1818,10 +1794,6 @@ helpWebViewWindow NSWindow - - multipleLineEditingButton - id - nextHistoryMenuItem NSMenuItem @@ -1830,6 +1802,10 @@ previousHistoryMenuItem NSMenuItem + + queryEditorSplitView + SPSplitView + queryFavoriteNameTextField NSTextField @@ -1884,7 +1860,7 @@ queryInfoPaneSplitView - NSSplitView + SPSplitView runAllButton @@ -1992,7 +1968,6 @@ flushPrivileges: flushTable: focusOnTableContentFilter: - focusOnTableListFilter: import: importFromClipboard: openCurrentConnectionInNewWindow: @@ -2061,7 +2036,6 @@ id id id - id @@ -2089,7 +2063,6 @@ flushPrivileges: flushTable: focusOnTableContentFilter: - focusOnTableListFilter: import: importFromClipboard: openCurrentConnectionInNewWindow: @@ -2199,10 +2172,6 @@ focusOnTableContentFilter: id - - focusOnTableListFilter: - id - import: id @@ -2342,7 +2311,6 @@ saveConnectionIncludeQuery saveConnectionSavePassword saveConnectionSavePasswordAlert - sidebarGrabber spHistoryControllerInstance statusTableAccessoryView statusTableCopyChecksum @@ -2350,10 +2318,8 @@ tableContentInstance tableDataInstance tableDumpInstance - tableInfoCollapseButton tableInfoScrollView tableInfoTable - tableListSplitter tableRelationsInstance tableSourceInstance tableTabView @@ -2373,7 +2339,7 @@ id id NSWindow - NSSplitView + SPSplitView id NSButton id @@ -2419,14 +2385,11 @@ id id id - id SPTableContent SPTableData id - NSButton NSScrollView NSTableView - NSSplitView id SPTableStructure NSTabView @@ -2491,7 +2454,6 @@ saveConnectionIncludeQuery saveConnectionSavePassword saveConnectionSavePasswordAlert - sidebarGrabber spHistoryControllerInstance statusTableAccessoryView statusTableCopyChecksum @@ -2499,10 +2461,8 @@ tableContentInstance tableDataInstance tableDumpInstance - tableInfoCollapseButton tableInfoScrollView tableInfoTable - tableListSplitter tableRelationsInstance tableSourceInstance tableTabView @@ -2533,7 +2493,7 @@ contentViewSplitter - NSSplitView + SPSplitView copyDatabaseButton @@ -2699,10 +2659,6 @@ saveConnectionSavePasswordAlert id - - sidebarGrabber - id - spHistoryControllerInstance id @@ -2731,10 +2687,6 @@ tableDumpInstance id - - tableInfoCollapseButton - NSButton - tableInfoScrollView NSScrollView @@ -2743,10 +2695,6 @@ tableInfoTable NSTableView - - tableListSplitter - NSSplitView - tableRelationsInstance id @@ -3112,7 +3060,7 @@ YES NSButton NSButton - BWAnchoredButtonBar + NSBox NSButton SPDatabaseDocument NSView @@ -3175,7 +3123,7 @@ anchoredButtonBar - BWAnchoredButtonBar + NSBox confirmAddIndexButton @@ -3264,6 +3212,57 @@ Source/SPIndexesController.h + + SPSplitView + NSSplitView + + toggleCollapse: + id + + + toggleCollapse: + + toggleCollapse: + id + + + + YES + + YES + additionalDragHandleView + collapseToggleButton + + + YES + NSView + NSButton + + + + YES + + YES + additionalDragHandleView + collapseToggleButton + + + YES + + additionalDragHandleView + NSView + + + collapseToggleButton + NSButton + + + + + IBProjectSource + Source/SPSplitView.h + + SPTableContent NSObject @@ -3282,7 +3281,6 @@ setDefaultOperator: showDefaultOperaterHelp: showFilterTable: - swapFilterTable: tableFilterClear: toggleDistinctSelect: toggleFilterField: @@ -3308,7 +3306,6 @@ id id id - id NSButton @@ -3327,7 +3324,6 @@ setDefaultOperator: showDefaultOperaterHelp: showFilterTable: - swapFilterTable: tableFilterClear: toggleDistinctSelect: toggleFilterField: @@ -3381,10 +3377,6 @@ showFilterTable: id - - swapFilterTable: - id - tableFilterClear: id @@ -3425,13 +3417,15 @@ fieldField filterButton filterTableClearButton - filterTableDistinctMenuItem + filterTableDistinctCheckbox filterTableFilterButton - filterTableGearLookAllFields filterTableLiveSearchCheckbox filterTableNegateCheckbox + filterTableQueryTitle + filterTableSearchAllFields filterTableSetDefaultOperatorSheet filterTableSetDefaultOperatorValue + filterTableSplitView filterTableView filterTableWhereClause filterTableWindow @@ -3441,6 +3435,7 @@ limitRowsStepper multipleLineEditingButton paginationButton + paginationGoButton paginationNextButton paginationPageField paginationPageStepper @@ -3469,13 +3464,15 @@ NSPopUpButton id NSButton - NSMenuItem NSButton - NSMenuItem NSButton NSButton + NSButton + NSTextField + NSButton NSPanel NSComboBox + SPSplitView SPCopyTable SPTextView NSPanel @@ -3486,6 +3483,7 @@ NSButton NSButton NSButton + NSButton NSTextField NSStepper NSButton @@ -3516,13 +3514,15 @@ fieldField filterButton filterTableClearButton - filterTableDistinctMenuItem + filterTableDistinctCheckbox filterTableFilterButton - filterTableGearLookAllFields filterTableLiveSearchCheckbox filterTableNegateCheckbox + filterTableQueryTitle + filterTableSearchAllFields filterTableSetDefaultOperatorSheet filterTableSetDefaultOperatorValue + filterTableSplitView filterTableView filterTableWhereClause filterTableWindow @@ -3532,6 +3532,7 @@ limitRowsStepper multipleLineEditingButton paginationButton + paginationGoButton paginationNextButton paginationPageField paginationPageStepper @@ -3591,17 +3592,13 @@ NSButton - filterTableDistinctMenuItem - NSMenuItem + filterTableDistinctCheckbox + NSButton filterTableFilterButton NSButton - - filterTableGearLookAllFields - NSMenuItem - filterTableLiveSearchCheckbox NSButton @@ -3610,6 +3607,14 @@ filterTableNegateCheckbox NSButton + + filterTableQueryTitle + NSTextField + + + filterTableSearchAllFields + NSButton + filterTableSetDefaultOperatorSheet NSPanel @@ -3618,6 +3623,10 @@ filterTableSetDefaultOperatorValue NSComboBox + + filterTableSplitView + SPSplitView + filterTableView SPCopyTable @@ -3654,6 +3663,10 @@ paginationButton NSButton + + paginationGoButton + NSButton + paginationNextButton NSButton @@ -3735,6 +3748,13 @@ Source/SPTableContentDelegate.h + + SPTableContent + + IBProjectSource + Source/SPTableContentFilter.h + + SPTableContent NSObject @@ -3802,7 +3822,6 @@ YES activitiesTable - containerView infoTable tableDataInstance tableDocumentInstance @@ -3813,7 +3832,6 @@ YES NSTableView - NSView id id id @@ -3827,7 +3845,6 @@ YES activitiesTable - containerView infoTable tableDataInstance tableDocumentInstance @@ -3841,10 +3858,6 @@ activitiesTable NSTableView - - containerView - NSView - infoTable id @@ -3886,7 +3899,6 @@ addField: closeSheet: duplicateField: - reloadTable: removeField: resetAutoIncrement: showOptimizedFieldType: @@ -3901,7 +3913,6 @@ id id id - id NSMenuItem id @@ -3913,7 +3924,6 @@ addField: closeSheet: duplicateField: - reloadTable: removeField: resetAutoIncrement: showOptimizedFieldType: @@ -3934,10 +3944,6 @@ duplicateField: id - - reloadTable: - id - removeField: id @@ -4179,6 +4185,24 @@ Source/SPTableStructureDelegate.h + + SPTableStructure + + reloadTable: + id + + + reloadTable: + + reloadTable: + id + + + + IBProjectSource + Source/SPTableStructureLoading.h + + SPTableView NSTableView @@ -4316,7 +4340,6 @@ tableDocumentInstance tableDumpInstance tableEncodingButton - tableInfoCollapseButton tableInfoInstance tableListFilterSplitView tableListSplitView @@ -4369,10 +4392,9 @@ SPDatabaseDocument id id - NSButton id - NSSplitView - NSSplitView + SPSplitView + SPSplitView id id SPTableStructure @@ -4425,7 +4447,6 @@ tableDocumentInstance tableDumpInstance tableEncodingButton - tableInfoCollapseButton tableInfoInstance tableListFilterSplitView tableListSplitView @@ -4580,21 +4601,17 @@ tableEncodingButton id - - tableInfoCollapseButton - NSButton - tableInfoInstance id tableListFilterSplitView - NSSplitView + SPSplitView tableListSplitView - NSSplitView + SPSplitView tableNameField @@ -4646,7 +4663,10 @@ - + + IBProjectSource + Source/SPTablesList.h + SPTextView @@ -4844,7 +4864,7 @@ removeSchemaPrivButton schemaController schemasTableView - splitViewButtonBar + splitView tabView treeController userNameTextField @@ -4866,7 +4886,7 @@ NSButton NSArrayController NSTableView - BWAnchoredButtonBar + SPSplitView NSTabView NSTreeController NSTextField @@ -4891,7 +4911,7 @@ removeSchemaPrivButton schemaController schemasTableView - splitViewButtonBar + splitView tabView treeController userNameTextField @@ -4959,8 +4979,8 @@ NSTableView - splitViewButtonBar - BWAnchoredButtonBar + splitView + SPSplitView tabView @@ -4991,14 +5011,6 @@ YES - - BWAnchoredButtonBar - NSView - - IBFrameworkSource - BWToolkitFramework.framework/Headers/BWAnchoredButtonBar.h - - NSActionCell NSCell @@ -5050,13 +5062,6 @@ AppKit.framework/Headers/NSUserInterfaceItemSearching.h - - NSApplication - - IBFrameworkSource - BWToolkitFramework.framework/Headers/NSApplication+BWAdditions.h - - NSArrayController NSObjectController @@ -5772,13 +5777,6 @@ NSResponder - - NSView - - IBFrameworkSource - BWToolkitFramework.framework/Headers/NSView+BWAdditions.h - - NSWindow @@ -5801,13 +5799,6 @@ AppKit.framework/Headers/NSWindowScripting.h - - NSWindow - - IBFrameworkSource - BWToolkitFramework.framework/Headers/NSWindow+BWAdditions.h - - NSWindowController NSResponder diff --git a/Source/SPTableContent.h b/Source/SPTableContent.h index 1eb6b678..66aab772 100644 --- a/Source/SPTableContent.h +++ b/Source/SPTableContent.h @@ -89,6 +89,7 @@ IBOutlet NSButton *paginationPreviousButton; #ifndef SP_REFACTOR IBOutlet NSButton *paginationButton; + IBOutlet NSButton *paginationGoButton; #endif IBOutlet NSButton *paginationNextButton; #ifndef SP_REFACTOR 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]; } /** -- cgit v1.2.3