calendarui/editors/src/calenunifiededitorcontrol.cpp
branchRCL_3
changeset 14 21239b3bcd78
parent 5 42814f902fe6
child 16 55d60436f00b
equal deleted inserted replaced
13:1984aceb8774 14:21239b3bcd78
   235             && CCalEntry::ETodo != iUnifiedEditor.GetEntryType() )
   235             && CCalEntry::ETodo != iUnifiedEditor.GetEntryType() )
   236         {
   236         {
   237         iRepeatField->SetDataToEditorL();
   237         iRepeatField->SetDataToEditorL();
   238         }
   238         }
   239     
   239     
   240     iDbField->SetDataToEditorL();
   240     if(!iDbField->IsCalendarEdited())
       
   241         {
       
   242         iDbField->SetDataToEditorL();
       
   243         }
   241 
   244 
   242     if( CCalEntry::ETodo != iUnifiedEditor.GetEntryType() )
   245     if( CCalEntry::ETodo != iUnifiedEditor.GetEntryType() )
   243         {
   246         {
   244         TPtrC location = iUnifiedEditor.Edited().Location().Left(
   247         TPtrC location = iUnifiedEditor.Edited().Location().Left(
   245                             iUnifiedEditor.MaxTextEditorLength() );
   248                             iUnifiedEditor.MaxTextEditorLength() );
  1094         {
  1097         {
  1095         // To set time as beginning of the day
  1098         // To set time as beginning of the day
  1096         result = CalenDateUtils::BeginningOfDay( result );
  1099         result = CalenDateUtils::BeginningOfDay( result );
  1097         }
  1100         }
  1098     
  1101     
       
  1102     if( iAllDayField->IsAllDayEvent() )
       
  1103         {
       
  1104         TTime endDate = iUnifiedEditor.Edited().EndDateTime();
       
  1105         endDate = CalenDateUtils::BeginningOfDay( endDate );
       
  1106         iUnifiedEditor.Edited().SetEndDateTimeL(endDate);
       
  1107         }
       
  1108     
  1099     resDT = result.DateTime();
  1109     resDT = result.DateTime();
  1100     TRACE_EXIT_POINT;
  1110     TRACE_EXIT_POINT;
  1101     return result;
  1111     return result;
  1102     }
  1112     }
  1103 
  1113 
  1137             {
  1147             {
  1138             // For allday (1 day) event Eg. "Start:- 12:00am, 15-08-2010 &  End:-12:00am, 16-08-2010"
  1148             // For allday (1 day) event Eg. "Start:- 12:00am, 15-08-2010 &  End:-12:00am, 16-08-2010"
  1139             // In Editor it should be displayed as "StartDate: 15-08-2010 & EndDate:15-08-2010" 
  1149             // In Editor it should be displayed as "StartDate: 15-08-2010 & EndDate:15-08-2010" 
  1140             // But, while saving EndDate is saved as 12:00am, 16-08-2010. 
  1150             // But, while saving EndDate is saved as 12:00am, 16-08-2010. 
  1141             TTime startDate = iUnifiedEditor.Edited().StartDateTime();
  1151             TTime startDate = iUnifiedEditor.Edited().StartDateTime();
       
  1152             startDate = CalenDateUtils::BeginningOfDay( startDate );
       
  1153             iUnifiedEditor.Edited().SetStartDateTimeL(startDate);
  1142             if( result >= startDate )
  1154             if( result >= startDate )
  1143                 {
  1155                 {
  1144                 result += TTimeIntervalDays( KOneDay );
  1156                 result += TTimeIntervalDays( KOneDay );
  1145                 }
  1157                 }
  1146             }
  1158             }
  1415             CCalEntry::EEvent == iUnifiedEditor.Edited().EntryType() )
  1427             CCalEntry::EEvent == iUnifiedEditor.Edited().EntryType() )
  1416         {
  1428         {
  1417         // For allday (1 day) event Eg. "Start:- 12:00am, 15-08-2010 &  End:-12:00am, 16-08-2010"
  1429         // For allday (1 day) event Eg. "Start:- 12:00am, 15-08-2010 &  End:-12:00am, 16-08-2010"
  1418         // In Editor it should be displayed as "StartDate: 15-08-2010 & EndDate:15-08-2010" 
  1430         // In Editor it should be displayed as "StartDate: 15-08-2010 & EndDate:15-08-2010" 
  1419         // No time filed is displayed.
  1431         // No time filed is displayed.
  1420         if ( end > start )                         
  1432         end -= TTimeIntervalDays( KOneDay );
  1421             {
  1433         if ( end < start )                         
  1422             //end -= TTimeIntervalDays( KOneDay );
  1434             {
  1423             //end contains the time component also, even for same day end would be greater then start
       
  1424             //subtracting 1 from end will give end as one day before start.
       
  1425             //For All day event Start date and End Date are same so assigning start to end.
       
  1426             end = start;
  1435             end = start;
  1427             }
       
  1428         else if( end == start )
       
  1429             {
       
  1430             // For allday event minimum duration is 1day.
       
  1431             TTime endDate = start + TTimeIntervalDays( KOneDay );
       
  1432             iUnifiedEditor.Edited().SetEndDateTimeL( endDate );
       
  1433             }
  1436             }
  1434         }
  1437         }
  1435     
  1438     
  1436     SetDateField( ECalenEditorEndDate, end, ETrue );
  1439     SetDateField( ECalenEditorEndDate, end, ETrue );
  1437     SetTimeField( ECalenEditorEndTime, end, ETrue );
  1440     SetTimeField( ECalenEditorEndTime, end, ETrue );