← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~renatofilho/ubuntu-calendar-app/fix-1438910 into lp:ubuntu-calendar-app

 

Renato Araujo Oliveira Filho has proposed merging lp:~renatofilho/ubuntu-calendar-app/fix-1438910 into lp:ubuntu-calendar-app.

Commit message:
Set event as parent for RecurrenceRule to avoid it to be destroyed before the event.

Requested reviews:
  Ubuntu Calendar Developers (ubuntu-calendar-dev)
Related bugs:
  Bug #1438910 in Ubuntu Calendar App: "unable to set event as yearly or monthly"
  https://bugs.launchpad.net/ubuntu-calendar-app/+bug/1438910

For more details, see:
https://code.launchpad.net/~renatofilho/ubuntu-calendar-app/fix-1438910/+merge/290655
-- 
Your team Ubuntu Calendar Developers is requested to review the proposed merge of lp:~renatofilho/ubuntu-calendar-app/fix-1438910 into lp:ubuntu-calendar-app.
=== modified file 'EventRepetition.qml'
--- EventRepetition.qml	2016-03-22 20:09:08 +0000
+++ EventRepetition.qml	2016-03-31 20:55:39 +0000
@@ -100,7 +100,7 @@
 
             if (recurrenceRule !== RecurrenceRule.Invalid) {
                 if (eventRoot.rule === null || eventRoot.rule === undefined ){
-                    eventRoot.rule = Qt.createQmlObject("import QtOrganizer 5.0; RecurrenceRule {}", eventRoot.event.recurrence,"EventRepetition.qml");
+                    eventRoot.rule = Qt.createQmlObject("import QtOrganizer 5.0; RecurrenceRule {}", eventRoot.event,"EventRepetition.qml");
                 }
 
                 var rule = eventRoot.rule;
@@ -114,7 +114,6 @@
                     rule.daysOfWeek = eventUtils.getDaysOfWeek(recurrenceOption.selectedIndex, weekDays );
                     break;
                 case 6: //monthly
-                    rule.daysOfMonth = [eventRoot.startDate.getDate()];
                     break;
                 case 7: //yearly
                     break;

=== modified file 'NewEvent.qml'
--- NewEvent.qml	2016-03-28 20:56:13 +0000
+++ NewEvent.qml	2016-03-31 20:55:39 +0000
@@ -219,6 +219,11 @@
             var isOcurrence = ((event.itemType === Type.EventOccurrence) || (event.itemType === Type.TodoOccurrence))
             if (!isOcurrence) {
                 if(rule !== null && rule !== undefined) {
+                    // update monthly rule with final event day
+                    // we need to do it here to make sure that the day is the same day as the event startDate
+                    if (rule.frequency === RecurrenceRule.Monthly) {
+                        rule.daysOfMonth = [event.startDateTime.getDate()]
+                    }
                     event.recurrence.recurrenceRules = [rule]
                 } else {
                     event.recurrence.recurrenceRules = [];
@@ -230,7 +235,7 @@
             var reminder = event.detail(Detail.AudibleReminder);
             if (root.reminderValue >= 0) {
                 if (!reminder) {
-                    reminder = Qt.createQmlObject("import QtOrganizer 5.0; AudibleReminder {}", root, "")
+                    reminder = Qt.createQmlObject("import QtOrganizer 5.0; AudibleReminder {}", event, "")
                     reminder.repetitionCount = 0
                     reminder.repetitionDelay = 0
                 }
@@ -241,7 +246,6 @@
             }
 
             event.collectionId = calendarsOption.model[calendarsOption.selectedIndex].collectionId;
-            model.setDefaultCollection(event.collectionId);
 
             var comment = event.detail(Detail.Comment);
             if(comment && comment.comment === "X-CAL-DEFAULT-EVENT") {
@@ -249,9 +253,9 @@
             }
 
             model.saveItem(event)
+            root.eventAdded(event);
             if (pageStack)
                 pageStack.pop();
-            root.eventAdded(event);
         }
     }
 


References