Merge lp:~nik90/ubuntu-weather-app/finish-listitem-migration into lp:ubuntu-weather-app

Proposed by Nekhelesh Ramananthan
Status: Rejected
Rejected by: Victor Thompson
Proposed branch: lp:~nik90/ubuntu-weather-app/finish-listitem-migration
Merge into: lp:ubuntu-weather-app
Diff against target: 1514 lines (+224/-973)
15 files modified
app/components/CMakeLists.txt (+0/-2)
app/components/FakeHeader.qml (+39/-0)
app/components/ListItemActions/CMakeLists.txt (+0/-5)
app/components/ListItemActions/CheckBox.qml (+0/-25)
app/components/ListItemActions/Remove.qml (+0/-27)
app/components/ListItemReorderComponent.qml (+0/-106)
app/components/ListItemWithActions.qml (+0/-496)
app/components/MultiSelectHeadState.qml (+0/-72)
app/components/MultiSelectListView.qml (+27/-8)
app/components/PageWithBottomEdge.qml (+68/-18)
app/components/WeatherListItem.qml (+0/-137)
app/components/WeatherListView.qml (+1/-2)
app/ui/LocationsPage.qml (+82/-53)
po/com.ubuntu.weather.pot (+6/-22)
ubuntu-weather-app.desktop.in.in (+1/-0)
To merge this branch: bzr merge lp:~nik90/ubuntu-weather-app/finish-listitem-migration
Reviewer Review Type Date Requested Status
Nekhelesh Ramananthan (community) Disapprove
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Victor Thompson Needs Fixing
Review via email: mp+263136@code.launchpad.net

Commit message

* Finished the migration to the new SDK list items
* Locked weather app in the Portrait orientation until we get some landscape designs
* Made the page with bottom edge animation less jarring when it reaches the top by adding a fake header (similar to what the clock app does)

Description of the change

This MP implements the following,

* Finish the migration to the new SDK list items
* Lock weather app in the Portrait orientation until we get some landscape designs
* Make the page with bottom edge animation less jarring when it reaches the top by adding a fake header (similar to what the clock app does)

To post a comment you must log in.
64. By Nekhelesh Ramananthan

Fixed copyright header formatting in fakeheader.qml

65. By Nekhelesh Ramananthan

removed multiselect head state as it was no longer used

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
66. By Nekhelesh Ramananthan

Fixed locations names not eliding in locations page

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
67. By Nekhelesh Ramananthan

Changed multi-delete to use the removeMultiLocations() function

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

I consider this MP to be complete now. Please note the following,

- In trunk, there is a selectAll header button which is shown. Also pressing on the list item selects/deselects it.

This behaviour has not been implemented intentionally due to a bug [1] which I observed in a couple of apps now. I discussed this with Andrew Hayzen, and it turns out this bug is also present in his music-app MP [2]. So this issue is a SDK one and does not matter on the implementation which is a bit different between this MP and andrew's.

[1] https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1469471
[2] https://code.launchpad.net/~ahayzen/music-app/refactor-use-sdk-listitems/+merge/261328

Revision history for this message
Victor Thompson (vthompson) wrote :

Currently, there is no trailing divider in the LocationsPage.

The margins of the list items in the LocationsPage has been reduced in this MP--is that intentional?

Can we add a Select all/none toggle action to the multiselection on the LocationsPage?

The settings page always seems to have the list items offset/partially down the page. This was introduced in the previous mp. Can we fix this behaviour?

I see a lot of instances of the following error message, can we fix this?

file:///usr/lib/x86_64-linux-gnu/qt5/qml/Ubuntu/Components/Themes/Ambiance/PullToRefreshStyle.qml:94: TypeError: Cannot read property of null

review: Needs Fixing
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

> Currently, there is no trailing divider in the LocationsPage.
>

Btw were you referring to the divider of the trailing swipe actions? Or for the listitem as a whole?

I believe the default behaviour of the new listitems and UbuntuListView is to *not* show a divider for the very last item of the listview. If you add more locations, you will notice the divider being shown.

> The margins of the list items in the LocationsPage has been reduced in this MP
> --is that intentional?
>

Nope, I will fix this.

> Can we add a Select all/none toggle action to the multiselection on the
> LocationsPage?

I'm afraid I can't. I have explained the reasoning at https://code.launchpad.net/~nik90/ubuntu-weather-app/finish-listitem-migration/+merge/263136/comments/659644. (it introduces another SDK bug which has been reported).

>
> The settings page always seems to have the list items offset/partially down
> the page. This was introduced in the previous mp. Can we fix this behaviour?
>

This is something I have noticed while testing on rc-proposed channel. And not with the my BQ E4.5 runnign the stable channel. I can check with t1mp tomorrow as to why this is the case. And yes same behavior observed with Podbird while testing on Nexus 4 and BQ.

> I see a lot of instances of the following error message, can we fix this?
>
> file:///usr/lib/x86_64-linux-
> gnu/qt5/qml/Ubuntu/Components/Themes/Ambiance/PullToRefreshStyle.qml:94:
> TypeError: Cannot read property of null

I believe this is a SDK error message that is seen in other apps as well. I haven't changed the PullToRefresh component.

Revision history for this message
Victor Thompson (vthompson) wrote :

For that first comment, I was talking about the ListItem as a whole. While that may be the default, it is inconsistent with the listitems in the rest of the app. Also, and this is subjective, I think it looks kinda odd without a divider below the final item.

Revision history for this message
Victor Thompson (vthompson) wrote :

Nik, I have a fix for the settings page ListItems being "offset" [1]. So you probably don't need to ping t1mp.

1 - https://code.launchpad.net/~vthompson/ubuntu-weather-app/reboot-fix-settings-listitems-offset/+merge/263206

68. By Nekhelesh Ramananthan

merged lp:ubuntu-weather-app/reboot

69. By Nekhelesh Ramananthan

Added thindivider to the last listitem

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

@Victor, I added the thindivider to the last list item. Going over the stuff you wanted fixed,

- On looking closer, the margins of the listitems in the locations Page look the same to me. I also cross-checked with design and it looks the same. If you were referring to the margins during the multi-select mode, then yes that's changed and that's because the SDK draws the checkbox and the drag handler. I cannot change their margins I am afraid.

- After merging trunk, I am noticing the following error while deleting a location. I am unable to delete a location. On further testing, it seems commit 57 in trunk seems to be causing it. Can we get that reverted pls?

file:///opt/click.ubuntu.com/com.ubuntu.weather/3.0./share/qml/ubuntu-weather-app.qml:256: TypeError: Cannot read property 'db' of undefined

All other issues have been addressed except for the newly cropped delete issue.

review: Needs Fixing
Revision history for this message
Victor Thompson (vthompson) wrote :

I don't think that error is being caused by commit 57. Do you not have the API key and are using TWC perhaps?

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

> I don't think that error is being caused by commit 57. Do you not have the API
> key and are using TWC perhaps?

I cannot remember where I placed the API key, but I do all my testing with the OpenWeatherMap data provider. Also I can add locations and also see the weather data correctly. I am having trouble with only deleting locations. How can that be related to the API key or data provider?

Revision history for this message
Victor Thompson (vthompson) wrote :

Andrew had seen the same error when he wasn't able to talk to the API (wifi and data were off) and had GPS/location detection turned off.

Maybe the issue is that you've tested with the migration done in commit 57, went back, and then tested with it in place again? Perhaps change addedCurrentLocation in "~/.config/com.ubuntu.weather/com.ubuntu.weather.conf" to false and rerun.

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

What is your workflow? Where do you copy the key.js file to ensure that TheWeatherChannel API works? Either way don't you think it is an issue that with wifi/data/GPS off, deleting a location deletes some other random location? First of all I cannot wrap my head around how deleting a location is remotely connected to having wifi/data/GPS off. Its not like we report back to TheWeatherChannel when a user deletes a location. Somehow I am not happy with the way the storage is implemented.

Feel free to continue this branch. As far I can tell I simply migrated to the new listitems and used the same storage functions calls as before. I cannot resolve this bug.

review: Disapprove
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

And yes I tried starting with a clean setup by removing all existing databases and config files.

Unmerged revisions

69. By Nekhelesh Ramananthan

Added thindivider to the last listitem

68. By Nekhelesh Ramananthan

merged lp:ubuntu-weather-app/reboot

67. By Nekhelesh Ramananthan

Changed multi-delete to use the removeMultiLocations() function

66. By Nekhelesh Ramananthan

Fixed locations names not eliding in locations page

65. By Nekhelesh Ramananthan

removed multiselect head state as it was no longer used

64. By Nekhelesh Ramananthan

Fixed copyright header formatting in fakeheader.qml

63. By Nekhelesh Ramananthan

Lock orientation to portrait

62. By Nekhelesh Ramananthan

Removed more unnecessary components now that we have migrated to the new sdk listitems

61. By Nekhelesh Ramananthan

Implemented reorder support

60. By Nekhelesh Ramananthan

Removed unnecessary ListItemWithActions.qml and WeatherListItem.qml

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/components/CMakeLists.txt'
2--- app/components/CMakeLists.txt 2015-03-03 18:37:59 +0000
3+++ app/components/CMakeLists.txt 2015-06-29 10:16:30 +0000
4@@ -1,5 +1,3 @@
5-add_subdirectory(ListItemActions)
6-
7 file(GLOB COMPONENTS_QML_JS_FILES *.qml *.js)
8
9 add_custom_target(ubuntu-weather-app_components_QMlFiles ALL SOURCES ${COMPONENTS_QML_JS_FILES})
10
11=== added file 'app/components/FakeHeader.qml'
12--- app/components/FakeHeader.qml 1970-01-01 00:00:00 +0000
13+++ app/components/FakeHeader.qml 2015-06-29 10:16:30 +0000
14@@ -0,0 +1,39 @@
15+/*
16+ * Copyright (C) 2014 Canonical Ltd
17+ *
18+ * This file is part of Ubuntu Clock App
19+ *
20+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
21+ * it under the terms of the GNU General Public License version 3 as
22+ * published by the Free Software Foundation.
23+ *
24+ * Ubuntu Clock App is distributed in the hope that it will be useful,
25+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
26+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27+ * GNU General Public License for more details.
28+ *
29+ * You should have received a copy of the GNU General Public License
30+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
31+ */
32+
33+import QtQuick 2.4
34+import Ubuntu.Components 1.2
35+
36+Column {
37+ id: fakeHeader
38+
39+ height: units.gu(9)
40+
41+ Rectangle {
42+ height: units.gu(7)
43+ width: parent.width
44+ color: Theme.palette.normal.background
45+ }
46+
47+ Rectangle {
48+ color: "#C9C9C9"
49+ height: units.gu(2)
50+ anchors.left: parent.left
51+ anchors.right: parent.right
52+ }
53+}
54
55=== removed directory 'app/components/ListItemActions'
56=== removed file 'app/components/ListItemActions/CMakeLists.txt'
57--- app/components/ListItemActions/CMakeLists.txt 2015-03-03 18:37:59 +0000
58+++ app/components/ListItemActions/CMakeLists.txt 1970-01-01 00:00:00 +0000
59@@ -1,5 +0,0 @@
60-file(GLOB LISTITEMACTIONS_QML_JS_FILES *.qml *.js)
61-
62-add_custom_target(ubuntu-weather-app_listitemactions_QMlFiles ALL SOURCES ${LISTITEMACTIONS_QML_JS_FILES})
63-
64-install(FILES ${LISTITEMACTIONS_QML_JS_FILES} DESTINATION ${UBUNTU-WEATHER_APP_DIR}/components/ListItemActions)
65
66=== removed file 'app/components/ListItemActions/CheckBox.qml'
67--- app/components/ListItemActions/CheckBox.qml 2015-06-18 01:45:57 +0000
68+++ app/components/ListItemActions/CheckBox.qml 1970-01-01 00:00:00 +0000
69@@ -1,25 +0,0 @@
70-/*
71- * Copyright (C) 2012-2014, 2015 Canonical, Ltd.
72- *
73- * This program is free software; you can redistribute it and/or modify
74- * it under the terms of the GNU General Public License as published by
75- * the Free Software Foundation; version 3.
76- *
77- * This program is distributed in the hope that it will be useful,
78- * but WITHOUT ANY WARRANTY; without even the implied warranty of
79- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
80- * GNU General Public License for more details.
81- *
82- * You should have received a copy of the GNU General Public License
83- * along with this program. If not, see <http://www.gnu.org/licenses/>.
84- */
85-
86-import QtQuick 2.4
87-import Ubuntu.Components 1.2
88-
89-CheckBox {
90- checked: root.selected
91- width: implicitWidth
92- // disable item mouse area to avoid conflicts with parent mouse area
93- __mouseArea.enabled: false
94-}
95
96=== removed file 'app/components/ListItemActions/Remove.qml'
97--- app/components/ListItemActions/Remove.qml 2015-06-18 01:42:03 +0000
98+++ app/components/ListItemActions/Remove.qml 1970-01-01 00:00:00 +0000
99@@ -1,27 +0,0 @@
100-/*
101- * Copyright (C) 2014, 2015 Andrew Hayzen <ahayzen@gmail.com>
102- * Daniel Holm <d.holmen@gmail.com>
103- * Victor Thompson <victor.thompson@gmail.com>
104- *
105- * This program is free software; you can redistribute it and/or modify
106- * it under the terms of the GNU General Public License as published by
107- * the Free Software Foundation; version 3.
108- *
109- * This program is distributed in the hope that it will be useful,
110- * but WITHOUT ANY WARRANTY; without even the implied warranty of
111- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
112- * GNU General Public License for more details.
113- *
114- * You should have received a copy of the GNU General Public License
115- * along with this program. If not, see <http://www.gnu.org/licenses/>.
116- */
117-
118-import QtQuick 2.4
119-import Ubuntu.Components 1.2
120-
121-Action {
122- id: removeAction
123- iconName: "delete"
124- objectName: "swipeDeleteAction"
125- text: i18n.tr("Remove")
126-}
127
128=== removed file 'app/components/ListItemReorderComponent.qml'
129--- app/components/ListItemReorderComponent.qml 2015-06-18 01:42:03 +0000
130+++ app/components/ListItemReorderComponent.qml 1970-01-01 00:00:00 +0000
131@@ -1,106 +0,0 @@
132-/*
133- * Copyright (C) 2013, 2014, 2015
134- * Andrew Hayzen <ahayzen@gmail.com>
135- * Nekhelesh Ramananthan <krnekhelesh@gmail.com>
136- * Victor Thompson <victor.thompson@gmail.com>
137- *
138- * This program is free software; you can redistribute it and/or modify
139- * it under the terms of the GNU General Public License as published by
140- * the Free Software Foundation; version 3.
141- *
142- * This program is distributed in the hope that it will be useful,
143- * but WITHOUT ANY WARRANTY; without even the implied warranty of
144- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
145- * GNU General Public License for more details.
146- *
147- * You should have received a copy of the GNU General Public License
148- * along with this program. If not, see <http://www.gnu.org/licenses/>.
149- */
150-
151-import QtQuick 2.4
152-import Ubuntu.Components 1.2
153-
154-
155-Item {
156- id: actionReorder
157- width: units.gu(4)
158-
159- Icon {
160- anchors {
161- horizontalCenter: parent.horizontalCenter
162- verticalCenter: parent.verticalCenter
163- }
164- name: "navigation-menu" // TODO: use proper image
165- height: width
166- width: units.gu(3)
167- }
168-
169- MouseArea {
170- id: actionReorderMouseArea
171- anchors {
172- fill: parent
173- }
174- property int startY: 0
175- property int startContentY: 0
176-
177- onPressed: {
178- root.parent.parent.interactive = false; // stop scrolling of listview
179- startY = root.y;
180- startContentY = root.parent.parent.contentY;
181- root.z += 10; // force ontop of other elements
182-
183- console.debug("Reorder listitem pressed", root.y)
184- }
185- onMouseYChanged: root.y += mouse.y - (root.height / 2);
186- onReleased: {
187- console.debug("Reorder diff by position", getDiff());
188-
189- var diff = getDiff();
190-
191- // Remove the height of the actual item if moved down
192- if (diff > 0) {
193- diff -= 1;
194- }
195-
196- root.parent.parent.interactive = true; // reenable scrolling
197-
198- if (diff === 0) {
199- // Nothing has changed so reset the item
200- // z index is restored after animation
201- resetListItemYAnimation.start();
202- }
203- else {
204- var newIndex = index + diff;
205-
206- if (newIndex < 0) {
207- newIndex = 0;
208- }
209- else if (newIndex > root.parent.parent.count - 1) {
210- newIndex = root.parent.parent.count - 1;
211- }
212-
213- root.z -= 10; // restore z index
214- reorder(index, newIndex)
215- }
216- }
217-
218- function getDiff() {
219- // Get the amount of items that have been passed over (by centre)
220- return Math.round((((root.y - startY) + (root.parent.parent.contentY - startContentY)) / root.height) + 0.5);
221- }
222- }
223-
224- SequentialAnimation {
225- id: resetListItemYAnimation
226- UbuntuNumberAnimation {
227- target: root;
228- property: "y";
229- to: actionReorderMouseArea.startY
230- }
231- ScriptAction {
232- script: {
233- root.z -= 10; // restore z index
234- }
235- }
236- }
237-}
238
239=== removed file 'app/components/ListItemWithActions.qml'
240--- app/components/ListItemWithActions.qml 2015-06-18 01:42:03 +0000
241+++ app/components/ListItemWithActions.qml 1970-01-01 00:00:00 +0000
242@@ -1,496 +0,0 @@
243-/*
244- * Copyright (C) 2012-2015 Canonical, Ltd.
245- *
246- * This program is free software; you can redistribute it and/or modify
247- * it under the terms of the GNU General Public License as published by
248- * the Free Software Foundation; version 3.
249- *
250- * This program is distributed in the hope that it will be useful,
251- * but WITHOUT ANY WARRANTY; without even the implied warranty of
252- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
253- * GNU General Public License for more details.
254- *
255- * You should have received a copy of the GNU General Public License
256- * along with this program. If not, see <http://www.gnu.org/licenses/>.
257- */
258-
259-import QtQuick 2.4
260-import Ubuntu.Components 1.2
261-import Ubuntu.Components.ListItems 1.0 as ListItem
262-
263-
264-Item {
265- id: root
266- width: parent.width
267-
268- property Action leftSideAction: null
269- property list<Action> rightSideActions
270- property double defaultHeight: units.gu(8)
271- property bool locked: false
272- property Action activeAction: null
273- property var activeItem: null
274- property bool triggerActionOnMouseRelease: false
275- property color color: Theme.palette.normal.background
276- property color selectedColor: "#E6E6E6"
277- property bool selected: false
278- property bool selectionMode: false
279- property alias internalAnchors: mainContents.anchors
280- default property alias contents: mainContents.children
281-
282- readonly property double actionWidth: units.gu(4)
283- readonly property double leftActionWidth: units.gu(10)
284- readonly property double actionThreshold: actionWidth * 0.4
285- readonly property double threshold: 0.4
286- readonly property string swipeState: main.x == 0 ? "Normal" : main.x > 0 ? "LeftToRight" : "RightToLeft"
287- readonly property alias swipping: mainItemMoving.running
288- readonly property bool _showActions: mouseArea.pressed || swipeState != "Normal" || swipping
289-
290- property alias _main: main // CUSTOM
291- property alias pressed: mouseArea.pressed // CUSTOM
292-
293- /* internal */
294- property var _visibleRightSideActions: filterVisibleActions(rightSideActions)
295-
296- signal itemClicked(var mouse)
297- signal itemPressAndHold(var mouse)
298-
299- function returnToBoundsRTL(direction)
300- {
301- var actionFullWidth = actionWidth + units.gu(2)
302-
303- // go back to normal state if swipping reverse
304- if (direction === "LTR") {
305- updatePosition(0)
306- return
307- } else if (!triggerActionOnMouseRelease) {
308- updatePosition(-rightActionsView.width + units.gu(2))
309- return
310- }
311-
312- var xOffset = Math.abs(main.x)
313- var index = Math.min(Math.floor(xOffset / actionFullWidth), _visibleRightSideActions.length)
314- var newX = 0
315-
316- if (index === _visibleRightSideActions.length) {
317- newX = -(rightActionsView.width - units.gu(2))
318- } else if (index >= 1) {
319- newX = -(actionFullWidth * index)
320- }
321-
322- updatePosition(newX)
323- }
324-
325- function returnToBoundsLTR(direction)
326- {
327- var finalX = leftActionWidth
328- if ((direction === "RTL") || (main.x <= (finalX * root.threshold)))
329- finalX = 0
330- updatePosition(finalX)
331- }
332-
333- function returnToBounds(direction)
334- {
335- if (main.x < 0) {
336- returnToBoundsRTL(direction)
337- } else if (main.x > 0) {
338- returnToBoundsLTR(direction)
339- } else {
340- updatePosition(0)
341- }
342- }
343-
344- function contains(item, point, marginX)
345- {
346- var itemStartX = item.x - marginX
347- var itemEndX = item.x + item.width + marginX
348- return (point.x >= itemStartX) && (point.x <= itemEndX) &&
349- (point.y >= item.y) && (point.y <= (item.y + item.height));
350- }
351-
352- function getActionAt(point)
353- {
354- if (leftSideAction && contains(leftActionViewLoader.item, point, 0)) {
355- return leftSideAction
356- } else if (contains(rightActionsView, point, 0)) {
357- var newPoint = root.mapToItem(rightActionsView, point.x, point.y)
358- for (var i = 0; i < rightActionsRepeater.count; i++) {
359- var child = rightActionsRepeater.itemAt(i)
360- if (contains(child, newPoint, units.gu(1))) {
361- return i
362- }
363- }
364- }
365- return -1
366- }
367-
368- function updateActiveAction()
369- {
370- if (triggerActionOnMouseRelease &&
371- (main.x <= -(root.actionWidth + units.gu(2))) &&
372- (main.x > -(rightActionsView.width - units.gu(2)))) {
373- var actionFullWidth = actionWidth + units.gu(2)
374- var xOffset = Math.abs(main.x)
375- var index = Math.min(Math.floor(xOffset / actionFullWidth), _visibleRightSideActions.length)
376- index = index - 1
377- if (index > -1) {
378- root.activeItem = rightActionsRepeater.itemAt(index)
379- root.activeAction = root._visibleRightSideActions[index]
380- }
381- } else {
382- root.activeAction = null
383- }
384- }
385-
386- function resetSwipe()
387- {
388- updatePosition(0)
389- }
390-
391- function filterVisibleActions(actions)
392- {
393- var visibleActions = []
394- for(var i = 0; i < actions.length; i++) {
395- var action = actions[i]
396- if (action.visible) {
397- visibleActions.push(action)
398- }
399- }
400- return visibleActions
401- }
402-
403- function updatePosition(pos)
404- {
405- if (!root.triggerActionOnMouseRelease && (pos !== 0)) {
406- mouseArea.state = pos > 0 ? "RightToLeft" : "LeftToRight"
407- } else {
408- mouseArea.state = ""
409- }
410- main.x = pos
411- }
412-
413- // CUSTOM remove animation
414- SequentialAnimation {
415- id: removeAnimation
416-
417- property var action
418-
419- UbuntuNumberAnimation {
420- target: root
421- duration: UbuntuAnimation.BriskDuration
422- property: "height";
423- to: 0
424- }
425- ScriptAction {
426- script: removeAnimation.action.trigger()
427- }
428- }
429-
430- states: [
431- State {
432- name: "select"
433- when: selectionMode || selected
434- PropertyChanges {
435- target: selectionIcon
436- source: Qt.resolvedUrl("ListItemActions/CheckBox.qml")
437- anchors.leftMargin: units.gu(2)
438- }
439- PropertyChanges {
440- target: root
441- locked: true
442- }
443- PropertyChanges {
444- target: main
445- x: 0
446- }
447- }
448- ]
449-
450- height: defaultHeight
451- //clip: height !== defaultHeight // CUSTOM
452-
453- Loader { // CUSTOM
454- id: leftActionViewLoader
455- anchors {
456- top: parent.top
457- bottom: parent.bottom
458- right: main.left
459- }
460- asynchronous: true
461- sourceComponent: leftSideAction ? leftActionViewComponent : undefined
462- }
463-
464- Component { // CUSTOM
465- id: leftActionViewComponent
466-
467- Rectangle {
468- id: leftActionView
469- width: root.leftActionWidth + actionThreshold
470- color: UbuntuColors.red
471-
472- Icon {
473- id: leftActionIcon
474- anchors {
475- centerIn: parent
476- horizontalCenterOffset: actionThreshold / 2
477- }
478- objectName: "swipeDeleteAction" // CUSTOM
479- name: leftSideAction && _showActions ? leftSideAction.iconName : ""
480- color: Theme.palette.selected.field
481- height: units.gu(3)
482- width: units.gu(3)
483- }
484- }
485- }
486-
487- //Rectangle {
488- Item { // CUSTOM
489- id: rightActionsView
490-
491- anchors {
492- top: main.top
493- left: main.right
494- bottom: main.bottom
495- }
496- visible: _visibleRightSideActions.length > 0
497- width: rightActionsRepeater.count > 0 ? rightActionsRepeater.count * (root.actionWidth + units.gu(2)) + root.actionThreshold + units.gu(2) : 0
498- // color: "white" // CUSTOM
499-
500- Row {
501- anchors{
502- top: parent.top
503- left: parent.left
504- leftMargin: units.gu(2)
505- right: parent.right
506- rightMargin: units.gu(2)
507- bottom: parent.bottom
508- }
509- spacing: units.gu(2)
510- Repeater {
511- id: rightActionsRepeater
512-
513- model: _showActions ? _visibleRightSideActions : []
514- Item {
515- property alias image: img
516-
517- height: rightActionsView.height
518- width: root.actionWidth
519-
520- Icon {
521- id: img
522-
523- anchors.centerIn: parent
524- objectName: rightSideActions[index].objectName // CUSTOM
525- width: units.gu(3)
526- height: units.gu(3)
527- name: modelData.iconName
528- color: root.activeAction === modelData ? UbuntuColors.orange : UbuntuColors.coolGrey // CUSTOM
529- }
530- }
531- }
532- }
533- }
534-
535- Rectangle {
536- id: main
537- objectName: "mainItem"
538-
539- anchors {
540- top: parent.top
541- bottom: parent.bottom
542- }
543-
544- width: parent.width
545- color: root.selected ? root.selectedColor : root.color
546-
547- Loader {
548- id: selectionIcon
549-
550- anchors {
551- left: main.left
552- verticalCenter: main.verticalCenter
553- }
554- asynchronous: true // CUSTOM
555- width: (status === Loader.Ready) ? item.implicitWidth : 0
556- visible: (status === Loader.Ready) && (item.width === item.implicitWidth)
557-
558- Behavior on width {
559- NumberAnimation {
560- duration: UbuntuAnimation.SnapDuration
561- }
562- }
563- }
564-
565- Item {
566- id: mainContents
567-
568- anchors {
569- left: selectionIcon.right
570- //leftMargin: units.gu(2) // CUSTOM
571- top: parent.top
572- //topMargin: units.gu(1) // CUSTOM
573- right: parent.right
574- //rightMargin: units.gu(2) // CUSTOM
575- bottom: parent.bottom
576- //bottomMargin: units.gu(1) // CUSTOM
577- }
578- }
579-
580- Behavior on x {
581- UbuntuNumberAnimation {
582- id: mainItemMoving
583-
584- easing.type: Easing.OutElastic
585- duration: UbuntuAnimation.SlowDuration
586- }
587- }
588- }
589-
590- SequentialAnimation {
591- id: triggerAction
592-
593- property var currentItem: root.activeItem ? root.activeItem.image : null
594-
595- running: false
596- ParallelAnimation {
597- UbuntuNumberAnimation {
598- target: triggerAction.currentItem
599- property: "opacity"
600- from: 1.0
601- to: 0.0
602- duration: UbuntuAnimation.SlowDuration
603- easing {type: Easing.InOutBack; }
604- }
605- UbuntuNumberAnimation {
606- target: triggerAction.currentItem
607- properties: "width, height"
608- from: units.gu(3)
609- to: root.actionWidth
610- duration: UbuntuAnimation.SlowDuration
611- easing {type: Easing.InOutBack; }
612- }
613- }
614- PropertyAction {
615- target: triggerAction.currentItem
616- properties: "width, height"
617- value: units.gu(3)
618- }
619- PropertyAction {
620- target: triggerAction.currentItem
621- properties: "opacity"
622- value: 1.0
623- }
624- ScriptAction {
625- script: {
626- root.activeAction.triggered(root)
627- mouseArea.state = ""
628- }
629- }
630- PauseAnimation {
631- duration: 500
632- }
633- UbuntuNumberAnimation {
634- target: main
635- property: "x"
636- to: 0
637- }
638- }
639-
640- MouseArea {
641- id: mouseArea
642-
643- property bool locked: root.locked || ((root.leftSideAction === null) && (root._visibleRightSideActions.count === 0)) // CUSTOM
644- property bool manual: false
645- property string direction: "None"
646- property real lastX: -1
647-
648- anchors.fill: parent
649- drag {
650- target: locked ? null : main
651- axis: Drag.XAxis
652- minimumX: rightActionsView.visible ? -(rightActionsView.width) : 0
653- maximumX: leftSideAction ? leftActionViewLoader.item.width : 0
654- threshold: root.actionThreshold
655- }
656-
657- states: [
658- State {
659- name: "LeftToRight"
660- PropertyChanges {
661- target: mouseArea
662- drag.maximumX: 0
663- }
664- },
665- State {
666- name: "RightToLeft"
667- PropertyChanges {
668- target: mouseArea
669- drag.minimumX: 0
670- }
671- }
672- ]
673-
674- onMouseXChanged: {
675- var offset = (lastX - mouseX)
676- if (Math.abs(offset) <= root.actionThreshold) {
677- return
678- }
679- lastX = mouseX
680- direction = offset > 0 ? "RTL" : "LTR";
681- }
682-
683- onPressed: {
684- lastX = mouse.x
685- }
686-
687- onReleased: {
688- if (root.triggerActionOnMouseRelease && root.activeAction) {
689- triggerAction.start()
690- } else {
691- root.returnToBounds()
692- root.activeAction = null
693- }
694- lastX = -1
695- direction = "None"
696- }
697- onClicked: {
698- if (selectionMode) { // CUSTOM - selecting a listitem should toggle selection if in selectionMode
699- selected = !selected
700- return
701- } else if (main.x === 0) {
702- root.itemClicked(mouse)
703- } else if (main.x > 0) {
704- var action = getActionAt(Qt.point(mouse.x, mouse.y))
705- if (action && action !== -1) {
706- //action.triggered(root)
707- removeAnimation.action = action // CUSTOM - use our animation instead
708- removeAnimation.start() // CUSTOM
709- }
710- } else {
711- var actionIndex = getActionAt(Qt.point(mouse.x, mouse.y))
712-
713- if (actionIndex !== -1 && actionIndex !== leftSideAction) { // CUSTOM - can be leftAction
714- root.activeItem = rightActionsRepeater.itemAt(actionIndex)
715- root.activeAction = root.rightSideActions[actionIndex]
716- triggerAction.start()
717- return
718- }
719- }
720- root.resetSwipe()
721- }
722-
723- onPositionChanged: {
724- if (mouseArea.pressed) {
725- updateActiveAction()
726-
727- listItemSwiping(index) // CUSTOM - tells other listitems to dismiss any swipe
728- }
729- }
730- onPressAndHold: {
731- if (main.x === 0) {
732- root.itemPressAndHold(mouse)
733- }
734- }
735-
736- z: -1
737- }
738-}
739
740=== removed file 'app/components/MultiSelectHeadState.qml'
741--- app/components/MultiSelectHeadState.qml 2015-06-18 01:42:03 +0000
742+++ app/components/MultiSelectHeadState.qml 1970-01-01 00:00:00 +0000
743@@ -1,72 +0,0 @@
744-/*
745- * Copyright (C) 2015
746- * Andrew Hayzen <ahayzen@gmail.com>
747- * Victor Thompson <victor.thompson@gmail.com>
748- *
749- * This program is free software; you can redistribute it and/or modify
750- * it under the terms of the GNU General Public License as published by
751- * the Free Software Foundation; version 3.
752- *
753- * This program is distributed in the hope that it will be useful,
754- * but WITHOUT ANY WARRANTY; without even the implied warranty of
755- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
756- * GNU General Public License for more details.
757- *
758- * You should have received a copy of the GNU General Public License
759- * along with this program. If not, see <http://www.gnu.org/licenses/>.
760- */
761-
762-import QtQuick 2.4
763-import Ubuntu.Components 1.2
764-
765-PageHeadState {
766- id: selectionState
767- actions: [
768- Action {
769- iconName: "select"
770- text: i18n.tr("Select All")
771- onTriggered: {
772- if (listview.selectedItems.length === listview.model.count) {
773- listview.clearSelection()
774- } else {
775- listview.selectAll()
776- }
777- }
778- },
779- Action {
780- enabled: listview.selectedItems.length > 0
781- iconName: "delete"
782- text: i18n.tr("Delete")
783- visible: removable
784-
785- onTriggered: {
786- removed(listview.selectedItems)
787-
788- listview.closeSelection()
789- }
790- }
791-
792- ]
793- backAction: Action {
794- text: i18n.tr("Cancel selection")
795- iconName: "back"
796- onTriggered: {
797- listview.clearSelection()
798- listview.state = "normal"
799- }
800- }
801- head: thisPage.head
802- name: "selection"
803-
804- PropertyChanges {
805- target: thisPage.head
806- backAction: selectionState.backAction
807- actions: selectionState.actions
808- }
809-
810- property ListView listview
811- property bool removable: false
812- property Page thisPage
813-
814- signal removed(var selectedItems)
815-}
816
817=== modified file 'app/components/MultiSelectListView.qml'
818--- app/components/MultiSelectListView.qml 2015-06-18 01:42:03 +0000
819+++ app/components/MultiSelectListView.qml 2015-06-29 10:16:30 +0000
820@@ -20,21 +20,24 @@
821 import QtQuick 2.4
822 import Ubuntu.Components 1.2
823
824-
825 WeatherListView {
826- property var selectedItems: []
827-
828 signal clearSelection()
829 signal closeSelection()
830 signal selectAll()
831-
832- onClearSelection: selectedItems = []
833+ signal reorder(int from, int to)
834+
835+ onClearSelection: {
836+ ViewItems.selectedIndices = []
837+ }
838+
839 onCloseSelection: {
840 clearSelection()
841- state = "normal"
842+ ViewItems.selectMode = false
843+ ViewItems.dragMode = false
844 }
845+
846 onSelectAll: {
847- var tmp = selectedItems
848+ var tmp = []
849
850 for (var i=0; i < model.count; i++) {
851 if (tmp.indexOf(i) === -1) {
852@@ -42,11 +45,27 @@
853 }
854 }
855
856- selectedItems = tmp
857+ ViewItems.selectedIndices = tmp
858 }
859+
860 onVisibleChanged: {
861 if (!visible) {
862 closeSelection()
863 }
864 }
865+
866+ moveDisplaced: Transition {
867+ UbuntuNumberAnimation {
868+ property: "y"
869+ }
870+ }
871+
872+ ViewItems.onDragUpdated: {
873+ if (event.status === ListItemDrag.Moving) {
874+ event.accept = false
875+ } else if (event.status === ListItemDrag.Dropped) {
876+ model.move(event.from, event.to, 1)
877+ reorder(event.from, event.to)
878+ }
879+ }
880 }
881
882=== modified file 'app/components/PageWithBottomEdge.qml'
883--- app/components/PageWithBottomEdge.qml 2015-06-18 01:45:57 +0000
884+++ app/components/PageWithBottomEdge.qml 2015-06-29 10:16:30 +0000
885@@ -77,7 +77,7 @@
886 property bool reloadBottomEdgePage: true
887
888 readonly property alias bottomEdgePage: edgeLoader.item
889- readonly property bool isReady: ((bottomEdge.y === 0) && bottomEdgePageLoaded && edgeLoader.item.active)
890+ readonly property bool isReady: ((bottomEdge.y === fakeHeader.height) && bottomEdgePageLoaded && edgeLoader.item.active)
891 readonly property bool isCollapsed: (bottomEdge.y === page.height)
892 readonly property bool bottomEdgePageLoaded: (edgeLoader.status == Loader.Ready)
893
894@@ -91,7 +91,6 @@
895 signal bottomEdgeReleased()
896 signal bottomEdgeDismissed()
897
898-
899 function showBottomEdgePage(source, properties)
900 {
901 edgeLoader.setSource(source, properties)
902@@ -152,6 +151,9 @@
903
904 property bool hidden: (activeFocus === false) || ((bottomEdge.y - units.gu(1)) < tip.y)
905
906+ // CUSTOM
907+ property bool isAnimating: true
908+
909 enabled: mouseArea.enabled
910 visible: page.bottomEdgeEnabled
911 anchors {
912@@ -167,6 +169,10 @@
913 UbuntuNumberAnimation {
914 duration: UbuntuAnimation.SnapDuration
915 }
916+ // CUSTOM
917+ ScriptAction {
918+ script: tip.isAnimating = false
919+ }
920 }
921 }
922 }
923@@ -232,7 +238,6 @@
924 left: parent.left
925 right: parent.right
926 bottom: parent.bottom
927-
928 }
929 height: bottomEdge.tipHeight
930 z: 1
931@@ -265,12 +270,31 @@
932 }
933 }
934
935+ // CUSTOM fake header to make the page with bottom edge transition smoother
936+ FakeHeader {
937+ id: fakeHeader
938+
939+ anchors {
940+ left: parent.left
941+ right: parent.right
942+ }
943+ y: -fakeHeader.height + (fakeHeader.height * (page.height - bottomEdge.y)) / (page.height - fakeHeader.height)
944+ z: bgVisual.z + 1
945+
946+ Behavior on y {
947+ UbuntuNumberAnimation {
948+ duration: UbuntuAnimation.SnapDuration
949+ }
950+ }
951+ }
952+
953 Rectangle {
954 id: bottomEdge
955 objectName: "bottomEdge"
956
957 readonly property int tipHeight: units.gu(3)
958- readonly property int pageStartY: 0
959+ // CUSTOM value
960+ readonly property int pageStartY: fakeHeader.height
961
962 z: 1
963 color: Theme.palette.normal.background
964@@ -281,6 +305,7 @@
965 }
966 height: page.height
967 y: height
968+
969 visible: !page.isCollapsed
970 state: "collapsed"
971 states: [
972@@ -290,6 +315,11 @@
973 target: bottomEdge
974 y: bottomEdge.height
975 }
976+ // CUSTOM
977+ PropertyChanges {
978+ target: fakeHeader
979+ y: -fakeHeader.height
980+ }
981 },
982 State {
983 name: "expanded"
984@@ -297,6 +327,11 @@
985 target: bottomEdge
986 y: bottomEdge.pageStartY
987 }
988+ // CUSTOM
989+ PropertyChanges {
990+ target: fakeHeader
991+ y: 0
992+ }
993 },
994 State {
995 name: "floating"
996@@ -313,12 +348,20 @@
997 to: "expanded"
998 SequentialAnimation {
999 alwaysRunToEnd: true
1000-
1001- SmoothedAnimation {
1002- target: bottomEdge
1003- property: "y"
1004- duration: UbuntuAnimation.FastDuration
1005- easing.type: Easing.Linear
1006+ ParallelAnimation {
1007+ SmoothedAnimation {
1008+ target: bottomEdge
1009+ property: "y"
1010+ duration: UbuntuAnimation.FastDuration
1011+ easing.type: Easing.Linear
1012+ }
1013+ // CUSTOM
1014+ SmoothedAnimation {
1015+ target: fakeHeader
1016+ property: "y"
1017+ duration: UbuntuAnimation.FastDuration
1018+ easing.type: Easing.Linear
1019+ }
1020 }
1021 SmoothedAnimation {
1022 target: edgeLoader
1023@@ -353,17 +396,24 @@
1024 edgeLoader.item.active = false
1025 }
1026 }
1027- SmoothedAnimation {
1028- target: bottomEdge
1029- property: "y"
1030- duration: UbuntuAnimation.SlowDuration
1031+ ParallelAnimation {
1032+ SmoothedAnimation {
1033+ target: bottomEdge
1034+ property: "y"
1035+ duration: UbuntuAnimation.SlowDuration
1036+ }
1037+ // CUSTOM
1038+ SmoothedAnimation {
1039+ target: fakeHeader
1040+ property: "y"
1041+ duration: UbuntuAnimation.SlowDuration
1042+ }
1043 }
1044 ScriptAction {
1045 script: {
1046 // destroy current bottom page
1047 if (page.reloadBottomEdgePage) {
1048 edgeLoader.active = false
1049- // tip will receive focus on page active true
1050 } else {
1051 tip.forceActiveFocus()
1052 }
1053@@ -379,10 +429,10 @@
1054 Transition {
1055 from: "floating"
1056 to: "collapsed"
1057- SmoothedAnimation {
1058+ // MODIFIED
1059+ UbuntuNumberAnimation {
1060 target: bottomEdge
1061- property: "y"
1062- duration: UbuntuAnimation.FastDuration
1063+ property: "opacity"
1064 }
1065 }
1066 ]
1067
1068=== removed file 'app/components/WeatherListItem.qml'
1069--- app/components/WeatherListItem.qml 2015-06-21 15:02:05 +0000
1070+++ app/components/WeatherListItem.qml 1970-01-01 00:00:00 +0000
1071@@ -1,137 +0,0 @@
1072-/*
1073- * Copyright (C) 2013, 2014, 2015
1074- * Andrew Hayzen <ahayzen@gmail.com>
1075- * Nekhelesh Ramananthan <krnekhelesh@gmail.com>
1076- * Victor Thompson <victor.thompson@gmail.com>
1077- *
1078- * This program is free software; you can redistribute it and/or modify
1079- * it under the terms of the GNU General Public License as published by
1080- * the Free Software Foundation; version 3.
1081- *
1082- * This program is distributed in the hope that it will be useful,
1083- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1084- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1085- * GNU General Public License for more details.
1086- *
1087- * You should have received a copy of the GNU General Public License
1088- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1089- */
1090-
1091-import QtQuick 2.4
1092-import Ubuntu.Components 1.2
1093-
1094-ListItemWithActions {
1095- id: root
1096-
1097- property int listItemIndex: index
1098- property bool multiselectable: false
1099- property int previousListItemIndex: -1
1100- property bool reorderable: false
1101-
1102- signal reorder(int from, int to)
1103-
1104- onItemPressAndHold: {
1105- if (multiselectable) {
1106- selectionMode = true
1107- }
1108- }
1109-
1110- onListItemIndexChanged: {
1111- var i = parent.parent.selectedItems.lastIndexOf(previousListItemIndex)
1112-
1113- if (i !== -1) {
1114- parent.parent.selectedItems[i] = listItemIndex
1115- }
1116-
1117- previousListItemIndex = listItemIndex
1118- }
1119-
1120- onSelectedChanged: {
1121- if (selectionMode) {
1122- var tmp = parent.parent.selectedItems
1123-
1124- if (selected) {
1125- if (parent.parent.selectedItems.indexOf(listItemIndex) === -1) {
1126- tmp.push(listItemIndex)
1127- parent.parent.selectedItems = tmp
1128- }
1129- } else {
1130- tmp.splice(parent.parent.selectedItems.indexOf(listItemIndex), 1)
1131- parent.parent.selectedItems = tmp
1132- }
1133- }
1134- }
1135-
1136- onSelectionModeChanged: {
1137- if (reorderable && selectionMode) {
1138- resetSwipe()
1139- }
1140-
1141- for (var j=0; j < _main.children.length; j++) {
1142- if (_main.children[j] !== actionReorderLoader) {
1143- _main.children[j].anchors.rightMargin = reorderable && selectionMode ? actionReorderLoader.width + units.gu(2) : 0
1144- }
1145- }
1146-
1147- parent.parent.state = selectionMode ? "multiselectable" : "normal"
1148-
1149- if (!selectionMode) {
1150- selected = false
1151- }
1152- }
1153-
1154- /* Highlight the listitem on press */
1155- Rectangle {
1156- id: listItemBrighten
1157- color: root.pressed ? UbuntuColors.coolGrey : "transparent"
1158- opacity: 0.1
1159- height: root.height
1160- x: root.x - parent.x // -parent.x due to selectionIcon in ListItemWithActions
1161- width: root.width
1162- }
1163-
1164- /* Reorder Component */
1165- Loader {
1166- id: actionReorderLoader
1167- active: reorderable && selectionMode && root.parent.parent.selectedItems.length === 0
1168- anchors {
1169- bottom: parent.bottom
1170- right: parent.right
1171- rightMargin: units.gu(1)
1172- top: parent.top
1173- }
1174- asynchronous: true
1175- source: "ListItemReorderComponent.qml"
1176- }
1177-
1178- Item {
1179- Connections { // Only allow one ListItem to be swiping at any time
1180- target: weatherApp
1181- onListItemSwiping: {
1182- if (i !== index) {
1183- root.resetSwipe();
1184- }
1185- }
1186- }
1187-
1188- Connections { // Connections from signals in the ListView
1189- target: root.parent.parent
1190- onClearSelection: selected = false
1191- onFlickingChanged: {
1192- if (root.parent.parent.flicking) {
1193- root.resetSwipe()
1194- }
1195- }
1196- onSelectAll: selected = true
1197- onStateChanged: selectionMode = root.parent.parent.state === "multiselectable"
1198- }
1199- }
1200-
1201- Component.onCompleted: { // reload settings as delegates are destroyed
1202- if (parent.parent.selectedItems.indexOf(index) !== -1) {
1203- selected = true
1204- }
1205-
1206- selectionMode = root.parent.parent.state === "multiselectable"
1207- }
1208-}
1209
1210=== modified file 'app/components/WeatherListView.qml'
1211--- app/components/WeatherListView.qml 2015-06-18 01:42:03 +0000
1212+++ app/components/WeatherListView.qml 2015-06-29 10:16:30 +0000
1213@@ -20,8 +20,7 @@
1214 import QtQuick 2.4
1215 import Ubuntu.Components 1.2
1216
1217-
1218-ListView {
1219+UbuntuListView {
1220 Component.onCompleted: {
1221 // FIXME: workaround for qtubuntu not returning values depending on the grid unit definition
1222 // for Flickable.maximumFlickVelocity and Flickable.flickDeceleration
1223
1224=== modified file 'app/ui/LocationsPage.qml'
1225--- app/ui/LocationsPage.qml 2015-06-28 19:04:43 +0000
1226+++ app/ui/LocationsPage.qml 2015-06-29 10:16:30 +0000
1227@@ -18,39 +18,58 @@
1228
1229 import QtQuick 2.4
1230 import Ubuntu.Components 1.2
1231-import Ubuntu.Components.ListItems 0.1 as ListItem
1232+import Ubuntu.Components.ListItems 1.0 as ListItems
1233 import "../components"
1234-import "../components/ListItemActions"
1235-
1236
1237 Page {
1238 id: locationsPage
1239+
1240 // Set to null otherwise the first delegate appears +header.height down the page
1241 flickable: null
1242 title: i18n.tr("Locations")
1243
1244- state: locationsListView.state === "multiselectable" ? "selection" : "default"
1245+ state: "default"
1246 states: [
1247 PageHeadState {
1248- id: defaultState
1249 name: "default"
1250+ head: locationsPage.head
1251 actions: [
1252 Action {
1253 iconName: "add"
1254- onTriggered: mainPageStack.push(Qt.resolvedUrl("AddLocationPage.qml"))
1255+ onTriggered: {
1256+ mainPageStack.push(Qt.resolvedUrl("AddLocationPage.qml"))
1257+ }
1258 }
1259 ]
1260- PropertyChanges {
1261- target: locationsPage.head
1262- actions: defaultState.actions
1263+ backAction: Action {
1264+ iconName: "down"
1265+ onTriggered: {
1266+ pageStack.pop()
1267+ }
1268 }
1269 },
1270- MultiSelectHeadState {
1271- listview: locationsListView
1272- removable: true
1273- thisPage: locationsPage
1274
1275- onRemoved: storage.removeMultiLocations(selectedItems.slice())
1276+ PageHeadState {
1277+ name: "selection"
1278+ head: locationsPage.head
1279+ when: locationsListView.ViewItems.selectMode
1280+ backAction: Action {
1281+ iconName: "back"
1282+ onTriggered: {
1283+ locationsListView.closeSelection()
1284+ locationsPage.state = "default"
1285+ }
1286+ }
1287+ actions: [
1288+ Action {
1289+ iconName: "delete"
1290+ enabled: locationsListView.ViewItems.selectedIndices.length !== 0
1291+ onTriggered: {
1292+ storage.removeMultiLocations(locationsListView.ViewItems.selectedIndices)
1293+ locationsListView.clearSelection()
1294+ }
1295+ }
1296+ ]
1297 }
1298 ]
1299
1300@@ -58,27 +77,29 @@
1301 id: currentLocationModel
1302 }
1303
1304+ ListModel {
1305+ id: locationsModel
1306+ }
1307+
1308 MultiSelectListView {
1309 id: locationsListView
1310- anchors {
1311- fill: parent
1312- }
1313- model: ListModel {
1314- id: locationsModel
1315- }
1316+
1317+ clip: true
1318+ anchors.fill: parent
1319+ model: locationsModel
1320+
1321 header: MultiSelectListView {
1322 id: currentLocationListView
1323- anchors {
1324- left: parent.left
1325- right: parent.right
1326- }
1327+
1328+ width: parent.width
1329 height: settings.addedCurrentLocation ? units.gu(8) : units.gu(0)
1330 interactive: false
1331 model: currentLocationModel
1332- delegate: WeatherListItem {
1333+
1334+ delegate: ListItem {
1335 id: currentLocationListItem
1336
1337- onItemClicked: {
1338+ onClicked: {
1339 settings.current = index;
1340 pageStack.pop()
1341 }
1342@@ -147,32 +168,44 @@
1343 horizontalAlignment: Text.AlignRight
1344 text: temp + settings.tempScale
1345 }
1346+
1347+ ListItems.ThinDivider { anchors.bottom: parent.bottom }
1348 }
1349 }
1350
1351- delegate: WeatherListItem {
1352+ // Added a thindivider to the listview since by default the last listitem does not show
1353+ // a thindivider which does not follow design specs.
1354+ footer: ListItems.ThinDivider {
1355+ visible: locationsModel.count !== 0
1356+ }
1357+
1358+ onReorder: {
1359+ console.debug("Move: ", from, to);
1360+ storage.moveLocation(from, to);
1361+ }
1362+
1363+ delegate: ListItem {
1364 id: locationsListItem
1365- leftSideAction: Remove {
1366- onTriggered: storage.removeLocation(index)
1367- }
1368- multiselectable: true
1369- reorderable: true
1370-
1371- onItemClicked: {
1372- settings.current = index + 1;
1373- pageStack.pop()
1374- }
1375- onReorder: {
1376- console.debug("Move: ", from, to);
1377-
1378- storage.moveLocation(from, to);
1379- }
1380-
1381- ListItem.ThinDivider {
1382- anchors {
1383- top: parent.top
1384+
1385+ leadingActions: ListItemActions {
1386+ actions: [
1387+ Action {
1388+ iconName: 'delete'
1389+ onTriggered: storage.removeLocation(index)
1390+ }
1391+ ]
1392+ }
1393+
1394+ onPressAndHold: {
1395+ ListView.view.ViewItems.selectMode = !ListView.view.ViewItems.selectMode
1396+ ListView.view.ViewItems.dragMode = !ListView.view.ViewItems.dragMode
1397+ }
1398+
1399+ onClicked: {
1400+ if (!selectMode) {
1401+ settings.current = index + 1;
1402+ pageStack.pop()
1403 }
1404- visible: index == 0
1405 }
1406
1407 Item {
1408@@ -192,6 +225,7 @@
1409
1410 Label {
1411 id: locationName
1412+ width: parent.width
1413 elide: Text.ElideRight
1414 fontSize: "medium"
1415 text: name
1416@@ -202,6 +236,7 @@
1417 elide: Text.ElideRight
1418 fontSize: "small"
1419 font.weight: Font.Light
1420+ width: parent.width
1421 text: adminName1 == name ? countryName : adminName1
1422 }
1423 }
1424@@ -236,12 +271,6 @@
1425 visible: locationsPage.state === "default"
1426 }
1427 }
1428-
1429- ListItem.ThinDivider {
1430- anchors {
1431- bottom: parent.bottom
1432- }
1433- }
1434 }
1435 }
1436
1437
1438=== modified file 'po/com.ubuntu.weather.pot'
1439--- po/com.ubuntu.weather.pot 2015-06-29 00:20:51 +0000
1440+++ po/com.ubuntu.weather.pot 2015-06-29 10:16:30 +0000
1441@@ -8,7 +8,7 @@
1442 msgstr ""
1443 "Project-Id-Version: ubuntu-weather-app\n"
1444 "Report-Msgid-Bugs-To: \n"
1445-"POT-Creation-Date: 2015-06-28 19:17-0500\n"
1446+"POT-Creation-Date: 2015-06-29 10:12+0000\n"
1447 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1448 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1449 "Language-Team: LANGUAGE <LL@li.org>\n"
1450@@ -50,22 +50,6 @@
1451 msgid "Today"
1452 msgstr ""
1453
1454-#: ../app/components/ListItemActions/Remove.qml:26
1455-msgid "Remove"
1456-msgstr ""
1457-
1458-#: ../app/components/MultiSelectHeadState.qml:27
1459-msgid "Select All"
1460-msgstr ""
1461-
1462-#: ../app/components/MultiSelectHeadState.qml:39
1463-msgid "Delete"
1464-msgstr ""
1465-
1466-#: ../app/components/MultiSelectHeadState.qml:51
1467-msgid "Cancel selection"
1468-msgstr ""
1469-
1470 #: ../app/ubuntu-weather-app.qml:168
1471 msgid "Searching for current location..."
1472 msgstr ""
1473@@ -106,11 +90,11 @@
1474 msgid "OK"
1475 msgstr ""
1476
1477-#: ../app/ui/HomePage.qml:31 ../app/ui/LocationsPage.qml:30
1478+#: ../app/ui/HomePage.qml:31 ../app/ui/LocationsPage.qml:29
1479 msgid "Locations"
1480 msgstr ""
1481
1482-#: ../app/ui/LocationsPage.qml:104
1483+#: ../app/ui/LocationsPage.qml:125
1484 msgid "Current Location"
1485 msgstr ""
1486
1487@@ -118,15 +102,15 @@
1488 msgid "Settings"
1489 msgstr ""
1490
1491-#: ../app/ui/SettingsPage.qml:38 ../app/ui/settings/UnitsPage.qml:24
1492+#: ../app/ui/SettingsPage.qml:32 ../app/ui/settings/UnitsPage.qml:24
1493 msgid "Units"
1494 msgstr ""
1495
1496-#: ../app/ui/SettingsPage.qml:43 ../app/ui/settings/DataProviderPage.qml:24
1497+#: ../app/ui/SettingsPage.qml:37 ../app/ui/settings/DataProviderPage.qml:24
1498 msgid "Data Provider"
1499 msgstr ""
1500
1501-#: ../app/ui/SettingsPage.qml:48 ../app/ui/settings/RefreshIntervalPage.qml:24
1502+#: ../app/ui/SettingsPage.qml:42 ../app/ui/settings/RefreshIntervalPage.qml:24
1503 msgid "Refresh Interval"
1504 msgstr ""
1505
1506
1507=== modified file 'ubuntu-weather-app.desktop.in.in'
1508--- ubuntu-weather-app.desktop.in.in 2015-01-23 23:15:52 +0000
1509+++ ubuntu-weather-app.desktop.in.in 2015-06-29 10:16:30 +0000
1510@@ -10,3 +10,4 @@
1511 X-Ubuntu-Touch=true
1512 X-Ubuntu-Default-Department-ID=accessories
1513 X-Ubuntu-Splash-Color=#F5F5F5
1514+X-Ubuntu-Supported-Orientations=portrait

Subscribers

People subscribed via source and target branches