on xenial help sign in
Rebase
8460bfcJosh Arenson
qml/Dash/Filters/FilterOptionSelector.qml+4
@@ -25,6 +25,8 @@ FilterWidget {
25
25
26 implicitHeight: expandingItem.height
26 implicitHeight: expandingItem.height
27
27
28+ signal filterSelected()
29+
28 ListItems.Expandable {
30 ListItems.Expandable {
29 id: expandingItem
31 id: expandingItem
30 objectName: "expandingItem"
32 objectName: "expandingItem"
@@ -67,6 +69,7 @@ FilterWidget {
67 width: parent.width
69 width: parent.width
68 Repeater {
70 Repeater {
69 model: widgetData.options
71 model: widgetData.options
72+ objectName: "optionsRepeater"
70
73
71 ListItems.Standard {
74 ListItems.Standard {
72 text: label
75 text: label
@@ -83,6 +86,7 @@ FilterWidget {
83
86
84 onClicked: {
87 onClicked: {
85 widgetData.options.setChecked(index, !checked);
88 widgetData.options.setChecked(index, !checked);
89+ root.filterSelected()
86 }
90 }
87 }
91 }
88 }
92 }
qml/Dash/Filters/FilterWidgetFactory.qml+8
@@ -31,6 +31,9 @@ Item {
31 //! Widget data, forwarded to the widget as is.
31 //! Widget data, forwarded to the widget as is.
32 property var widgetData: null
32 property var widgetData: null
33
33
34+ // Emitted iff filter type is FilterOptionSelector
35+ signal singleSelectionFilterSelected()
36+
34 implicitHeight: title.height + title.anchors.topMargin + loader.height
37 implicitHeight: title.height + title.anchors.topMargin + loader.height
35
38
36 Label {
39 Label {
@@ -76,5 +79,10 @@ Item {
76 item.widgetId = Qt.binding(function() { return root.widgetId } )
79 item.widgetId = Qt.binding(function() { return root.widgetId } )
77 item.widgetData = Qt.binding(function() { return root.widgetData } )
80 item.widgetData = Qt.binding(function() { return root.widgetData } )
78 }
81 }
82+
83+ Connections {
84+ target: widgetType == Filters.OptionSelectorFilter ? loader.item : null
85+ onFilterSelected: root.singleSelectionFilterSelected()
86+ }
79 }
87 }
80}
88}
qml/Dash/GenericScopeView.qml+5
@@ -685,6 +685,11 @@ FocusScope {
685 categoryView.pageHeader.closePopup();
685 categoryView.pageHeader.closePopup();
686 categoryView.pageHeader.unfocus();
686 categoryView.pageHeader.unfocus();
687 }
687 }
688+
689+ onExtraPanelOptionSelected: {
690+ categoryView.pageHeader.closePopup();
691+ categoryView.pageHeader.unfocus();
692+ }
688 }
693 }
689 }
694 }
690
695
qml/Dash/PageHeaderExtraPanel.qml+3
@@ -36,6 +36,7 @@ Item {
36
36
37 signal historyItemClicked(string text)
37 signal historyItemClicked(string text)
38 signal dashNavigationLeafClicked()
38 signal dashNavigationLeafClicked()
39+ signal extraPanelOptionSelected()
39
40
40 function resetNavigation() {
41 function resetNavigation() {
41 dashNavigation.resetNavigation();
42 dashNavigation.resetNavigation();
@@ -181,6 +182,8 @@ Item {
181 widgetId: filter ? filter.filterId : ""
182 widgetId: filter ? filter.filterId : ""
182 widgetType: filter ? filter.filterType : -1
183 widgetType: filter ? filter.filterType : -1
183 widgetData: filter
184 widgetData: filter
185+
186+ onSingleSelectionFilterSelected: extraPanelOptionSelected()
184 }
187 }
185 }
188 }
186
189
tests/qmltests/Dash/tst_Dash.qml+27
@@ -146,6 +146,33 @@ Item {
146 tryCompare(categoryListView, "atYBeginning", true)
146 tryCompare(categoryListView, "atYBeginning", true)
147 }
147 }
148
148
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+
149 function test_manage_dash_clickscope_unfavoritable() {
176 function test_manage_dash_clickscope_unfavoritable() {
150 // Show the manage dash
177 // Show the manage dash
151 touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));
178 touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));