Merge lp:~larochelle-brian/ubuntu-calendar-app/30MinIncrementsHackdays into lp:ubuntu-calendar-app

Proposed by brian larochelle
Status: Merged
Approved by: Kunal Parmar
Approved revision: 225
Merged at revision: 223
Proposed branch: lp:~larochelle-brian/ubuntu-calendar-app/30MinIncrementsHackdays
Merge into: lp:ubuntu-calendar-app
Diff against target: 60 lines (+18/-4)
1 file modified
NewEvent.qml (+18/-4)
To merge this branch: bzr merge lp:~larochelle-brian/ubuntu-calendar-app/30MinIncrementsHackdays
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Kunal Parmar Approve
brian larochelle (community) Needs Resubmitting
Review via email: mp+213067@code.launchpad.net

This proposal supersedes a proposal from 2014-03-27.

Commit message

Added logic to NewEvent.qml to choose a default of either 0 or 30 for minutes for the TimePicker. If minutes are past 30, an hour is added.

Description of the change

Added logic to NewEvent.qml to choose a default of either 0 or 30 for minutes for the TimePicker. If minutes are past 30, an hour is added.

To post a comment you must log in.
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote : Posted in a previous version of this proposal

8 + startTime.defaultHour = (startDate.getMinutes() < 30) ? startDate.getHours() : startDate.getHours() + 1
19 + startTime.defaultMinute = (startDate.getMinutes() < 30) ? 30 : 0
20 + var popupObj = PopupUtils.open(timePicker,root,{"hour": startTime.defaultHour,"minute":startTime.defaultMinute});

Can we move above code to separate function ?

Revision history for this message
brian larochelle (larochelle-brian) wrote : Posted in a previous version of this proposal

sure.

I moved the logic to functions off the root of NewEvent {} and changed the ternary statements to if statements to improve readability.

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote : Posted in a previous version of this proposal

Code looks great, Thanks.

I will test and approve it.

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote : Posted in a previous version of this proposal

8 - var popupObj = PopupUtils.open(timePicker,root,{"hour": endDate.getHours(),"minute":endDate.getMinutes()});
39 + var popupObj = PopupUtils.open(timePicker,root,{"hour": root.hourForPickerFromDate(startDate),"minute":root.minuteForPickerFromDate(startDate)});

looks copy/paste error.

You are using startDate, instead of endDate

review: Needs Fixing
Revision history for this message
brian larochelle (larochelle-brian) wrote : Posted in a previous version of this proposal

Opps. I shouldn't have let that slip by. Thats what I get for trying to sneak this in at work... resubmitting.
thanks for the review.

Revision history for this message
brian larochelle (larochelle-brian) wrote :

Sorry again. I made another error. I'll take a little more time for this. Currently at work and was rushing to fix this.

review: Needs Fixing
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote : Posted in a previous version of this proposal

:),

One more thing, that I am not sure of but.

Currently you are setting incremental value to time picker.

But do we need to set incremental time to start and end time label as well on construction ?

Revision history for this message
brian larochelle (larochelle-brian) wrote :

I was wondering that myself. I didn't see a clear pro or con, so I left it as is. I kinda like the label getting the real time at construction, but that preference isn't based on much. I'd be willing to change it, if that is decided.

225. By brian larochelle

Fix copy/paste error.
Increment the endDate by 30 instread of 10

Revision history for this message
brian larochelle (larochelle-brian) wrote :

Fixed copy/paste error.

also noticed endDate should have its minutes incremented by 30 instead of 10.
17 - endDate.setMinutes( endDate.getMinutes() + 10)
18 + endDate.setMinutes( endDate.getMinutes() + 30)

review: Needs Resubmitting
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

Thanks :), Looks great,
I will test once more and approve.

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

looks good to me

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

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-02-19 11:39:13 +0000
3+++ NewEvent.qml 2014-03-27 14:56:26 +0000
4@@ -33,7 +33,7 @@
5 // If endDate is setted by argument we have to not change it
6 if (typeof(endDate) === 'undefined') {
7 endDate = new Date(date)
8- endDate.setMinutes( endDate.getMinutes() + 10)
9+ endDate.setMinutes( endDate.getMinutes() + 30)
10 }
11 internal.eventModel = GlobalModel.globalModel();
12
13@@ -52,7 +52,7 @@
14 event = Qt.createQmlObject("import QtOrganizer 5.0; Event { }", Qt.application,"NewEvent.qml");
15 startDate = new Date(date)
16 endDate = new Date(date)
17- endDate.setMinutes( endDate.getMinutes() + 10)
18+ endDate.setMinutes( endDate.getMinutes() + 30)
19
20 startTime.text = Qt.formatDateTime(startDate, "dd MMM yyyy hh:mm");
21 endTime.text = Qt.formatDateTime(endDate, "dd MMM yyyy hh:mm");
22@@ -159,6 +159,20 @@
23 }
24 }
25
26+ // Calucate default hour for start and end time on event
27+ function hourForPickerFromDate(date) {
28+ if(date.getMinutes() < 30)
29+ return date.getHours()
30+ return date.getHours() + 1
31+ }
32+
33+ // Calucate default minute for start and end time on event
34+ function minuteForPickerFromDate(date) {
35+ if(date.getMinutes() < 30)
36+ return 30
37+ return 0
38+ }
39+
40 width: parent.width
41 height: parent.height
42
43@@ -269,7 +283,7 @@
44 anchors.fill: parent
45 onClicked: {
46 internal.clearFocus()
47- var popupObj = PopupUtils.open(timePicker,root,{"hour": startDate.getHours(),"minute":startDate.getMinutes()});
48+ var popupObj = PopupUtils.open(timePicker,root,{"hour": root.hourForPickerFromDate(startDate),"minute":root.minuteForPickerFromDate(startDate)});
49 popupObj.accepted.connect(function(startHour, startMinute) {
50 var newDate = startDate;
51 newDate.setHours(startHour, startMinute);
52@@ -294,7 +308,7 @@
53 anchors.fill: parent
54 onClicked: {
55 internal.clearFocus()
56- var popupObj = PopupUtils.open(timePicker,root,{"hour": endDate.getHours(),"minute":endDate.getMinutes()});
57+ var popupObj = PopupUtils.open(timePicker,root,{"hour": root.hourForPickerFromDate(endDate),"minute":root.minuteForPickerFromDate(endDate)});
58 popupObj.accepted.connect(function(startHour, startMinute) {
59 var newDate = endDate;
60 newDate.setHours(startHour, startMinute);

Subscribers

People subscribed via source and target branches

to status/vote changes: