← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~mihirsoni/ubuntu-calendar-app/1466667 into lp:ubuntu-calendar-app

 

Mihir Soni has proposed merging lp:~mihirsoni/ubuntu-calendar-app/1466667 into lp:ubuntu-calendar-app.

Commit message:
Fixed bug #1466667

Requested reviews:
  Ubuntu Calendar Developers (ubuntu-calendar-dev)
Related bugs:
  Bug #1466667 in Ubuntu Calendar App: "Changing start date and time resets end date and time"
  https://bugs.launchpad.net/ubuntu-calendar-app/+bug/1466667

For more details, see:
https://code.launchpad.net/~mihirsoni/ubuntu-calendar-app/1466667/+merge/262763

Fixed bug #1466667
-- 
Your team Ubuntu Calendar Developers is requested to review the proposed merge of lp:~mihirsoni/ubuntu-calendar-app/1466667 into lp:ubuntu-calendar-app.
=== modified file 'NewEvent.qml'
--- NewEvent.qml	2015-06-19 13:05:13 +0000
+++ NewEvent.qml	2015-06-23 17:04:44 +0000
@@ -38,6 +38,7 @@
 
     property var startDate;
     property var endDate;
+    property var eventDuration;
 
     property alias scrollY: flickable.contentY
     property bool isEdit: false
@@ -127,6 +128,7 @@
         }
         startDate =new Date(e.startDateTime);
         endDate = new Date(e.endDateTime);
+        eventDuration = endDate - startDate;
 
         if(e.displayLabel) {
             titleEdit.text = e.displayLabel;
@@ -273,8 +275,8 @@
     }
 
     function adjustEndDateToStartDate() {
-        // set time forward to one hour
-        var time_forward = 3600000;
+        // set time forward to the event duration , if event is new then forward it to one hour
+        var time_forward = eventDuration ? eventDuration : 3600000;
         endDate = new Date( startDate.getTime() + time_forward );
     }
 
@@ -369,6 +371,7 @@
                 }
                 onDateTimeChanged: {
                     startDate = dateTime;
+                    eventDuration =  endDate - startDate;
                 }
             }
 
@@ -382,6 +385,7 @@
                 }
                 onDateTimeChanged: {
                     endDate = dateTime;
+                    eventDuration = endDate-startDate
                 }
             }
 


References