Merge lp:~vthompson/ubuntu-calendar-app/fix-1311159-1311133 into lp:ubuntu-calendar-app

Proposed by Victor Thompson
Status: Merged
Approved by: Mihir Soni
Approved revision: 257
Merged at revision: 257
Proposed branch: lp:~vthompson/ubuntu-calendar-app/fix-1311159-1311133
Merge into: lp:ubuntu-calendar-app
Diff against target: 87 lines (+14/-21)
1 file modified
NewEvent.qml (+14/-21)
To merge this branch: bzr merge lp:~vthompson/ubuntu-calendar-app/fix-1311159-1311133
Reviewer Review Type Date Requested Status
Mihir Soni Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+217159@code.launchpad.net

Commit message

* Use date rounded up to nearest half hour
* Set TimePicker to the value in the field

Description of the change

* Use date rounded up to nearest half hour
* Set TimePicker to the value in the field

To post a comment you must log in.
Revision history for this message
Victor Thompson (vthompson) wrote :

Currently I'm unable to directly verify this fix because of lp:1312480. I can't get trunk to run on the desktop either, at the moment.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Mihir Soni (mihirsoni) wrote :

Looks good to me , i have tested it on desktop.

review: Approve
Revision history for this message
Victor Thompson (vthompson) wrote :

Now that I can run on the device (adding the fix for lp:1312480), it seems it doesn't work on my Nexus 4. I'll investigate.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
257. By Victor Thompson

Merge trunk

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Victor Thompson (vthompson) wrote :

This should be working now on both the desktop and the device.

Revision history for this message
Mihir Soni (mihirsoni) wrote :

Looks good to me Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NewEvent.qml'
2--- NewEvent.qml 2014-04-25 00:17:55 +0000
3+++ NewEvent.qml 2014-04-27 19:52:25 +0000
4@@ -10,7 +10,7 @@
5
6 Page {
7 id: root
8- property var date: new Date();
9+ property var date;
10
11 property var event:null;
12 property var model;
13@@ -24,16 +24,17 @@
14
15 Component.onCompleted: {
16
17+ date = new Date()
18 pageStack.header.visible = true;
19
20 // If startDate is setted by argument we have to not change it
21 if (typeof(startDate) === 'undefined')
22- startDate = new Date(date)
23+ startDate = new Date(root.roundDate(date))
24
25 // If endDate is setted by argument we have to not change it
26 if (typeof(endDate) === 'undefined') {
27- endDate = new Date(date)
28- endDate.setMinutes( endDate.getMinutes() + 30)
29+ endDate = new Date(root.roundDate(date))
30+ endDate.setMinutes(endDate.getMinutes() + 30)
31 }
32
33 if(event === null){
34@@ -49,9 +50,6 @@
35 //Data for Add events
36 function addEvent() {
37 event = Qt.createQmlObject("import QtOrganizer 5.0; Event { }", Qt.application,"NewEvent.qml");
38- startDate = new Date(date)
39- endDate = new Date(date)
40- endDate.setMinutes( endDate.getMinutes() + 30)
41
42 startTime.text = Qt.formatDateTime(startDate, "dd MMM yyyy hh:mm");
43 endTime.text = Qt.formatDateTime(endDate, "dd MMM yyyy hh:mm");
44@@ -158,18 +156,13 @@
45 }
46 }
47
48- // Calucate default hour for start and end time on event
49- function hourForPickerFromDate(date) {
50- if(date.getMinutes() < 30)
51- return date.getHours()
52- return date.getHours() + 1
53- }
54-
55- // Calucate default minute for start and end time on event
56- function minuteForPickerFromDate(date) {
57- if(date.getMinutes() < 30)
58- return 30
59- return 0
60+ // Calucate default hour and minute for start and end time on event
61+ function roundDate(date) {
62+ var tempDate = new Date(date)
63+ if(tempDate.getMinutes() < 30)
64+ return tempDate.setMinutes(30)
65+ tempDate.setMinutes(0)
66+ return tempDate.setHours(tempDate.getHours() + 1)
67 }
68
69 width: parent.width
70@@ -286,7 +279,7 @@
71 anchors.fill: parent
72 onClicked: {
73 internal.clearFocus()
74- var popupObj = PopupUtils.open(timePicker,root,{"hour": root.hourForPickerFromDate(startDate),"minute":root.minuteForPickerFromDate(startDate)});
75+ var popupObj = PopupUtils.open(timePicker,root,{"hour": startDate.getHours(),"minute":startDate.getMinutes()});
76 popupObj.accepted.connect(function(startHour, startMinute) {
77 var newDate = startDate;
78 newDate.setHours(startHour, startMinute);
79@@ -311,7 +304,7 @@
80 anchors.fill: parent
81 onClicked: {
82 internal.clearFocus()
83- var popupObj = PopupUtils.open(timePicker,root,{"hour": root.hourForPickerFromDate(endDate),"minute":root.minuteForPickerFromDate(endDate)});
84+ var popupObj = PopupUtils.open(timePicker,root,{"hour": endDate.getHours(),"minute":endDate.getMinutes()});
85 popupObj.accepted.connect(function(startHour, startMinute) {
86 var newDate = endDate;
87 newDate.setHours(startHour, startMinute);

Subscribers

People subscribed via source and target branches

to status/vote changes: