Merge lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_1539982 into lp:ubuntu-calendar-app

Proposed by Arthur Mello
Status: Merged
Approved by: Renato Araujo Oliveira Filho
Approved revision: 806
Merged at revision: 806
Proposed branch: lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_1539982
Merge into: lp:ubuntu-calendar-app
Diff against target: 52 lines (+14/-15)
1 file modified
MonthComponent.qml (+14/-15)
To merge this branch: bzr merge lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_1539982
Reviewer Review Type Date Requested Status
Renato Araujo Oliveira Filho (community) Approve
Jenkins Bot continuous-integration Approve
Nekhelesh Ramananthan testing Approve
Review via email: mp+290035@code.launchpad.net

Commit message

Make sure that dates from previous/next months can be selected from month view

Description of the change

Make sure that dates from previous/next months can be selected from month view

Tests
-----
In Month view, make sure that any date is highlighted after clicked. Test with dates from previous, current and next month.
It should still work when previous month is December from last year and next month is January from next

To post a comment you must log in.
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

Works as expected and fixed the bug! LGTM!

review: Approve (testing)
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

works nice. But I have some inline questions.

804. By Arthur Mello

Fix new event time with press and hold on Months view

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
805. By Arthur Mello

Get the current time of click

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
806. By Arthur Mello

Undo changes

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

looks good now.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'MonthComponent.qml'
2--- MonthComponent.qml 2016-03-09 01:35:28 +0000
3+++ MonthComponent.qml 2016-03-28 16:21:58 +0000
4@@ -95,14 +95,19 @@
5 return -1;
6 }
7
8- if ((root.currentMonth === date.getMonth()) &&
9- (root.currentYear === date.getFullYear())) {
10-
11- return date.getDate() +
12- (Date.daysInMonth(monthStartYear, monthStartMonth) - monthStartDate);
13- } else {
14- return -1;
15+ if (date.getFullYear() < root.currentYear ||
16+ (date.getFullYear() === root.currentYear && date.getMonth() < root.currentMonth)) {
17+ return offset - (Date.daysInMonth(date.getFullYear(), date.getMonth()) - date.getDate());
18+
19+ } else if (date.getFullYear() === root.currentYear && date.getMonth() === root.currentMonth) {
20+ return offset + date.getDate();
21+
22+ } else if (date.getFullYear() > root.currentYear ||
23+ (date.getFullYear() === root.currentYear && date.getMonth() > root.currentMonth)) {
24+ return offset + Date.daysInMonth(root.currentYear, root.currentMonth) + date.getDate();
25 }
26+
27+ return -1;
28 }
29 }
30
31@@ -245,19 +250,13 @@
32 var dayItem = getItemAt(mouse.x, mouse.y)
33
34 if( dayItem.isSelected ) {
35- var selectedDate = new Date();
36- selectedDate.setFullYear(intern.monthStartYear)
37- selectedDate.setMonth(intern.monthStartMonth + 1)
38- selectedDate.setDate(dayItem.date)
39- selectedDate.setMinutes(60, 0, 0)
40+ var selectedDate = new Date(dayItem.delegateDate.getTime());
41 pageStack.push(Qt.resolvedUrl("NewEvent.qml"), {"date":selectedDate, "model":eventModel});
42 }
43 }
44 onClicked: {
45 var dayItem = getItemAt(mouse.x, mouse.y)
46- var selectedDate = new Date(intern.monthStartYear,
47- intern.monthStartMonth + 1,
48- dayItem.date, 0, 0, 0, 0)
49+ var selectedDate = new Date(dayItem.delegateDate.getTime());
50 if (root.isYearView) {
51 //If yearView is clicked then open selected MonthView
52 root.monthSelected(selectedDate);

Subscribers

People subscribed via source and target branches

to status/vote changes: