@@ -18,6 +18,7 @@ import QtQuick 2.3
1818import Ubuntu.Components 1.2
1919import Wizard 0.1
2020import Ubuntu.SystemSettings.TimeDate 1.0
21+import Utils 0.1 as Utils
2122import ".." as LocalComponents
2223
2324LocalComponents.Page {
@@ -27,21 +28,11 @@ LocalComponents.Page {
2728 title: i18n.tr("Time Zone")
2829 forwardButtonSourceComponent: forwardButton
2930
30− property alias selectedTimeZone: tzModel.selectedZoneId
31+ property string selectedTimeZone: ""
3132
3233 UbuntuTimeDatePanel {
3334 id: timeDatePanel
34− }
35−
36− TimeZoneModel {
37− id: tzModel
38− }
39−
40− TimeZoneFilterModel {
41− id: tzFilterModel
42− sourceModel: tzModel
4335 filter: searchField.text
44− country: root.countryCode
4536 }
4637
4738 Component.onCompleted: {
@@ -61,28 +52,34 @@ LocalComponents.Page {
6152 id: tz
6253 objectName: "tz"
6354 highlightColor: backgroundColor
64− readonly property bool currentTz: !!id ? selectedTimeZone === id : false
55+ readonly property bool currentTz: ListView.view.currentIndex === index
6556
6657 Column {
6758 anchors.verticalCenter: parent.verticalCenter
6859 anchors.left: parent.left
6960 anchors.leftMargin: leftMargin
61+ anchors.right: image.left
62+ anchors.rightMargin: rightMargin
7063 Label {
7164 id: cityLabel
72− text: !!city ? city : ""
65+ text: displayName
7366 font.weight: tz.currentTz ? Font.Normal : Font.Light
7467 fontSize: "medium"
7568 color: textColor
69+ elide: Text.ElideMiddle
70+ maximumLineCount: 1
71+ width: parent.width
7672 }
7773 Label {
7874 id: timeLabel
79− text: !!time ? time + " " + abbreviation : ""
75+ text: Utils.TimezoneFormatter.currentTimeInTimezoneWithAbbrev(timeZone)
8076 font.weight: tz.currentTz ? Font.Normal : Font.Light
8177 fontSize: "small"
8278 color: textColor
8379 }
8480 }
8581 Image {
82+ id: image
8683 anchors {
8784 right: parent.right
8885 verticalCenter: parent.verticalCenter
@@ -96,9 +93,10 @@ LocalComponents.Page {
9693 }
9794
9895 onClicked: {
99− selectedTimeZone = id
100− print("Selected tz: " + selectedTimeZone)
101− print("Clicked country", countryCode)
96+ print("Clicked index", index)
97+ ListView.view.currentIndex = index
98+ selectedTimeZone = timeZone
99+ print("Clicked country", country)
102100 }
103101 }
104102 }
@@ -121,7 +119,9 @@ LocalComponents.Page {
121119 inputMethodHints: Qt.ImhNoPredictiveText
122120 onTextChanged: {
123121 // reset when switching between filter modes (text/country)
122+ print("Filter:", text)
124123 selectedTimeZone = ""
124+ tzList.currentIndex = -1
125125 }
126126 }
127127
@@ -139,7 +139,7 @@ LocalComponents.Page {
139139 }
140140
141141 height: column.height - searchField.height - column.spacing - topMargin
142− model: tzFilterModel
142+ model: timeDatePanel.timeZoneModel
143143 delegate: tzComponent
144144 }
145145 }