on xenial help sign in
Rebase
commit8460bfc8030013dc0915809e2c26ac902a98f74c authorJosh Arenson <joshua.arenson@canonical.com> dateThu 5 May 2016, 11:16 (10 years ago) parentc576a46
5 files changed+47
qml/Dash/Filters/FilterOptionSelector.qml+4 qml/Dash/Filters/FilterWidgetFactory.qml+8 qml/Dash/GenericScopeView.qml+5 qml/Dash/PageHeaderExtraPanel.qml+3 tests/qmltests/Dash/tst_Dash.qml+27
qml/Dash/Filters/FilterOptionSelector.qml+4
@@ -25,6 +25,8 @@ FilterWidget {
2525
2626 implicitHeight: expandingItem.height
2727
28+ signal filterSelected()
29+
2830 ListItems.Expandable {
2931 id: expandingItem
3032 objectName: "expandingItem"
@@ -67,6 +69,7 @@ FilterWidget {
6769 width: parent.width
6870 Repeater {
6971 model: widgetData.options
72+ objectName: "optionsRepeater"
7073
7174 ListItems.Standard {
7275 text: label
@@ -83,6 +86,7 @@ FilterWidget {
8386
8487 onClicked: {
8588 widgetData.options.setChecked(index, !checked);
89+ root.filterSelected()
8690 }
8791 }
8892 }
qml/Dash/Filters/FilterWidgetFactory.qml+8
@@ -31,6 +31,9 @@ Item {
3131 //! Widget data, forwarded to the widget as is.
3232 property var widgetData: null
3333
34+ // Emitted iff filter type is FilterOptionSelector
35+ signal singleSelectionFilterSelected()
36+
3437 implicitHeight: title.height + title.anchors.topMargin + loader.height
3538
3639 Label {
@@ -76,5 +79,10 @@ Item {
7679 item.widgetId = Qt.binding(function() { return root.widgetId } )
7780 item.widgetData = Qt.binding(function() { return root.widgetData } )
7881 }
82+
83+ Connections {
84+ target: widgetType == Filters.OptionSelectorFilter ? loader.item : null
85+ onFilterSelected: root.singleSelectionFilterSelected()
86+ }
7987 }
8088}
qml/Dash/GenericScopeView.qml+5
@@ -685,6 +685,11 @@ FocusScope {
685685 categoryView.pageHeader.closePopup();
686686 categoryView.pageHeader.unfocus();
687687 }
688+
689+ onExtraPanelOptionSelected: {
690+ categoryView.pageHeader.closePopup();
691+ categoryView.pageHeader.unfocus();
692+ }
688693 }
689694 }
690695
qml/Dash/PageHeaderExtraPanel.qml+3
@@ -36,6 +36,7 @@ Item {
3636
3737 signal historyItemClicked(string text)
3838 signal dashNavigationLeafClicked()
39+ signal extraPanelOptionSelected()
3940
4041 function resetNavigation() {
4142 dashNavigation.resetNavigation();
@@ -181,6 +182,8 @@ Item {
181182 widgetId: filter ? filter.filterId : ""
182183 widgetType: filter ? filter.filterType : -1
183184 widgetData: filter
185+
186+ onSingleSelectionFilterSelected: extraPanelOptionSelected()
184187 }
185188 }
186189
tests/qmltests/Dash/tst_Dash.qml+27
@@ -146,6 +146,33 @@ Item {
146146 tryCompare(categoryListView, "atYBeginning", true)
147147 }
148148
149+ function test_navigationFilterPopupClosesWhenOptionSelected() {
150+ dash.setCurrentScope("LongPrimaryNavigation")
151+
152+ var dashContentList = findChild(dashContent, "dashContentList")
153+ var searchButton = findChild(dashContentList.currentItem, "search_button")
154+ verify(searchButton)
155+ var extraPanel = findChild(dashContentList.currentItem, "peExtraPanel")
156+ verify(extraPanel)
157+
158+ var primaryFilter = findChild(extraPanel, "primaryFilter")
159+ var expandingItem = findChild(primaryFilter, "expandingItem")
160+ verify(expandingItem)
161+ tryCompare(expandingItem, "expanded", false)
162+
163+ mouseClick(searchButton)
164+ expandingItem.expanded = true
165+ tryCompare(expandingItem, "expanded", true)
166+ tryCompareFunction(function() { return expandingItem.height == expandingItem.expandedHeight; }, true);
167+
168+ var optionsRepeater = findChild(expandingItem, "optionsRepeater")
169+ verify(optionsRepeater)
170+ verify(optionsRepeater.itemAt(0))
171+ tryCompare(optionsRepeater.itemAt(0), "visible", true)
172+ mouseClick(optionsRepeater.itemAt(0))
173+ tryCompare(expandingItem, "visible", false)
174+ }
175+
149176 function test_manage_dash_clickscope_unfavoritable() {
150177 // Show the manage dash
151178 touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));