Merge lp:~feng-kylin/ubuntu-system-settings/AddFlickableInTimeDatePage into lp:ubuntu-system-settings

Proposed by handsome_feng
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 1450
Merged at revision: 1469
Proposed branch: lp:~feng-kylin/ubuntu-system-settings/AddFlickableInTimeDatePage
Merge into: lp:ubuntu-system-settings
Diff against target: 169 lines (+80/-69)
1 file modified
plugins/time-date/PageComponent.qml (+80/-69)
To merge this branch: bzr merge lp:~feng-kylin/ubuntu-system-settings/AddFlickableInTimeDatePage
Reviewer Review Type Date Requested Status
Sebastien Bacher (community) Approve
Review via email: mp+263315@code.launchpad.net

Commit message

Add flickable in time/date page.

Description of the change

Add flickable in time/date page.

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/time-date/PageComponent.qml'
2--- plugins/time-date/PageComponent.qml 2014-10-31 08:45:10 +0000
3+++ plugins/time-date/PageComponent.qml 2015-06-30 03:19:03 +0000
4@@ -26,8 +26,10 @@
5 import Ubuntu.SystemSettings.TimeDate 1.0
6
7 ItemPage {
8+ id: root
9 title: i18n.tr("Time & Date")
10 objectName: "timeDatePage"
11+ flickable: scrollWidget
12
13 function getUTCOffset() {
14 // We get the difference in minutes between UTC and our TZ (UTC - TZ)
15@@ -47,76 +49,85 @@
16 }
17 }
18
19- Column {
20+ Flickable {
21+ id: scrollWidget
22 anchors.fill: parent
23-
24- SettingsItemTitle { text: i18n.tr ("Time zone:") }
25-
26- ListItem.SingleValue {
27- objectName: "timeZone"
28- id: timeZone
29- //e.g. America/New_York -> America/New York
30- text: timeDatePanel.timeZone.replace("_", " ")
31- value: getUTCOffset()
32- progression: true
33- onClicked: pageStack.push(Qt.resolvedUrl("ChooseTimeZone.qml"))
34- }
35-
36- SettingsItemTitle {
37- text: i18n.tr ("Set the time and date:")
38- }
39-
40- ListItem.ItemSelector {
41- id: setTimeAutomatically
42- objectName: "timeItemSelector"
43- model: [ i18n.tr("Automatically") , i18n.tr("Manually")]
44- expanded: true
45- onSelectedIndexChanged: {
46- var useNTP = (selectedIndex === 0) // 0 = Automatically
47- timeDatePanel.useNTP = useNTP
48- }
49- }
50-
51- Binding {
52- target: setTimeAutomatically
53- property: "selectedIndex"
54- value: timeDatePanel.useNTP ? 0 : 1
55- }
56-
57- Timer {
58- onTriggered: currentTime.text = Qt.formatDateTime(
59- new Date(),
60- Qt.DefaultLocaleLongDate)
61- triggeredOnStart: true
62- repeat: true
63- running: true
64- }
65-
66- Component {
67- id: timePicker
68- TimePicker {}
69- }
70-
71- ListItem.Standard {
72- id: currentTime
73- objectName: "currentTime"
74- progression: setTimeAutomatically.selectedIndex === 1 // Manually
75- enabled: progression
76- onClicked: {
77- Qt.inputMethod.hide()
78- var popupObj = PopupUtils.open(timePicker);
79- popupObj.accepted.connect(
80- function(hour, minute, second,
81- day, month, year) {
82- var newDate = new Date(year,
83- month,
84- day,
85- hour,
86- minute,
87- second)
88- // Milliseconds to microseconds
89- timeDatePanel.setTime(newDate.getTime() * 1000)
90- })
91+ contentHeight: contentItem.childrenRect.height
92+ boundsBehavior: (contentHeight > root.height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
93+ flickableDirection: Flickable.VerticalFlick
94+
95+ Column {
96+ anchors.left: parent.left
97+ anchors.right: parent.right
98+
99+ SettingsItemTitle { text: i18n.tr ("Time zone:") }
100+
101+ ListItem.SingleValue {
102+ objectName: "timeZone"
103+ id: timeZone
104+ //e.g. America/New_York -> America/New York
105+ text: timeDatePanel.timeZone.replace("_", " ")
106+ value: getUTCOffset()
107+ progression: true
108+ onClicked: pageStack.push(Qt.resolvedUrl("ChooseTimeZone.qml"))
109+ }
110+
111+ SettingsItemTitle {
112+ text: i18n.tr ("Set the time and date:")
113+ }
114+
115+ ListItem.ItemSelector {
116+ id: setTimeAutomatically
117+ objectName: "timeItemSelector"
118+ model: [ i18n.tr("Automatically") , i18n.tr("Manually")]
119+ expanded: true
120+ onSelectedIndexChanged: {
121+ var useNTP = (selectedIndex === 0) // 0 = Automatically
122+ timeDatePanel.useNTP = useNTP
123+ }
124+ }
125+
126+ Binding {
127+ target: setTimeAutomatically
128+ property: "selectedIndex"
129+ value: timeDatePanel.useNTP ? 0 : 1
130+ }
131+
132+ Timer {
133+ onTriggered: currentTime.text = Qt.formatDateTime(
134+ new Date(),
135+ Qt.DefaultLocaleLongDate)
136+ triggeredOnStart: true
137+ repeat: true
138+ running: true
139+ }
140+
141+ Component {
142+ id: timePicker
143+ TimePicker {}
144+ }
145+
146+ ListItem.Standard {
147+ id: currentTime
148+ objectName: "currentTime"
149+ progression: setTimeAutomatically.selectedIndex === 1 // Manually
150+ enabled: progression
151+ onClicked: {
152+ Qt.inputMethod.hide()
153+ var popupObj = PopupUtils.open(timePicker);
154+ popupObj.accepted.connect(
155+ function(hour, minute, second,
156+ day, month, year) {
157+ var newDate = new Date(year,
158+ month,
159+ day,
160+ hour,
161+ minute,
162+ second)
163+ // Milliseconds to microseconds
164+ timeDatePanel.setTime(newDate.getTime() * 1000)
165+ })
166+ }
167 }
168 }
169 }

Subscribers

People subscribed via source and target branches