on xenial help sign in
Use new setTimeZone method to set user-friendly timezone name in the wizard. Fixes: #1566295

Approved by: Lukáš Tinkl

commitb6c8657343eb6ca14c862bf01c329e7eb1b47138 authorMichael Terry <michael.terry@canonical.com> dateFri 27 May 2016, 13:52 (10 years ago) parent7f8d853128e146
6 files changed+27−11
debian/control+1−1 qml/Wizard/Pages/50-timezone.qml+5−2 tests/mocks/Ubuntu/SystemSettings/TimeDate/CMakeLists.txt+1−1 tests/mocks/Ubuntu/SystemSettings/TimeDate/MockTimeDate.qml+15−3 tests/mocks/Ubuntu/SystemSettings/TimeDate/qmldir+1−1 tests/qmltests/Wizard/tst_Wizard.qml+4−3
debian/control+1−1
@@ -108,7 +108,7 @@ Depends: dmz-cursor-theme,
108108 qtdeclarative5-qtmir-plugin (>= 0.4.8),
109109 qtdeclarative5-ubuntu-telephony0.1,
110110 qtdeclarative5-ubuntu-web-plugin,
111− ubuntu-system-settings,
111+ ubuntu-system-settings (>= 0.4),
112112 unity-launcher-impl-7,
113113 unity8-common (= ${source:Version}),
114114 unity8-private (= ${binary:Version}),
qml/Wizard/Pages/50-timezone.qml+5−2
@@ -18,7 +18,7 @@ import QtQuick 2.4
1818import QtQuick.Layouts 1.1
1919import Ubuntu.Components 1.3
2020import Wizard 0.1
21−import Ubuntu.SystemSettings.TimeDate 1.0
21+import Ubuntu.SystemSettings.TimeDate 1.1
2222import Utils 0.1 as Utils
2323import ".." as LocalComponents
2424
@@ -30,6 +30,7 @@ LocalComponents.Page {
3030 forwardButtonSourceComponent: forwardButton
3131
3232 property string selectedTimeZone: ""
33+ property string selectedTimeZoneName: ""
3334 readonly property bool showingMap: wideMode && width >= units.gu(110)
3435
3536 // for testing
@@ -67,6 +68,7 @@ LocalComponents.Page {
6768
6869 function resetViews() {
6970 selectedTimeZone = ""
71+ selectedTimeZoneName = ""
7072 tzList.currentIndex = -1
7173 highlightImage.source = ""
7274 pinImage.x = 0;
@@ -144,6 +146,7 @@ LocalComponents.Page {
144146 highlightTimezone(offset);
145147 ListView.view.currentIndex = index;
146148 selectedTimeZone = timeZone;
149+ selectedTimeZoneName = city;
147150 //print("Clicked at city with coords:", longitude, latitude);
148151 //print("Clicked on TZ:", timeZone);
149152 //print("Highlight at (x,y):", longitudeToX(longitude, map.width), latitudeToY(latitude, map.height));
@@ -267,7 +270,7 @@ LocalComponents.Page {
267270 text: i18n.tr("Next")
268271 enabled: selectedTimeZone != ""
269272 onClicked: {
270− timeDatePanel.timeZone = selectedTimeZone;
273+ timeDatePanel.setTimeZone(selectedTimeZone, selectedTimeZoneName);
271274 pageStack.next();
272275 }
273276 }
tests/mocks/Ubuntu/SystemSettings/TimeDate/CMakeLists.txt+1−1
@@ -1 +1 @@
1−add_unity8_mock(Ubuntu.SystemSettings.TimeDate 1.0 Ubuntu/SystemSettings/TimeDate)
1+add_unity8_mock(Ubuntu.SystemSettings.TimeDate 1.1 Ubuntu/SystemSettings/TimeDate)
tests/mocks/Ubuntu/SystemSettings/TimeDate/MockTimeDate.qml+15−3
@@ -18,8 +18,20 @@ import QtQuick 2.4
1818
1919Item {
2020 id: root
21− property string timeZone: "Europe/Prague"
22− onTimeZoneChanged: root.timeZoneChangedCalled(root.timeZone);
21+ readonly property alias timeZone: d.timeZone
22+ readonly property alias timeZoneName: d.timeZoneName
2323
24− signal timeZoneChangedCalled(string tz);
24+ signal timeZoneChangedCalled(string tz, string name) // only in mock
25+
26+ function setTimeZone(tz, name) {
27+ d.timeZone = tz;
28+ d.timeZoneName = name;
29+ timeZoneChangedCalled(tz, name);
30+ }
31+
32+ QtObject {
33+ id: d
34+ property string timeZone: "Europe/Prague"
35+ property string timeZoneName: "Prague"
36+ }
2537}
tests/mocks/Ubuntu/SystemSettings/TimeDate/qmldir+1−1
@@ -1,2 +1,2 @@
11module Ubuntu.SystemSettings.TimeDate
2−UbuntuTimeDatePanel 1.0 MockTimeDate.qml
2+UbuntuTimeDatePanel 1.1 MockTimeDate.qml
tests/qmltests/Wizard/tst_Wizard.qml+4−3
@@ -21,7 +21,7 @@ import MeeGo.QOfono 0.2
2121import QMenuModel 0.1
2222import Ubuntu.Components 1.3
2323import Ubuntu.SystemSettings.SecurityPrivacy 1.0
24−import Ubuntu.SystemSettings.TimeDate 1.0
24+import Ubuntu.SystemSettings.TimeDate 1.1
2525import Unity.Test 0.1 as UT
2626import Wizard 0.1
2727import "../../../qml/Wizard"
@@ -455,7 +455,7 @@ Item {
455455 var tzFilter = findChild(page, "tzFilter");
456456 verify(tzFilter);
457457 tap(tzFilter);
458− typeString("London");
458+ typeString("Belfa");
459459
460460 var tzList = findChild(page, "tzList");
461461 verify(tzList);
@@ -469,7 +469,8 @@ Item {
469469 // go next and verify the (mock) signal got fired
470470 tap(findChild(page, "forwardButton"));
471471 tryCompare(timezoneSpy, "count", 1);
472− tryCompare(page.tdModule, "timeZone", timezoneSpy.signalArguments[0][0]);
472+ compare(timezoneSpy.signalArguments[0][0], "Europe/London");
473+ compare(timezoneSpy.signalArguments[0][1], "Belfast");
473474 }
474475
475476 function test_accountPage() {