Merge lp:~renatofilho/ubuntu-calendar-app/fix-1616029 into lp:ubuntu-calendar-app

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Arthur Mello
Approved revision: 873
Merged at revision: 872
Proposed branch: lp:~renatofilho/ubuntu-calendar-app/fix-1616029
Merge into: lp:ubuntu-calendar-app
Diff against target: 119 lines (+66/-15)
2 files modified
EventRepetition.qml (+6/-1)
NewEvent.qml (+60/-14)
To merge this branch: bzr merge lp:~renatofilho/ubuntu-calendar-app/fix-1616029
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Approve
Arthur Mello (community) Approve
system-apps-ci-bot continuous-integration Approve
Review via email: mp+303836@code.launchpad.net

Commit message

Fix event save with attendee, and recurrence limit

Make sure that Attendee get save after edit an event.
Use UTC date in the event recurrence limit.

To post a comment you must log in.
871. By Renato Araujo Oliveira Filho

Fix event save with attendee.

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

PASSED: Continuous integration, rev:871
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-calendar-app-ci/29/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/1292
    SUCCESS: https://jenkins.canonical.com/system-apps/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=default/287
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/1292
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/1158
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial+overlay/1158
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=yakkety/1158
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1141
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1141/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1141
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1141/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1141
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1141/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1141
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1141/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1141
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1141/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1141
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1141/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1141
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1141/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1141
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1141/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1141
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1141/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-calendar-app-ci/29/rebuild

review: Approve (continuous-integration)
872. By Renato Araujo Oliveira Filho

Use UTC date in the event recurrence limit.

873. By Renato Araujo Oliveira Filho

Fixed remove attendee from a event.

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

PASSED: Continuous integration, rev:872
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-calendar-app-ci/31/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/1340
    SUCCESS: https://jenkins.canonical.com/system-apps/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=default/305
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/1340
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/1203
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial+overlay/1203
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=yakkety/1203
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1183
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1183/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1183
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1183/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1183
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1183/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1183
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1183/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1183
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1183/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1183
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1183/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1183
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1183/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1183
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1183/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1183
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1183/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-calendar-app-ci/31/rebuild

review: Approve (continuous-integration)
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

PASSED: Continuous integration, rev:873
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-calendar-app-ci/32/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/1342
    SUCCESS: https://jenkins.canonical.com/system-apps/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=default/306
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/1342
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/1205
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial+overlay/1205
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=yakkety/1205
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1185
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1185/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1185
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1185/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1185
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1185/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1185
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1185/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1185
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1185/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1185
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1185/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1185
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1185/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1185
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1185/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1185
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1185/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-calendar-app-ci/32/rebuild

review: Approve (continuous-integration)
Revision history for this message
Arthur Mello (artmello) wrote :

lgtm

review: Approve
Revision history for this message
Jenkins Bot (ubuntu-core-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 'EventRepetition.qml'
2--- EventRepetition.qml 2016-08-05 14:23:25 +0000
3+++ EventRepetition.qml 2016-08-26 19:28:25 +0000
4@@ -129,7 +129,12 @@
5 rule.limit = parseInt(limitCount.text);
6 }
7 else if (limitOptions.selectedIndex === 2 && recurrenceOption.selectedIndex > 0) {
8- rule.limit = datePick.date;
9+ // WORKAROUND: Use UTC format because QML module will convert the date to UTC internally and this
10+ // can cause problems if the date is in different TZ.
11+ // Use this until this get merged: https://codereview.qt-project.org/#/c/154461/
12+ rule.limit = new Date(Date.UTC(datePick.date.getFullYear(),
13+ datePick.date.getMonth(),
14+ datePick.date.getDate()))
15 }
16 else {
17 rule.limit = undefined;
18
19=== modified file 'NewEvent.qml'
20--- NewEvent.qml 2016-08-05 14:23:25 +0000
21+++ NewEvent.qml 2016-08-26 19:28:25 +0000
22@@ -159,14 +159,12 @@
23
24 var index = 0;
25
26- if( e.itemType === Type.Event ) {
27- // Use details method to get attendees list instead of "attendees" property
28- // since a binding issue was returning an empty attendees list for some use cases
29- var attendees = e.details(Detail.EventAttendee);
30- if(attendees){
31- for( var j = 0 ; j < attendees.length ; ++j ) {
32- contactModel.append({"contact": attendees[j]});
33- }
34+ // Use details method to get attendees list instead of "attendees" property
35+ // since a binding issue was returning an empty attendees list for some use cases
36+ var attendees = e.details(Detail.EventAttendee);
37+ if (attendees){
38+ for( var j = 0 ; j < attendees.length ; ++j ) {
39+ contactModel.append({"contact": attendees[j]});
40 }
41 }
42
43@@ -183,6 +181,17 @@
44 selectCalendar(e.collectionId);
45 }
46
47+ function createAttendee(contact)
48+ {
49+ var attendee = Qt.createQmlObject("import QtOrganizer 5.0; EventAttendee { }", Qt.application,"NewEvent.qml")
50+ attendee.attendeeId = contact.attendeeId
51+ attendee.emailAddress = contact.emailAddress
52+ attendee.name = contact.name
53+ attendee.participationRole = EventAttendee.RoleOptionalParticipant
54+ attendee.participationStatus = EventAttendee.StatusUnknown
55+ return attendee
56+ }
57+
58 //Save the new or Existing event
59 function saveToQtPim() {
60 internal.clearFocus()
61@@ -212,15 +221,52 @@
62 event.description = messageEdit.text;
63 event.location = locationEdit.text
64
65- if( event.itemType === Type.Event ) {
66- var newContacts = []
67+ if ([Type.Event, Type.EventOccurrence].indexOf(event.itemType) != -1) {
68+ var oldAttendee = event.details(Detail.EventAttendee)
69+ var newAttendee = []
70 for(var i=0; i < contactModel.count ; ++i) {
71 var contact = contactModel.get(i).contact
72 if (contact) {
73- newContacts.push(internal.attendeeFromData(contact.attendeeId, contact.name, contact.emailAddress));
74- }
75- }
76- event.attendees = newContacts;
77+ newAttendee.push(contact)
78+ }
79+ }
80+
81+ // look for removed contacts
82+ for(var o=0; o < oldAttendee.length; ++o) {
83+ var found = false
84+ var old = oldAttendee[o]
85+ for (var n=0; n < newAttendee.length; ++n) {
86+ var new_ = newAttendee[n]
87+ if (old.attendeeId == new_.attendeeId) {
88+ found = true
89+ break
90+ }
91+ }
92+ if (!found) {
93+ event.removeDetail(old)
94+ }
95+ }
96+
97+ // update list
98+ oldAttendee = event.details(Detail.EventAttendee)
99+
100+ // look for new contacts
101+ for(var n=0; n < newAttendee.length; ++n) {
102+ var found = false
103+ var new_ = newAttendee[n]
104+ for(var o=0; o < oldAttendee.length; ++o) {
105+ var old = oldAttendee[o]
106+ if (old.attendeeId == new_.attendeeId) {
107+ found = true
108+ break;
109+ }
110+ }
111+
112+ if (!found) {
113+ var attendee = createAttendee(contact)
114+ event.setDetail(attendee)
115+ }
116+ }
117 }
118
119 //Set the Rule object to an event

Subscribers

People subscribed via source and target branches

to status/vote changes: