calendarui/editors/src/calenunifiededitorcontrol.cpp
branchRCL_3
changeset 14 21239b3bcd78
parent 5 42814f902fe6
child 16 55d60436f00b
--- a/calendarui/editors/src/calenunifiededitorcontrol.cpp	Wed Mar 31 21:29:10 2010 +0300
+++ b/calendarui/editors/src/calenunifiededitorcontrol.cpp	Wed Apr 14 15:55:57 2010 +0300
@@ -237,7 +237,10 @@
         iRepeatField->SetDataToEditorL();
         }
     
-    iDbField->SetDataToEditorL();
+    if(!iDbField->IsCalendarEdited())
+        {
+        iDbField->SetDataToEditorL();
+        }
 
     if( CCalEntry::ETodo != iUnifiedEditor.GetEntryType() )
         {
@@ -1096,6 +1099,13 @@
         result = CalenDateUtils::BeginningOfDay( result );
         }
     
+    if( iAllDayField->IsAllDayEvent() )
+        {
+        TTime endDate = iUnifiedEditor.Edited().EndDateTime();
+        endDate = CalenDateUtils::BeginningOfDay( endDate );
+        iUnifiedEditor.Edited().SetEndDateTimeL(endDate);
+        }
+    
     resDT = result.DateTime();
     TRACE_EXIT_POINT;
     return result;
@@ -1139,6 +1149,8 @@
             // In Editor it should be displayed as "StartDate: 15-08-2010 & EndDate:15-08-2010" 
             // But, while saving EndDate is saved as 12:00am, 16-08-2010. 
             TTime startDate = iUnifiedEditor.Edited().StartDateTime();
+            startDate = CalenDateUtils::BeginningOfDay( startDate );
+            iUnifiedEditor.Edited().SetStartDateTimeL(startDate);
             if( result >= startDate )
                 {
                 result += TTimeIntervalDays( KOneDay );
@@ -1417,20 +1429,11 @@
         // For allday (1 day) event Eg. "Start:- 12:00am, 15-08-2010 &  End:-12:00am, 16-08-2010"
         // In Editor it should be displayed as "StartDate: 15-08-2010 & EndDate:15-08-2010" 
         // No time filed is displayed.
-        if ( end > start )                         
+        end -= TTimeIntervalDays( KOneDay );
+        if ( end < start )                         
             {
-            //end -= TTimeIntervalDays( KOneDay );
-            //end contains the time component also, even for same day end would be greater then start
-            //subtracting 1 from end will give end as one day before start.
-            //For All day event Start date and End Date are same so assigning start to end.
             end = start;
             }
-        else if( end == start )
-            {
-            // For allday event minimum duration is 1day.
-            TTime endDate = start + TTimeIntervalDays( KOneDay );
-            iUnifiedEditor.Edited().SetEndDateTimeL( endDate );
-            }
         }
     
     SetDateField( ECalenEditorEndDate, end, ETrue );