Merge lp:~nik90/unav/fix-poi-page-header into lp:unav

Proposed by Nekhelesh Ramananthan
Status: Merged
Approved by: Nekhelesh Ramananthan
Approved revision: 78
Merged at revision: 51
Proposed branch: lp:~nik90/unav/fix-poi-page-header
Merge into: lp:unav
Prerequisite: lp:~nik90/unav/marcos-menu-structure
Diff against target: 204 lines (+66/-44)
3 files modified
qml/Location.qml (+7/-1)
qml/PoiListPage.qml (+5/-0)
qml/PoiPage.qml (+54/-43)
To merge this branch: bzr merge lp:~nik90/unav/fix-poi-page-header
Reviewer Review Type Date Requested Status
JkB Approve
costales Approve
Review via email: mp+292100@code.launchpad.net

Description of the change

This MP fixes few inconsistencies with POI Page Header which include,
- Page Header now scrolls when user scrolls the list view like in the rest of the app
- In search mode, the range filters are now also visible
- Added scrollbars to POI page and search page (while searching location)

@Joerg should be happy seeing this ;)

To post a comment you must log in.
lp:~nik90/unav/fix-poi-page-header updated
78. By Nekhelesh Ramananthan

Added scrollbar to poi page, poi list page and search page

Revision history for this message
costales (costales) wrote :

:) Thanks

review: Approve
Revision history for this message
JkB (joergberroth) wrote :

Thx a lot!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Location.qml'
2--- qml/Location.qml 2016-04-17 22:32:56 +0000
3+++ qml/Location.qml 2016-04-17 22:32:56 +0000
4@@ -208,7 +208,7 @@
5 name: "find"
6 }
7
8- anchors { top: parent.top; left: parent.left; right: parent.right; margins: units.gu(2) }
9+ anchors { left: parent.left; right: parent.right; margins: units.gu(2) }
10 hasClearButton: true
11 inputMethodHints: Qt.ImhNoPredictiveText
12 placeholderText: i18n.tr("Search location")
13@@ -231,6 +231,12 @@
14 }
15 }
16 }
17+
18+ Scrollbar {
19+ visible: listView.model === sortedSearchModel
20+ flickableItem: listView
21+ align: Qt.AlignTrailing
22+ }
23 }
24
25 Component {
26
27=== modified file 'qml/PoiListPage.qml'
28--- qml/PoiListPage.qml 2016-04-17 22:32:56 +0000
29+++ qml/PoiListPage.qml 2016-04-17 22:32:56 +0000
30@@ -326,5 +326,10 @@
31 }
32 }
33 }
34+
35+ Scrollbar {
36+ flickableItem: resultsListView
37+ align: Qt.AlignTrailing
38+ }
39 }
40 }
41
42=== modified file 'qml/PoiPage.qml'
43--- qml/PoiPage.qml 2016-04-15 21:08:18 +0000
44+++ qml/PoiPage.qml 2016-04-17 22:32:56 +0000
45@@ -31,33 +31,37 @@
46 property string unit: navApp.settings.unit === 0 ? "km" : "mi"
47 property var factorList: ["1", "5", "15", "30", "50"]
48
49- header: standardHeader
50- anchors.fill: parent
51-
52 function goBackSearchMode() {
53 categoryList.forceActiveFocus()
54- poiPage.header = standardHeader
55- poiSearchField.text = ""
56+ poiHeader.isSearchMode = false
57+ }
58+
59+ function goBackStandardMode() {
60+ mainPageStack.pop()
61 }
62
63 Keys.onEscapePressed: {
64- header === standardHeader ? goBackStandardMode()
65- : goBackSearchMode()
66+ !poiHeader.isSearchMode ? goBackStandardMode()
67+ : goBackSearchMode()
68 }
69
70- UNavHeader {
71- id: standardHeader
72- visible: poiPage.header === standardHeader
73- title: i18n.tr("Nearby")
74-
75- // #FIXME: This back button is only here to allow the user to press Escape keyboard key to go back.
76- // This feature will be implemented upstream by the SDK devs when they add keyboard shortcuts to pages,
77- // at which point this back button can be removed.
78+ header: UNavHeader {
79+ id: poiHeader
80+
81+ property bool isSearchMode: false
82+ property alias searchField: contentLoader.item
83+
84+ flickable: categoryList
85+
86 leadingActionBar.actions: Action {
87 iconName: "back"
88 text: i18n.tr("Back")
89 onTriggered: {
90- mainPageStack.pop();
91+ if (poiHeader.isSearchMode) {
92+ goBackSearchMode()
93+ } else {
94+ goBackStandardMode()
95+ }
96 }
97 }
98
99@@ -66,12 +70,20 @@
100 iconName: "find"
101 text: i18n.tr("Search")
102 shortcut: "Ctrl+F"
103+ visible: !poiHeader.isSearchMode
104 onTriggered: {
105- poiPage.header = searchHeader
106- poiSearchField.forceActiveFocus()
107+ poiHeader.isSearchMode = true
108+ poiHeader.searchField.forceActiveFocus()
109 }
110 }
111
112+ contents: Loader {
113+ id: contentLoader
114+ width: parent.width; height: units.gu(4)
115+ anchors.verticalCenter: parent.verticalCenter
116+ sourceComponent: poiHeader.isSearchMode ? searchFieldComponent : pageTitleComponent
117+ }
118+
119 extension: UNavPageSection {
120 id: distanceSections
121 anchors {
122@@ -85,27 +97,23 @@
123 }
124 }
125
126- UNavHeader {
127- id: searchHeader
128- visible: poiPage.header === searchHeader
129-
130- // #FIXME: This back button is only here to allow the user to press Escape keyboard key to go back.
131- // This feature will be implemented upstream by the SDK devs when they add keyboard shortcuts to pages,
132- // at which point this back button can be removed.
133- leadingActionBar.actions: Action {
134- iconName: "back"
135- text: i18n.tr("Back")
136- onTriggered: {
137- goBackSearchMode()
138- }
139- }
140-
141- contents: TextField {
142- id: poiSearchField
143- width: parent.width
144- anchors.verticalCenter: parent.verticalCenter
145+ Component {
146+ id: searchFieldComponent
147+ TextField {
148+ hasClearButton: true
149 inputMethodHints: Qt.ImhNoPredictiveText
150- hasClearButton: true
151+ placeholderText: i18n.tr("Filter POI categories by name")
152+ }
153+ }
154+
155+ Component {
156+ id: pageTitleComponent
157+ Label {
158+ textSize: Label.Large
159+ color: "White"
160+ font.weight: Font.Light
161+ text: i18n.tr("Nearby")
162+ verticalAlignment: Text.AlignVCenter
163 }
164 }
165
166@@ -139,8 +147,8 @@
167 id: sortedCategoryListModel
168 model: categoryListModel
169 filter.property: "label"
170- filter.pattern: poiPage.header === searchHeader ? RegExp(poiSearchField.text, "gi")
171- : RegExp("", "gi")
172+ filter.pattern: poiHeader.isSearchMode ? RegExp(poiHeader.searchField.text, "gi")
173+ : RegExp("", "gi")
174 }
175
176 ListView {
177@@ -148,7 +156,6 @@
178
179 model: sortedCategoryListModel
180 anchors.fill: parent
181- anchors.topMargin: poiPage.header.height
182 clip: true
183
184 section.property: "theme"
185@@ -182,8 +189,7 @@
186 ProgressionSlot{}
187 }
188 onClicked: {
189- poiSearchField.text = ""
190- poiPage.header = standardHeader
191+ goBackSearchMode()
192 mainPageStack.push(Qt.resolvedUrl("PoiListPage.qml"), {
193 lat: poiPage.lat,
194 lng: poiPage.lng,
195@@ -197,5 +203,10 @@
196 }
197 }
198 }
199+
200+ Scrollbar {
201+ flickableItem: categoryList
202+ align: Qt.AlignTrailing
203+ }
204 }
205

Subscribers

People subscribed via source and target branches