ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #09804
[Merge] lp:~renatofilho/ubuntu-calendar-app/fix-1616029 into lp:ubuntu-calendar-app
Renato Araujo Oliveira Filho has proposed merging lp:~renatofilho/ubuntu-calendar-app/fix-1616029 into lp:ubuntu-calendar-app.
Commit message:
Fix event save with attendee.
Make sure that Attendee get save after edit an event.
Requested reviews:
Ubuntu Calendar Developers (ubuntu-calendar-dev)
Related bugs:
Bug #1616029 in Ubuntu Calendar App: "Adding contacts not working for a single instance of an event series"
https://bugs.launchpad.net/ubuntu-calendar-app/+bug/1616029
For more details, see:
https://code.launchpad.net/~renatofilho/ubuntu-calendar-app/fix-1616029/+merge/303836
--
Your team Ubuntu Calendar Developers is requested to review the proposed merge of lp:~renatofilho/ubuntu-calendar-app/fix-1616029 into lp:ubuntu-calendar-app.
=== modified file 'NewEvent.qml'
--- NewEvent.qml 2016-08-05 14:23:25 +0000
+++ NewEvent.qml 2016-08-24 15:41:17 +0000
@@ -159,14 +159,12 @@
var index = 0;
- if( e.itemType === Type.Event ) {
- // Use details method to get attendees list instead of "attendees" property
- // since a binding issue was returning an empty attendees list for some use cases
- var attendees = e.details(Detail.EventAttendee);
- if(attendees){
- for( var j = 0 ; j < attendees.length ; ++j ) {
- contactModel.append({"contact": attendees[j]});
- }
+ // Use details method to get attendees list instead of "attendees" property
+ // since a binding issue was returning an empty attendees list for some use cases
+ var attendees = e.details(Detail.EventAttendee);
+ if (attendees){
+ for( var j = 0 ; j < attendees.length ; ++j ) {
+ contactModel.append({"contact": attendees[j]});
}
}
@@ -183,6 +181,17 @@
selectCalendar(e.collectionId);
}
+ function createAttendee(contact)
+ {
+ var attendee = Qt.createQmlObject("import QtOrganizer 5.0; EventAttendee { }", Qt.application,"NewEvent.qml")
+ attendee.attendeeId = contact.attendeeId
+ attendee.emailAddress = contact.emailAddress
+ attendee.name = contact.name
+ attendee.participationRole = EventAttendee.RoleOptionalParticipant
+ attendee.participationStatus = EventAttendee.StatusUnknown
+ return attendee
+ }
+
//Save the new or Existing event
function saveToQtPim() {
internal.clearFocus()
@@ -212,15 +221,27 @@
event.description = messageEdit.text;
event.location = locationEdit.text
- if( event.itemType === Type.Event ) {
+ if ([Type.Event, Type.EventOccurrence].indexOf(event.itemType) != -1) {
+ var oldAttendee = event.details(Detail.EventAttendee)
var newContacts = []
for(var i=0; i < contactModel.count ; ++i) {
var contact = contactModel.get(i).contact
if (contact) {
- newContacts.push(internal.attendeeFromData(contact.attendeeId, contact.name, contact.emailAddress));
+ var found = false
+ for(var a=0; a < oldAttendee.length; ++a) {
+ var attendee = oldAttendee[a]
+ if (attendee.attendeeId == contact.attendeeId) {
+ found = true
+ break;
+ }
+ }
+
+ if (!found) {
+ var attendee = createAttendee(contact)
+ event.setDetail(attendee)
+ }
}
}
- event.attendees = newContacts;
}
//Set the Rule object to an event
References