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

Proposed by Nekhelesh Ramananthan on 2015-06-26
Status: Rejected
Rejected by: Victor Thompson on 2015-08-10
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 on 2015-07-03
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2015-06-29
Victor Thompson 2015-06-26 Needs Fixing on 2015-06-28
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 on 2015-06-26

Fixed copyright header formatting in fakeheader.qml

65. By Nekhelesh Ramananthan on 2015-06-26

removed multiselect head state as it was no longer used

66. By Nekhelesh Ramananthan on 2015-06-27

Fixed locations names not eliding in locations page

67. By Nekhelesh Ramananthan on 2015-06-27

Changed multi-delete to use the removeMultiLocations() function

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

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
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.

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.

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 on 2015-06-29

merged lp:ubuntu-weather-app/reboot

69. By Nekhelesh Ramananthan on 2015-06-29

Added thindivider to the last listitem

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
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?

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?

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.

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
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 on 2015-06-29

Added thindivider to the last listitem

68. By Nekhelesh Ramananthan on 2015-06-29

merged lp:ubuntu-weather-app/reboot

67. By Nekhelesh Ramananthan on 2015-06-27

Changed multi-delete to use the removeMultiLocations() function

66. By Nekhelesh Ramananthan on 2015-06-27

Fixed locations names not eliding in locations page

65. By Nekhelesh Ramananthan on 2015-06-26

removed multiselect head state as it was no longer used

64. By Nekhelesh Ramananthan on 2015-06-26

Fixed copyright header formatting in fakeheader.qml

63. By Nekhelesh Ramananthan on 2015-06-26

Lock orientation to portrait

62. By Nekhelesh Ramananthan on 2015-06-26

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

61. By Nekhelesh Ramananthan on 2015-06-26

Implemented reorder support

60. By Nekhelesh Ramananthan on 2015-06-26

Removed unnecessary ListItemWithActions.qml and WeatherListItem.qml

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'app/components/CMakeLists.txt'
--- app/components/CMakeLists.txt 2015-03-03 18:37:59 +0000
+++ app/components/CMakeLists.txt 2015-06-29 10:16:30 +0000
@@ -1,5 +1,3 @@
1add_subdirectory(ListItemActions)
2
3file(GLOB COMPONENTS_QML_JS_FILES *.qml *.js)1file(GLOB COMPONENTS_QML_JS_FILES *.qml *.js)
42
5add_custom_target(ubuntu-weather-app_components_QMlFiles ALL SOURCES ${COMPONENTS_QML_JS_FILES})3add_custom_target(ubuntu-weather-app_components_QMlFiles ALL SOURCES ${COMPONENTS_QML_JS_FILES})
64
=== added file 'app/components/FakeHeader.qml'
--- app/components/FakeHeader.qml 1970-01-01 00:00:00 +0000
+++ app/components/FakeHeader.qml 2015-06-29 10:16:30 +0000
@@ -0,0 +1,39 @@
1/*
2 * Copyright (C) 2014 Canonical Ltd
3 *
4 * This file is part of Ubuntu Clock App
5 *
6 * Ubuntu Clock App is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 3 as
8 * published by the Free Software Foundation.
9 *
10 * Ubuntu Clock App is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19import QtQuick 2.4
20import Ubuntu.Components 1.2
21
22Column {
23 id: fakeHeader
24
25 height: units.gu(9)
26
27 Rectangle {
28 height: units.gu(7)
29 width: parent.width
30 color: Theme.palette.normal.background
31 }
32
33 Rectangle {
34 color: "#C9C9C9"
35 height: units.gu(2)
36 anchors.left: parent.left
37 anchors.right: parent.right
38 }
39}
040
=== removed directory 'app/components/ListItemActions'
=== removed file 'app/components/ListItemActions/CMakeLists.txt'
--- app/components/ListItemActions/CMakeLists.txt 2015-03-03 18:37:59 +0000
+++ app/components/ListItemActions/CMakeLists.txt 1970-01-01 00:00:00 +0000
@@ -1,5 +0,0 @@
1file(GLOB LISTITEMACTIONS_QML_JS_FILES *.qml *.js)
2
3add_custom_target(ubuntu-weather-app_listitemactions_QMlFiles ALL SOURCES ${LISTITEMACTIONS_QML_JS_FILES})
4
5install(FILES ${LISTITEMACTIONS_QML_JS_FILES} DESTINATION ${UBUNTU-WEATHER_APP_DIR}/components/ListItemActions)
60
=== removed file 'app/components/ListItemActions/CheckBox.qml'
--- app/components/ListItemActions/CheckBox.qml 2015-06-18 01:45:57 +0000
+++ app/components/ListItemActions/CheckBox.qml 1970-01-01 00:00:00 +0000
@@ -1,25 +0,0 @@
1/*
2 * Copyright (C) 2012-2014, 2015 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.4
18import Ubuntu.Components 1.2
19
20CheckBox {
21 checked: root.selected
22 width: implicitWidth
23 // disable item mouse area to avoid conflicts with parent mouse area
24 __mouseArea.enabled: false
25}
260
=== removed file 'app/components/ListItemActions/Remove.qml'
--- app/components/ListItemActions/Remove.qml 2015-06-18 01:42:03 +0000
+++ app/components/ListItemActions/Remove.qml 1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
1/*
2 * Copyright (C) 2014, 2015 Andrew Hayzen <ahayzen@gmail.com>
3 * Daniel Holm <d.holmen@gmail.com>
4 * Victor Thompson <victor.thompson@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 3.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19import QtQuick 2.4
20import Ubuntu.Components 1.2
21
22Action {
23 id: removeAction
24 iconName: "delete"
25 objectName: "swipeDeleteAction"
26 text: i18n.tr("Remove")
27}
280
=== removed file 'app/components/ListItemReorderComponent.qml'
--- app/components/ListItemReorderComponent.qml 2015-06-18 01:42:03 +0000
+++ app/components/ListItemReorderComponent.qml 1970-01-01 00:00:00 +0000
@@ -1,106 +0,0 @@
1/*
2 * Copyright (C) 2013, 2014, 2015
3 * Andrew Hayzen <ahayzen@gmail.com>
4 * Nekhelesh Ramananthan <krnekhelesh@gmail.com>
5 * Victor Thompson <victor.thompson@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20import QtQuick 2.4
21import Ubuntu.Components 1.2
22
23
24Item {
25 id: actionReorder
26 width: units.gu(4)
27
28 Icon {
29 anchors {
30 horizontalCenter: parent.horizontalCenter
31 verticalCenter: parent.verticalCenter
32 }
33 name: "navigation-menu" // TODO: use proper image
34 height: width
35 width: units.gu(3)
36 }
37
38 MouseArea {
39 id: actionReorderMouseArea
40 anchors {
41 fill: parent
42 }
43 property int startY: 0
44 property int startContentY: 0
45
46 onPressed: {
47 root.parent.parent.interactive = false; // stop scrolling of listview
48 startY = root.y;
49 startContentY = root.parent.parent.contentY;
50 root.z += 10; // force ontop of other elements
51
52 console.debug("Reorder listitem pressed", root.y)
53 }
54 onMouseYChanged: root.y += mouse.y - (root.height / 2);
55 onReleased: {
56 console.debug("Reorder diff by position", getDiff());
57
58 var diff = getDiff();
59
60 // Remove the height of the actual item if moved down
61 if (diff > 0) {
62 diff -= 1;
63 }
64
65 root.parent.parent.interactive = true; // reenable scrolling
66
67 if (diff === 0) {
68 // Nothing has changed so reset the item
69 // z index is restored after animation
70 resetListItemYAnimation.start();
71 }
72 else {
73 var newIndex = index + diff;
74
75 if (newIndex < 0) {
76 newIndex = 0;
77 }
78 else if (newIndex > root.parent.parent.count - 1) {
79 newIndex = root.parent.parent.count - 1;
80 }
81
82 root.z -= 10; // restore z index
83 reorder(index, newIndex)
84 }
85 }
86
87 function getDiff() {
88 // Get the amount of items that have been passed over (by centre)
89 return Math.round((((root.y - startY) + (root.parent.parent.contentY - startContentY)) / root.height) + 0.5);
90 }
91 }
92
93 SequentialAnimation {
94 id: resetListItemYAnimation
95 UbuntuNumberAnimation {
96 target: root;
97 property: "y";
98 to: actionReorderMouseArea.startY
99 }
100 ScriptAction {
101 script: {
102 root.z -= 10; // restore z index
103 }
104 }
105 }
106}
1070
=== removed file 'app/components/ListItemWithActions.qml'
--- app/components/ListItemWithActions.qml 2015-06-18 01:42:03 +0000
+++ app/components/ListItemWithActions.qml 1970-01-01 00:00:00 +0000
@@ -1,496 +0,0 @@
1/*
2 * Copyright (C) 2012-2015 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.4
18import Ubuntu.Components 1.2
19import Ubuntu.Components.ListItems 1.0 as ListItem
20
21
22Item {
23 id: root
24 width: parent.width
25
26 property Action leftSideAction: null
27 property list<Action> rightSideActions
28 property double defaultHeight: units.gu(8)
29 property bool locked: false
30 property Action activeAction: null
31 property var activeItem: null
32 property bool triggerActionOnMouseRelease: false
33 property color color: Theme.palette.normal.background
34 property color selectedColor: "#E6E6E6"
35 property bool selected: false
36 property bool selectionMode: false
37 property alias internalAnchors: mainContents.anchors
38 default property alias contents: mainContents.children
39
40 readonly property double actionWidth: units.gu(4)
41 readonly property double leftActionWidth: units.gu(10)
42 readonly property double actionThreshold: actionWidth * 0.4
43 readonly property double threshold: 0.4
44 readonly property string swipeState: main.x == 0 ? "Normal" : main.x > 0 ? "LeftToRight" : "RightToLeft"
45 readonly property alias swipping: mainItemMoving.running
46 readonly property bool _showActions: mouseArea.pressed || swipeState != "Normal" || swipping
47
48 property alias _main: main // CUSTOM
49 property alias pressed: mouseArea.pressed // CUSTOM
50
51 /* internal */
52 property var _visibleRightSideActions: filterVisibleActions(rightSideActions)
53
54 signal itemClicked(var mouse)
55 signal itemPressAndHold(var mouse)
56
57 function returnToBoundsRTL(direction)
58 {
59 var actionFullWidth = actionWidth + units.gu(2)
60
61 // go back to normal state if swipping reverse
62 if (direction === "LTR") {
63 updatePosition(0)
64 return
65 } else if (!triggerActionOnMouseRelease) {
66 updatePosition(-rightActionsView.width + units.gu(2))
67 return
68 }
69
70 var xOffset = Math.abs(main.x)
71 var index = Math.min(Math.floor(xOffset / actionFullWidth), _visibleRightSideActions.length)
72 var newX = 0
73
74 if (index === _visibleRightSideActions.length) {
75 newX = -(rightActionsView.width - units.gu(2))
76 } else if (index >= 1) {
77 newX = -(actionFullWidth * index)
78 }
79
80 updatePosition(newX)
81 }
82
83 function returnToBoundsLTR(direction)
84 {
85 var finalX = leftActionWidth
86 if ((direction === "RTL") || (main.x <= (finalX * root.threshold)))
87 finalX = 0
88 updatePosition(finalX)
89 }
90
91 function returnToBounds(direction)
92 {
93 if (main.x < 0) {
94 returnToBoundsRTL(direction)
95 } else if (main.x > 0) {
96 returnToBoundsLTR(direction)
97 } else {
98 updatePosition(0)
99 }
100 }
101
102 function contains(item, point, marginX)
103 {
104 var itemStartX = item.x - marginX
105 var itemEndX = item.x + item.width + marginX
106 return (point.x >= itemStartX) && (point.x <= itemEndX) &&
107 (point.y >= item.y) && (point.y <= (item.y + item.height));
108 }
109
110 function getActionAt(point)
111 {
112 if (leftSideAction && contains(leftActionViewLoader.item, point, 0)) {
113 return leftSideAction
114 } else if (contains(rightActionsView, point, 0)) {
115 var newPoint = root.mapToItem(rightActionsView, point.x, point.y)
116 for (var i = 0; i < rightActionsRepeater.count; i++) {
117 var child = rightActionsRepeater.itemAt(i)
118 if (contains(child, newPoint, units.gu(1))) {
119 return i
120 }
121 }
122 }
123 return -1
124 }
125
126 function updateActiveAction()
127 {
128 if (triggerActionOnMouseRelease &&
129 (main.x <= -(root.actionWidth + units.gu(2))) &&
130 (main.x > -(rightActionsView.width - units.gu(2)))) {
131 var actionFullWidth = actionWidth + units.gu(2)
132 var xOffset = Math.abs(main.x)
133 var index = Math.min(Math.floor(xOffset / actionFullWidth), _visibleRightSideActions.length)
134 index = index - 1
135 if (index > -1) {
136 root.activeItem = rightActionsRepeater.itemAt(index)
137 root.activeAction = root._visibleRightSideActions[index]
138 }
139 } else {
140 root.activeAction = null
141 }
142 }
143
144 function resetSwipe()
145 {
146 updatePosition(0)
147 }
148
149 function filterVisibleActions(actions)
150 {
151 var visibleActions = []
152 for(var i = 0; i < actions.length; i++) {
153 var action = actions[i]
154 if (action.visible) {
155 visibleActions.push(action)
156 }
157 }
158 return visibleActions
159 }
160
161 function updatePosition(pos)
162 {
163 if (!root.triggerActionOnMouseRelease && (pos !== 0)) {
164 mouseArea.state = pos > 0 ? "RightToLeft" : "LeftToRight"
165 } else {
166 mouseArea.state = ""
167 }
168 main.x = pos
169 }
170
171 // CUSTOM remove animation
172 SequentialAnimation {
173 id: removeAnimation
174
175 property var action
176
177 UbuntuNumberAnimation {
178 target: root
179 duration: UbuntuAnimation.BriskDuration
180 property: "height";
181 to: 0
182 }
183 ScriptAction {
184 script: removeAnimation.action.trigger()
185 }
186 }
187
188 states: [
189 State {
190 name: "select"
191 when: selectionMode || selected
192 PropertyChanges {
193 target: selectionIcon
194 source: Qt.resolvedUrl("ListItemActions/CheckBox.qml")
195 anchors.leftMargin: units.gu(2)
196 }
197 PropertyChanges {
198 target: root
199 locked: true
200 }
201 PropertyChanges {
202 target: main
203 x: 0
204 }
205 }
206 ]
207
208 height: defaultHeight
209 //clip: height !== defaultHeight // CUSTOM
210
211 Loader { // CUSTOM
212 id: leftActionViewLoader
213 anchors {
214 top: parent.top
215 bottom: parent.bottom
216 right: main.left
217 }
218 asynchronous: true
219 sourceComponent: leftSideAction ? leftActionViewComponent : undefined
220 }
221
222 Component { // CUSTOM
223 id: leftActionViewComponent
224
225 Rectangle {
226 id: leftActionView
227 width: root.leftActionWidth + actionThreshold
228 color: UbuntuColors.red
229
230 Icon {
231 id: leftActionIcon
232 anchors {
233 centerIn: parent
234 horizontalCenterOffset: actionThreshold / 2
235 }
236 objectName: "swipeDeleteAction" // CUSTOM
237 name: leftSideAction && _showActions ? leftSideAction.iconName : ""
238 color: Theme.palette.selected.field
239 height: units.gu(3)
240 width: units.gu(3)
241 }
242 }
243 }
244
245 //Rectangle {
246 Item { // CUSTOM
247 id: rightActionsView
248
249 anchors {
250 top: main.top
251 left: main.right
252 bottom: main.bottom
253 }
254 visible: _visibleRightSideActions.length > 0
255 width: rightActionsRepeater.count > 0 ? rightActionsRepeater.count * (root.actionWidth + units.gu(2)) + root.actionThreshold + units.gu(2) : 0
256 // color: "white" // CUSTOM
257
258 Row {
259 anchors{
260 top: parent.top
261 left: parent.left
262 leftMargin: units.gu(2)
263 right: parent.right
264 rightMargin: units.gu(2)
265 bottom: parent.bottom
266 }
267 spacing: units.gu(2)
268 Repeater {
269 id: rightActionsRepeater
270
271 model: _showActions ? _visibleRightSideActions : []
272 Item {
273 property alias image: img
274
275 height: rightActionsView.height
276 width: root.actionWidth
277
278 Icon {
279 id: img
280
281 anchors.centerIn: parent
282 objectName: rightSideActions[index].objectName // CUSTOM
283 width: units.gu(3)
284 height: units.gu(3)
285 name: modelData.iconName
286 color: root.activeAction === modelData ? UbuntuColors.orange : UbuntuColors.coolGrey // CUSTOM
287 }
288 }
289 }
290 }
291 }
292
293 Rectangle {
294 id: main
295 objectName: "mainItem"
296
297 anchors {
298 top: parent.top
299 bottom: parent.bottom
300 }
301
302 width: parent.width
303 color: root.selected ? root.selectedColor : root.color
304
305 Loader {
306 id: selectionIcon
307
308 anchors {
309 left: main.left
310 verticalCenter: main.verticalCenter
311 }
312 asynchronous: true // CUSTOM
313 width: (status === Loader.Ready) ? item.implicitWidth : 0
314 visible: (status === Loader.Ready) && (item.width === item.implicitWidth)
315
316 Behavior on width {
317 NumberAnimation {
318 duration: UbuntuAnimation.SnapDuration
319 }
320 }
321 }
322
323 Item {
324 id: mainContents
325
326 anchors {
327 left: selectionIcon.right
328 //leftMargin: units.gu(2) // CUSTOM
329 top: parent.top
330 //topMargin: units.gu(1) // CUSTOM
331 right: parent.right
332 //rightMargin: units.gu(2) // CUSTOM
333 bottom: parent.bottom
334 //bottomMargin: units.gu(1) // CUSTOM
335 }
336 }
337
338 Behavior on x {
339 UbuntuNumberAnimation {
340 id: mainItemMoving
341
342 easing.type: Easing.OutElastic
343 duration: UbuntuAnimation.SlowDuration
344 }
345 }
346 }
347
348 SequentialAnimation {
349 id: triggerAction
350
351 property var currentItem: root.activeItem ? root.activeItem.image : null
352
353 running: false
354 ParallelAnimation {
355 UbuntuNumberAnimation {
356 target: triggerAction.currentItem
357 property: "opacity"
358 from: 1.0
359 to: 0.0
360 duration: UbuntuAnimation.SlowDuration
361 easing {type: Easing.InOutBack; }
362 }
363 UbuntuNumberAnimation {
364 target: triggerAction.currentItem
365 properties: "width, height"
366 from: units.gu(3)
367 to: root.actionWidth
368 duration: UbuntuAnimation.SlowDuration
369 easing {type: Easing.InOutBack; }
370 }
371 }
372 PropertyAction {
373 target: triggerAction.currentItem
374 properties: "width, height"
375 value: units.gu(3)
376 }
377 PropertyAction {
378 target: triggerAction.currentItem
379 properties: "opacity"
380 value: 1.0
381 }
382 ScriptAction {
383 script: {
384 root.activeAction.triggered(root)
385 mouseArea.state = ""
386 }
387 }
388 PauseAnimation {
389 duration: 500
390 }
391 UbuntuNumberAnimation {
392 target: main
393 property: "x"
394 to: 0
395 }
396 }
397
398 MouseArea {
399 id: mouseArea
400
401 property bool locked: root.locked || ((root.leftSideAction === null) && (root._visibleRightSideActions.count === 0)) // CUSTOM
402 property bool manual: false
403 property string direction: "None"
404 property real lastX: -1
405
406 anchors.fill: parent
407 drag {
408 target: locked ? null : main
409 axis: Drag.XAxis
410 minimumX: rightActionsView.visible ? -(rightActionsView.width) : 0
411 maximumX: leftSideAction ? leftActionViewLoader.item.width : 0
412 threshold: root.actionThreshold
413 }
414
415 states: [
416 State {
417 name: "LeftToRight"
418 PropertyChanges {
419 target: mouseArea
420 drag.maximumX: 0
421 }
422 },
423 State {
424 name: "RightToLeft"
425 PropertyChanges {
426 target: mouseArea
427 drag.minimumX: 0
428 }
429 }
430 ]
431
432 onMouseXChanged: {
433 var offset = (lastX - mouseX)
434 if (Math.abs(offset) <= root.actionThreshold) {
435 return
436 }
437 lastX = mouseX
438 direction = offset > 0 ? "RTL" : "LTR";
439 }
440
441 onPressed: {
442 lastX = mouse.x
443 }
444
445 onReleased: {
446 if (root.triggerActionOnMouseRelease && root.activeAction) {
447 triggerAction.start()
448 } else {
449 root.returnToBounds()
450 root.activeAction = null
451 }
452 lastX = -1
453 direction = "None"
454 }
455 onClicked: {
456 if (selectionMode) { // CUSTOM - selecting a listitem should toggle selection if in selectionMode
457 selected = !selected
458 return
459 } else if (main.x === 0) {
460 root.itemClicked(mouse)
461 } else if (main.x > 0) {
462 var action = getActionAt(Qt.point(mouse.x, mouse.y))
463 if (action && action !== -1) {
464 //action.triggered(root)
465 removeAnimation.action = action // CUSTOM - use our animation instead
466 removeAnimation.start() // CUSTOM
467 }
468 } else {
469 var actionIndex = getActionAt(Qt.point(mouse.x, mouse.y))
470
471 if (actionIndex !== -1 && actionIndex !== leftSideAction) { // CUSTOM - can be leftAction
472 root.activeItem = rightActionsRepeater.itemAt(actionIndex)
473 root.activeAction = root.rightSideActions[actionIndex]
474 triggerAction.start()
475 return
476 }
477 }
478 root.resetSwipe()
479 }
480
481 onPositionChanged: {
482 if (mouseArea.pressed) {
483 updateActiveAction()
484
485 listItemSwiping(index) // CUSTOM - tells other listitems to dismiss any swipe
486 }
487 }
488 onPressAndHold: {
489 if (main.x === 0) {
490 root.itemPressAndHold(mouse)
491 }
492 }
493
494 z: -1
495 }
496}
4970
=== removed file 'app/components/MultiSelectHeadState.qml'
--- app/components/MultiSelectHeadState.qml 2015-06-18 01:42:03 +0000
+++ app/components/MultiSelectHeadState.qml 1970-01-01 00:00:00 +0000
@@ -1,72 +0,0 @@
1/*
2 * Copyright (C) 2015
3 * Andrew Hayzen <ahayzen@gmail.com>
4 * Victor Thompson <victor.thompson@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 3.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19import QtQuick 2.4
20import Ubuntu.Components 1.2
21
22PageHeadState {
23 id: selectionState
24 actions: [
25 Action {
26 iconName: "select"
27 text: i18n.tr("Select All")
28 onTriggered: {
29 if (listview.selectedItems.length === listview.model.count) {
30 listview.clearSelection()
31 } else {
32 listview.selectAll()
33 }
34 }
35 },
36 Action {
37 enabled: listview.selectedItems.length > 0
38 iconName: "delete"
39 text: i18n.tr("Delete")
40 visible: removable
41
42 onTriggered: {
43 removed(listview.selectedItems)
44
45 listview.closeSelection()
46 }
47 }
48
49 ]
50 backAction: Action {
51 text: i18n.tr("Cancel selection")
52 iconName: "back"
53 onTriggered: {
54 listview.clearSelection()
55 listview.state = "normal"
56 }
57 }
58 head: thisPage.head
59 name: "selection"
60
61 PropertyChanges {
62 target: thisPage.head
63 backAction: selectionState.backAction
64 actions: selectionState.actions
65 }
66
67 property ListView listview
68 property bool removable: false
69 property Page thisPage
70
71 signal removed(var selectedItems)
72}
730
=== modified file 'app/components/MultiSelectListView.qml'
--- app/components/MultiSelectListView.qml 2015-06-18 01:42:03 +0000
+++ app/components/MultiSelectListView.qml 2015-06-29 10:16:30 +0000
@@ -20,21 +20,24 @@
20import QtQuick 2.420import QtQuick 2.4
21import Ubuntu.Components 1.221import Ubuntu.Components 1.2
2222
23
24WeatherListView {23WeatherListView {
25 property var selectedItems: []
26
27 signal clearSelection()24 signal clearSelection()
28 signal closeSelection()25 signal closeSelection()
29 signal selectAll()26 signal selectAll()
3027 signal reorder(int from, int to)
31 onClearSelection: selectedItems = []28
29 onClearSelection: {
30 ViewItems.selectedIndices = []
31 }
32
32 onCloseSelection: {33 onCloseSelection: {
33 clearSelection()34 clearSelection()
34 state = "normal"35 ViewItems.selectMode = false
36 ViewItems.dragMode = false
35 }37 }
38
36 onSelectAll: {39 onSelectAll: {
37 var tmp = selectedItems40 var tmp = []
3841
39 for (var i=0; i < model.count; i++) {42 for (var i=0; i < model.count; i++) {
40 if (tmp.indexOf(i) === -1) {43 if (tmp.indexOf(i) === -1) {
@@ -42,11 +45,27 @@
42 }45 }
43 }46 }
4447
45 selectedItems = tmp48 ViewItems.selectedIndices = tmp
46 }49 }
50
47 onVisibleChanged: {51 onVisibleChanged: {
48 if (!visible) {52 if (!visible) {
49 closeSelection()53 closeSelection()
50 }54 }
51 }55 }
56
57 moveDisplaced: Transition {
58 UbuntuNumberAnimation {
59 property: "y"
60 }
61 }
62
63 ViewItems.onDragUpdated: {
64 if (event.status === ListItemDrag.Moving) {
65 event.accept = false
66 } else if (event.status === ListItemDrag.Dropped) {
67 model.move(event.from, event.to, 1)
68 reorder(event.from, event.to)
69 }
70 }
52}71}
5372
=== modified file 'app/components/PageWithBottomEdge.qml'
--- app/components/PageWithBottomEdge.qml 2015-06-18 01:45:57 +0000
+++ app/components/PageWithBottomEdge.qml 2015-06-29 10:16:30 +0000
@@ -77,7 +77,7 @@
77 property bool reloadBottomEdgePage: true77 property bool reloadBottomEdgePage: true
7878
79 readonly property alias bottomEdgePage: edgeLoader.item79 readonly property alias bottomEdgePage: edgeLoader.item
80 readonly property bool isReady: ((bottomEdge.y === 0) && bottomEdgePageLoaded && edgeLoader.item.active)80 readonly property bool isReady: ((bottomEdge.y === fakeHeader.height) && bottomEdgePageLoaded && edgeLoader.item.active)
81 readonly property bool isCollapsed: (bottomEdge.y === page.height)81 readonly property bool isCollapsed: (bottomEdge.y === page.height)
82 readonly property bool bottomEdgePageLoaded: (edgeLoader.status == Loader.Ready)82 readonly property bool bottomEdgePageLoaded: (edgeLoader.status == Loader.Ready)
8383
@@ -91,7 +91,6 @@
91 signal bottomEdgeReleased()91 signal bottomEdgeReleased()
92 signal bottomEdgeDismissed()92 signal bottomEdgeDismissed()
9393
94
95 function showBottomEdgePage(source, properties)94 function showBottomEdgePage(source, properties)
96 {95 {
97 edgeLoader.setSource(source, properties)96 edgeLoader.setSource(source, properties)
@@ -152,6 +151,9 @@
152151
153 property bool hidden: (activeFocus === false) || ((bottomEdge.y - units.gu(1)) < tip.y)152 property bool hidden: (activeFocus === false) || ((bottomEdge.y - units.gu(1)) < tip.y)
154153
154 // CUSTOM
155 property bool isAnimating: true
156
155 enabled: mouseArea.enabled157 enabled: mouseArea.enabled
156 visible: page.bottomEdgeEnabled158 visible: page.bottomEdgeEnabled
157 anchors {159 anchors {
@@ -167,6 +169,10 @@
167 UbuntuNumberAnimation {169 UbuntuNumberAnimation {
168 duration: UbuntuAnimation.SnapDuration170 duration: UbuntuAnimation.SnapDuration
169 }171 }
172 // CUSTOM
173 ScriptAction {
174 script: tip.isAnimating = false
175 }
170 }176 }
171 }177 }
172 }178 }
@@ -232,7 +238,6 @@
232 left: parent.left238 left: parent.left
233 right: parent.right239 right: parent.right
234 bottom: parent.bottom240 bottom: parent.bottom
235
236 }241 }
237 height: bottomEdge.tipHeight242 height: bottomEdge.tipHeight
238 z: 1243 z: 1
@@ -265,12 +270,31 @@
265 }270 }
266 }271 }
267272
273 // CUSTOM fake header to make the page with bottom edge transition smoother
274 FakeHeader {
275 id: fakeHeader
276
277 anchors {
278 left: parent.left
279 right: parent.right
280 }
281 y: -fakeHeader.height + (fakeHeader.height * (page.height - bottomEdge.y)) / (page.height - fakeHeader.height)
282 z: bgVisual.z + 1
283
284 Behavior on y {
285 UbuntuNumberAnimation {
286 duration: UbuntuAnimation.SnapDuration
287 }
288 }
289 }
290
268 Rectangle {291 Rectangle {
269 id: bottomEdge292 id: bottomEdge
270 objectName: "bottomEdge"293 objectName: "bottomEdge"
271294
272 readonly property int tipHeight: units.gu(3)295 readonly property int tipHeight: units.gu(3)
273 readonly property int pageStartY: 0296 // CUSTOM value
297 readonly property int pageStartY: fakeHeader.height
274298
275 z: 1299 z: 1
276 color: Theme.palette.normal.background300 color: Theme.palette.normal.background
@@ -281,6 +305,7 @@
281 }305 }
282 height: page.height306 height: page.height
283 y: height307 y: height
308
284 visible: !page.isCollapsed309 visible: !page.isCollapsed
285 state: "collapsed"310 state: "collapsed"
286 states: [311 states: [
@@ -290,6 +315,11 @@
290 target: bottomEdge315 target: bottomEdge
291 y: bottomEdge.height316 y: bottomEdge.height
292 }317 }
318 // CUSTOM
319 PropertyChanges {
320 target: fakeHeader
321 y: -fakeHeader.height
322 }
293 },323 },
294 State {324 State {
295 name: "expanded"325 name: "expanded"
@@ -297,6 +327,11 @@
297 target: bottomEdge327 target: bottomEdge
298 y: bottomEdge.pageStartY328 y: bottomEdge.pageStartY
299 }329 }
330 // CUSTOM
331 PropertyChanges {
332 target: fakeHeader
333 y: 0
334 }
300 },335 },
301 State {336 State {
302 name: "floating"337 name: "floating"
@@ -313,12 +348,20 @@
313 to: "expanded"348 to: "expanded"
314 SequentialAnimation {349 SequentialAnimation {
315 alwaysRunToEnd: true350 alwaysRunToEnd: true
316351 ParallelAnimation {
317 SmoothedAnimation {352 SmoothedAnimation {
318 target: bottomEdge353 target: bottomEdge
319 property: "y"354 property: "y"
320 duration: UbuntuAnimation.FastDuration355 duration: UbuntuAnimation.FastDuration
321 easing.type: Easing.Linear356 easing.type: Easing.Linear
357 }
358 // CUSTOM
359 SmoothedAnimation {
360 target: fakeHeader
361 property: "y"
362 duration: UbuntuAnimation.FastDuration
363 easing.type: Easing.Linear
364 }
322 }365 }
323 SmoothedAnimation {366 SmoothedAnimation {
324 target: edgeLoader367 target: edgeLoader
@@ -353,17 +396,24 @@
353 edgeLoader.item.active = false396 edgeLoader.item.active = false
354 }397 }
355 }398 }
356 SmoothedAnimation {399 ParallelAnimation {
357 target: bottomEdge400 SmoothedAnimation {
358 property: "y"401 target: bottomEdge
359 duration: UbuntuAnimation.SlowDuration402 property: "y"
403 duration: UbuntuAnimation.SlowDuration
404 }
405 // CUSTOM
406 SmoothedAnimation {
407 target: fakeHeader
408 property: "y"
409 duration: UbuntuAnimation.SlowDuration
410 }
360 }411 }
361 ScriptAction {412 ScriptAction {
362 script: {413 script: {
363 // destroy current bottom page414 // destroy current bottom page
364 if (page.reloadBottomEdgePage) {415 if (page.reloadBottomEdgePage) {
365 edgeLoader.active = false416 edgeLoader.active = false
366 // tip will receive focus on page active true
367 } else {417 } else {
368 tip.forceActiveFocus()418 tip.forceActiveFocus()
369 }419 }
@@ -379,10 +429,10 @@
379 Transition {429 Transition {
380 from: "floating"430 from: "floating"
381 to: "collapsed"431 to: "collapsed"
382 SmoothedAnimation {432 // MODIFIED
433 UbuntuNumberAnimation {
383 target: bottomEdge434 target: bottomEdge
384 property: "y"435 property: "opacity"
385 duration: UbuntuAnimation.FastDuration
386 }436 }
387 }437 }
388 ]438 ]
389439
=== removed file 'app/components/WeatherListItem.qml'
--- app/components/WeatherListItem.qml 2015-06-21 15:02:05 +0000
+++ app/components/WeatherListItem.qml 1970-01-01 00:00:00 +0000
@@ -1,137 +0,0 @@
1/*
2 * Copyright (C) 2013, 2014, 2015
3 * Andrew Hayzen <ahayzen@gmail.com>
4 * Nekhelesh Ramananthan <krnekhelesh@gmail.com>
5 * Victor Thompson <victor.thompson@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20import QtQuick 2.4
21import Ubuntu.Components 1.2
22
23ListItemWithActions {
24 id: root
25
26 property int listItemIndex: index
27 property bool multiselectable: false
28 property int previousListItemIndex: -1
29 property bool reorderable: false
30
31 signal reorder(int from, int to)
32
33 onItemPressAndHold: {
34 if (multiselectable) {
35 selectionMode = true
36 }
37 }
38
39 onListItemIndexChanged: {
40 var i = parent.parent.selectedItems.lastIndexOf(previousListItemIndex)
41
42 if (i !== -1) {
43 parent.parent.selectedItems[i] = listItemIndex
44 }
45
46 previousListItemIndex = listItemIndex
47 }
48
49 onSelectedChanged: {
50 if (selectionMode) {
51 var tmp = parent.parent.selectedItems
52
53 if (selected) {
54 if (parent.parent.selectedItems.indexOf(listItemIndex) === -1) {
55 tmp.push(listItemIndex)
56 parent.parent.selectedItems = tmp
57 }
58 } else {
59 tmp.splice(parent.parent.selectedItems.indexOf(listItemIndex), 1)
60 parent.parent.selectedItems = tmp
61 }
62 }
63 }
64
65 onSelectionModeChanged: {
66 if (reorderable && selectionMode) {
67 resetSwipe()
68 }
69
70 for (var j=0; j < _main.children.length; j++) {
71 if (_main.children[j] !== actionReorderLoader) {
72 _main.children[j].anchors.rightMargin = reorderable && selectionMode ? actionReorderLoader.width + units.gu(2) : 0
73 }
74 }
75
76 parent.parent.state = selectionMode ? "multiselectable" : "normal"
77
78 if (!selectionMode) {
79 selected = false
80 }
81 }
82
83 /* Highlight the listitem on press */
84 Rectangle {
85 id: listItemBrighten
86 color: root.pressed ? UbuntuColors.coolGrey : "transparent"
87 opacity: 0.1
88 height: root.height
89 x: root.x - parent.x // -parent.x due to selectionIcon in ListItemWithActions
90 width: root.width
91 }
92
93 /* Reorder Component */
94 Loader {
95 id: actionReorderLoader
96 active: reorderable && selectionMode && root.parent.parent.selectedItems.length === 0
97 anchors {
98 bottom: parent.bottom
99 right: parent.right
100 rightMargin: units.gu(1)
101 top: parent.top
102 }
103 asynchronous: true
104 source: "ListItemReorderComponent.qml"
105 }
106
107 Item {
108 Connections { // Only allow one ListItem to be swiping at any time
109 target: weatherApp
110 onListItemSwiping: {
111 if (i !== index) {
112 root.resetSwipe();
113 }
114 }
115 }
116
117 Connections { // Connections from signals in the ListView
118 target: root.parent.parent
119 onClearSelection: selected = false
120 onFlickingChanged: {
121 if (root.parent.parent.flicking) {
122 root.resetSwipe()
123 }
124 }
125 onSelectAll: selected = true
126 onStateChanged: selectionMode = root.parent.parent.state === "multiselectable"
127 }
128 }
129
130 Component.onCompleted: { // reload settings as delegates are destroyed
131 if (parent.parent.selectedItems.indexOf(index) !== -1) {
132 selected = true
133 }
134
135 selectionMode = root.parent.parent.state === "multiselectable"
136 }
137}
1380
=== modified file 'app/components/WeatherListView.qml'
--- app/components/WeatherListView.qml 2015-06-18 01:42:03 +0000
+++ app/components/WeatherListView.qml 2015-06-29 10:16:30 +0000
@@ -20,8 +20,7 @@
20import QtQuick 2.420import QtQuick 2.4
21import Ubuntu.Components 1.221import Ubuntu.Components 1.2
2222
2323UbuntuListView {
24ListView {
25 Component.onCompleted: {24 Component.onCompleted: {
26 // FIXME: workaround for qtubuntu not returning values depending on the grid unit definition25 // FIXME: workaround for qtubuntu not returning values depending on the grid unit definition
27 // for Flickable.maximumFlickVelocity and Flickable.flickDeceleration26 // for Flickable.maximumFlickVelocity and Flickable.flickDeceleration
2827
=== modified file 'app/ui/LocationsPage.qml'
--- app/ui/LocationsPage.qml 2015-06-28 19:04:43 +0000
+++ app/ui/LocationsPage.qml 2015-06-29 10:16:30 +0000
@@ -18,39 +18,58 @@
1818
19import QtQuick 2.419import QtQuick 2.4
20import Ubuntu.Components 1.220import Ubuntu.Components 1.2
21import Ubuntu.Components.ListItems 0.1 as ListItem21import Ubuntu.Components.ListItems 1.0 as ListItems
22import "../components"22import "../components"
23import "../components/ListItemActions"
24
2523
26Page {24Page {
27 id: locationsPage25 id: locationsPage
26
28 // Set to null otherwise the first delegate appears +header.height down the page27 // Set to null otherwise the first delegate appears +header.height down the page
29 flickable: null28 flickable: null
30 title: i18n.tr("Locations")29 title: i18n.tr("Locations")
3130
32 state: locationsListView.state === "multiselectable" ? "selection" : "default"31 state: "default"
33 states: [32 states: [
34 PageHeadState {33 PageHeadState {
35 id: defaultState
36 name: "default"34 name: "default"
35 head: locationsPage.head
37 actions: [36 actions: [
38 Action {37 Action {
39 iconName: "add"38 iconName: "add"
40 onTriggered: mainPageStack.push(Qt.resolvedUrl("AddLocationPage.qml"))39 onTriggered: {
40 mainPageStack.push(Qt.resolvedUrl("AddLocationPage.qml"))
41 }
41 }42 }
42 ]43 ]
43 PropertyChanges {44 backAction: Action {
44 target: locationsPage.head45 iconName: "down"
45 actions: defaultState.actions46 onTriggered: {
47 pageStack.pop()
48 }
46 }49 }
47 },50 },
48 MultiSelectHeadState {
49 listview: locationsListView
50 removable: true
51 thisPage: locationsPage
5251
53 onRemoved: storage.removeMultiLocations(selectedItems.slice())52 PageHeadState {
53 name: "selection"
54 head: locationsPage.head
55 when: locationsListView.ViewItems.selectMode
56 backAction: Action {
57 iconName: "back"
58 onTriggered: {
59 locationsListView.closeSelection()
60 locationsPage.state = "default"
61 }
62 }
63 actions: [
64 Action {
65 iconName: "delete"
66 enabled: locationsListView.ViewItems.selectedIndices.length !== 0
67 onTriggered: {
68 storage.removeMultiLocations(locationsListView.ViewItems.selectedIndices)
69 locationsListView.clearSelection()
70 }
71 }
72 ]
54 }73 }
55 ]74 ]
5675
@@ -58,27 +77,29 @@
58 id: currentLocationModel77 id: currentLocationModel
59 }78 }
6079
80 ListModel {
81 id: locationsModel
82 }
83
61 MultiSelectListView {84 MultiSelectListView {
62 id: locationsListView85 id: locationsListView
63 anchors {86
64 fill: parent87 clip: true
65 }88 anchors.fill: parent
66 model: ListModel {89 model: locationsModel
67 id: locationsModel90
68 }
69 header: MultiSelectListView {91 header: MultiSelectListView {
70 id: currentLocationListView92 id: currentLocationListView
71 anchors {93
72 left: parent.left94 width: parent.width
73 right: parent.right
74 }
75 height: settings.addedCurrentLocation ? units.gu(8) : units.gu(0)95 height: settings.addedCurrentLocation ? units.gu(8) : units.gu(0)
76 interactive: false96 interactive: false
77 model: currentLocationModel97 model: currentLocationModel
78 delegate: WeatherListItem {98
99 delegate: ListItem {
79 id: currentLocationListItem100 id: currentLocationListItem
80101
81 onItemClicked: {102 onClicked: {
82 settings.current = index;103 settings.current = index;
83 pageStack.pop()104 pageStack.pop()
84 }105 }
@@ -147,32 +168,44 @@
147 horizontalAlignment: Text.AlignRight168 horizontalAlignment: Text.AlignRight
148 text: temp + settings.tempScale169 text: temp + settings.tempScale
149 }170 }
171
172 ListItems.ThinDivider { anchors.bottom: parent.bottom }
150 }173 }
151 }174 }
152175
153 delegate: WeatherListItem {176 // Added a thindivider to the listview since by default the last listitem does not show
177 // a thindivider which does not follow design specs.
178 footer: ListItems.ThinDivider {
179 visible: locationsModel.count !== 0
180 }
181
182 onReorder: {
183 console.debug("Move: ", from, to);
184 storage.moveLocation(from, to);
185 }
186
187 delegate: ListItem {
154 id: locationsListItem188 id: locationsListItem
155 leftSideAction: Remove {189
156 onTriggered: storage.removeLocation(index)190 leadingActions: ListItemActions {
157 }191 actions: [
158 multiselectable: true192 Action {
159 reorderable: true193 iconName: 'delete'
160194 onTriggered: storage.removeLocation(index)
161 onItemClicked: {195 }
162 settings.current = index + 1;196 ]
163 pageStack.pop()197 }
164 }198
165 onReorder: {199 onPressAndHold: {
166 console.debug("Move: ", from, to);200 ListView.view.ViewItems.selectMode = !ListView.view.ViewItems.selectMode
167201 ListView.view.ViewItems.dragMode = !ListView.view.ViewItems.dragMode
168 storage.moveLocation(from, to);202 }
169 }203
170204 onClicked: {
171 ListItem.ThinDivider {205 if (!selectMode) {
172 anchors {206 settings.current = index + 1;
173 top: parent.top207 pageStack.pop()
174 }208 }
175 visible: index == 0
176 }209 }
177210
178 Item {211 Item {
@@ -192,6 +225,7 @@
192225
193 Label {226 Label {
194 id: locationName227 id: locationName
228 width: parent.width
195 elide: Text.ElideRight229 elide: Text.ElideRight
196 fontSize: "medium"230 fontSize: "medium"
197 text: name231 text: name
@@ -202,6 +236,7 @@
202 elide: Text.ElideRight236 elide: Text.ElideRight
203 fontSize: "small"237 fontSize: "small"
204 font.weight: Font.Light238 font.weight: Font.Light
239 width: parent.width
205 text: adminName1 == name ? countryName : adminName1240 text: adminName1 == name ? countryName : adminName1
206 }241 }
207 }242 }
@@ -236,12 +271,6 @@
236 visible: locationsPage.state === "default"271 visible: locationsPage.state === "default"
237 }272 }
238 }273 }
239
240 ListItem.ThinDivider {
241 anchors {
242 bottom: parent.bottom
243 }
244 }
245 }274 }
246 }275 }
247276
248277
=== modified file 'po/com.ubuntu.weather.pot'
--- po/com.ubuntu.weather.pot 2015-06-29 00:20:51 +0000
+++ po/com.ubuntu.weather.pot 2015-06-29 10:16:30 +0000
@@ -8,7 +8,7 @@
8msgstr ""8msgstr ""
9"Project-Id-Version: ubuntu-weather-app\n"9"Project-Id-Version: ubuntu-weather-app\n"
10"Report-Msgid-Bugs-To: \n"10"Report-Msgid-Bugs-To: \n"
11"POT-Creation-Date: 2015-06-28 19:17-0500\n"11"POT-Creation-Date: 2015-06-29 10:12+0000\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"14"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -50,22 +50,6 @@
50msgid "Today"50msgid "Today"
51msgstr ""51msgstr ""
5252
53#: ../app/components/ListItemActions/Remove.qml:26
54msgid "Remove"
55msgstr ""
56
57#: ../app/components/MultiSelectHeadState.qml:27
58msgid "Select All"
59msgstr ""
60
61#: ../app/components/MultiSelectHeadState.qml:39
62msgid "Delete"
63msgstr ""
64
65#: ../app/components/MultiSelectHeadState.qml:51
66msgid "Cancel selection"
67msgstr ""
68
69#: ../app/ubuntu-weather-app.qml:16853#: ../app/ubuntu-weather-app.qml:168
70msgid "Searching for current location..."54msgid "Searching for current location..."
71msgstr ""55msgstr ""
@@ -106,11 +90,11 @@
106msgid "OK"90msgid "OK"
107msgstr ""91msgstr ""
10892
109#: ../app/ui/HomePage.qml:31 ../app/ui/LocationsPage.qml:3093#: ../app/ui/HomePage.qml:31 ../app/ui/LocationsPage.qml:29
110msgid "Locations"94msgid "Locations"
111msgstr ""95msgstr ""
11296
113#: ../app/ui/LocationsPage.qml:10497#: ../app/ui/LocationsPage.qml:125
114msgid "Current Location"98msgid "Current Location"
115msgstr ""99msgstr ""
116100
@@ -118,15 +102,15 @@
118msgid "Settings"102msgid "Settings"
119msgstr ""103msgstr ""
120104
121#: ../app/ui/SettingsPage.qml:38 ../app/ui/settings/UnitsPage.qml:24105#: ../app/ui/SettingsPage.qml:32 ../app/ui/settings/UnitsPage.qml:24
122msgid "Units"106msgid "Units"
123msgstr ""107msgstr ""
124108
125#: ../app/ui/SettingsPage.qml:43 ../app/ui/settings/DataProviderPage.qml:24109#: ../app/ui/SettingsPage.qml:37 ../app/ui/settings/DataProviderPage.qml:24
126msgid "Data Provider"110msgid "Data Provider"
127msgstr ""111msgstr ""
128112
129#: ../app/ui/SettingsPage.qml:48 ../app/ui/settings/RefreshIntervalPage.qml:24113#: ../app/ui/SettingsPage.qml:42 ../app/ui/settings/RefreshIntervalPage.qml:24
130msgid "Refresh Interval"114msgid "Refresh Interval"
131msgstr ""115msgstr ""
132116
133117
=== modified file 'ubuntu-weather-app.desktop.in.in'
--- ubuntu-weather-app.desktop.in.in 2015-01-23 23:15:52 +0000
+++ ubuntu-weather-app.desktop.in.in 2015-06-29 10:16:30 +0000
@@ -10,3 +10,4 @@
10X-Ubuntu-Touch=true10X-Ubuntu-Touch=true
11X-Ubuntu-Default-Department-ID=accessories11X-Ubuntu-Default-Department-ID=accessories
12X-Ubuntu-Splash-Color=#F5F5F512X-Ubuntu-Splash-Color=#F5F5F5
13X-Ubuntu-Supported-Orientations=portrait

Subscribers

People subscribed via source and target branches