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
=== modified file 'plugins/time-date/PageComponent.qml'
--- plugins/time-date/PageComponent.qml 2014-10-31 08:45:10 +0000
+++ plugins/time-date/PageComponent.qml 2015-06-30 03:19:03 +0000
@@ -26,8 +26,10 @@
26import Ubuntu.SystemSettings.TimeDate 1.026import Ubuntu.SystemSettings.TimeDate 1.0
2727
28ItemPage {28ItemPage {
29 id: root
29 title: i18n.tr("Time & Date")30 title: i18n.tr("Time & Date")
30 objectName: "timeDatePage"31 objectName: "timeDatePage"
32 flickable: scrollWidget
3133
32 function getUTCOffset() {34 function getUTCOffset() {
33 // We get the difference in minutes between UTC and our TZ (UTC - TZ)35 // We get the difference in minutes between UTC and our TZ (UTC - TZ)
@@ -47,76 +49,85 @@
47 }49 }
48 }50 }
4951
50 Column {52 Flickable {
53 id: scrollWidget
51 anchors.fill: parent54 anchors.fill: parent
5255 contentHeight: contentItem.childrenRect.height
53 SettingsItemTitle { text: i18n.tr ("Time zone:") }56 boundsBehavior: (contentHeight > root.height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
5457 flickableDirection: Flickable.VerticalFlick
55 ListItem.SingleValue {58
56 objectName: "timeZone"59 Column {
57 id: timeZone60 anchors.left: parent.left
58 //e.g. America/New_York -> America/New York61 anchors.right: parent.right
59 text: timeDatePanel.timeZone.replace("_", " ")62
60 value: getUTCOffset()63 SettingsItemTitle { text: i18n.tr ("Time zone:") }
61 progression: true64
62 onClicked: pageStack.push(Qt.resolvedUrl("ChooseTimeZone.qml"))65 ListItem.SingleValue {
63 }66 objectName: "timeZone"
6467 id: timeZone
65 SettingsItemTitle {68 //e.g. America/New_York -> America/New York
66 text: i18n.tr ("Set the time and date:")69 text: timeDatePanel.timeZone.replace("_", " ")
67 }70 value: getUTCOffset()
6871 progression: true
69 ListItem.ItemSelector {72 onClicked: pageStack.push(Qt.resolvedUrl("ChooseTimeZone.qml"))
70 id: setTimeAutomatically73 }
71 objectName: "timeItemSelector"74
72 model: [ i18n.tr("Automatically") , i18n.tr("Manually")]75 SettingsItemTitle {
73 expanded: true76 text: i18n.tr ("Set the time and date:")
74 onSelectedIndexChanged: {77 }
75 var useNTP = (selectedIndex === 0) // 0 = Automatically78
76 timeDatePanel.useNTP = useNTP79 ListItem.ItemSelector {
77 }80 id: setTimeAutomatically
78 }81 objectName: "timeItemSelector"
7982 model: [ i18n.tr("Automatically") , i18n.tr("Manually")]
80 Binding {83 expanded: true
81 target: setTimeAutomatically84 onSelectedIndexChanged: {
82 property: "selectedIndex"85 var useNTP = (selectedIndex === 0) // 0 = Automatically
83 value: timeDatePanel.useNTP ? 0 : 186 timeDatePanel.useNTP = useNTP
84 }87 }
8588 }
86 Timer {89
87 onTriggered: currentTime.text = Qt.formatDateTime(90 Binding {
88 new Date(),91 target: setTimeAutomatically
89 Qt.DefaultLocaleLongDate)92 property: "selectedIndex"
90 triggeredOnStart: true93 value: timeDatePanel.useNTP ? 0 : 1
91 repeat: true94 }
92 running: true95
93 }96 Timer {
9497 onTriggered: currentTime.text = Qt.formatDateTime(
95 Component {98 new Date(),
96 id: timePicker99 Qt.DefaultLocaleLongDate)
97 TimePicker {}100 triggeredOnStart: true
98 }101 repeat: true
99102 running: true
100 ListItem.Standard {103 }
101 id: currentTime104
102 objectName: "currentTime"105 Component {
103 progression: setTimeAutomatically.selectedIndex === 1 // Manually106 id: timePicker
104 enabled: progression107 TimePicker {}
105 onClicked: {108 }
106 Qt.inputMethod.hide()109
107 var popupObj = PopupUtils.open(timePicker);110 ListItem.Standard {
108 popupObj.accepted.connect(111 id: currentTime
109 function(hour, minute, second,112 objectName: "currentTime"
110 day, month, year) {113 progression: setTimeAutomatically.selectedIndex === 1 // Manually
111 var newDate = new Date(year,114 enabled: progression
112 month,115 onClicked: {
113 day,116 Qt.inputMethod.hide()
114 hour,117 var popupObj = PopupUtils.open(timePicker);
115 minute,118 popupObj.accepted.connect(
116 second)119 function(hour, minute, second,
117 // Milliseconds to microseconds120 day, month, year) {
118 timeDatePanel.setTime(newDate.getTime() * 1000)121 var newDate = new Date(year,
119 })122 month,
123 day,
124 hour,
125 minute,
126 second)
127 // Milliseconds to microseconds
128 timeDatePanel.setTime(newDate.getTime() * 1000)
129 })
130 }
120 }131 }
121 }132 }
122 }133 }

Subscribers

People subscribed via source and target branches