calendarui/editors/src/calenunifiededitorcontrol.cpp
branchRCL_3
changeset 60 96907930389d
parent 59 aba12c885d83
child 67 1539a383d7b6
equal deleted inserted replaced
59:aba12c885d83 60:96907930389d
   193                 TTime entryStartTime = iUnifiedEditor.Edited().StartDateTime();
   193                 TTime entryStartTime = iUnifiedEditor.Edited().StartDateTime();
   194                 TTime entryEndTime = iUnifiedEditor.Edited().EndDateTime();
   194                 TTime entryEndTime = iUnifiedEditor.Edited().EndDateTime();
   195                 
   195                 
   196                 User::LeaveIfError( entryEndTime.MinutesFrom( entryStartTime, duration ) );
   196                 User::LeaveIfError( entryEndTime.MinutesFrom( entryStartTime, duration ) );
   197                 
   197                 
   198                 ReadRrule(firstRDate,rruleEndTime);                                           
   198                 ReadRruleL(firstRDate,rruleEndTime);                                           
   199                 
   199                 
   200                 if( firstRDate <= entryStartTime)
   200                 if( firstRDate <= entryStartTime)
   201                     {                    
   201                     {                    
   202                     SetTimeField( ECalenEditorStartTime, firstRDate, ETrue );
   202                     SetTimeField( ECalenEditorStartTime, firstRDate, ETrue );
   203                     SetTimeField( ECalenEditorEndTime, rruleEndTime, ETrue );                
   203                     SetTimeField( ECalenEditorEndTime, rruleEndTime, ETrue );                
   396     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_ATTACHMENT_ITEM,
   396     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_ATTACHMENT_ITEM,
   397                     ECalenEditorAttachment, ECalenEditorPlace );
   397                     ECalenEditorAttachment, ECalenEditorPlace );
   398 
   398 
   399     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DESCRIPTION_ITEM,
   399     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DESCRIPTION_ITEM,
   400                     ECalenEditorDescription, ECalenEditorAttachment );
   400                     ECalenEditorDescription, ECalenEditorAttachment );
   401     
   401     iUnifiedEditor.UpdateFormL();
   402     TRACE_EXIT_POINT;
   402     TRACE_EXIT_POINT;
   403     }
   403     }
   404 
   404 
   405 // -----------------------------------------------------------------------------
   405 // -----------------------------------------------------------------------------
   406 // CCalenUnifiedEditorControl::AddDefaultMeetingEditorL
   406 // CCalenUnifiedEditorControl::AddDefaultMeetingEditorL
   471     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_ATTACHMENT_ITEM,
   471     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_ATTACHMENT_ITEM,
   472                     ECalenEditorAttachment, ECalenEditorRepeat );
   472                     ECalenEditorAttachment, ECalenEditorRepeat );
   473     
   473     
   474     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DESCRIPTION_ITEM,
   474     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DESCRIPTION_ITEM,
   475                     ECalenEditorDescription, ECalenEditorAttachment );
   475                     ECalenEditorDescription, ECalenEditorAttachment );
   476     
   476     iUnifiedEditor.UpdateFormL();
   477     TRACE_EXIT_POINT;
   477     TRACE_EXIT_POINT;
   478     }
   478     }
   479 
   479 
   480 // -----------------------------------------------------------------------------
   480 // -----------------------------------------------------------------------------
   481 // CCalenUnifiedEditorControl::AddDefaultTodoEditorL
   481 // CCalenUnifiedEditorControl::AddDefaultTodoEditorL
   524     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_ATTACHMENT_ITEM,
   524     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_ATTACHMENT_ITEM,
   525                     ECalenEditorAttachment, ECalenEditorPriority );
   525                     ECalenEditorAttachment, ECalenEditorPriority );
   526     
   526     
   527     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DESCRIPTION_ITEM,
   527     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DESCRIPTION_ITEM,
   528                     ECalenEditorDescription, ECalenEditorAttachment );
   528                     ECalenEditorDescription, ECalenEditorAttachment );
   529     
   529     iUnifiedEditor.UpdateFormL();
   530     TRACE_EXIT_POINT;
   530     TRACE_EXIT_POINT;
   531     }
   531     }
   532 
   532 
   533 // -----------------------------------------------------------------------------
   533 // -----------------------------------------------------------------------------
   534 // CCalenUnifiedEditorControl::SetTimeField
   534 // CCalenUnifiedEditorControl::SetTimeField
   673 // -----------------------------------------------------------------------------
   673 // -----------------------------------------------------------------------------
   674 // CCalenUnifiedEditorControl::SetAllDayEvent
   674 // CCalenUnifiedEditorControl::SetAllDayEvent
   675 // To Set AllDay field value
   675 // To Set AllDay field value
   676 // -----------------------------------------------------------------------------
   676 // -----------------------------------------------------------------------------
   677 //
   677 //
   678 void CCalenUnifiedEditorControl::SetAllDayEvent( TBool aActive )
   678 void CCalenUnifiedEditorControl::SetAllDayEventL( TBool aActive )
   679     {
   679     {
   680     TRACE_ENTRY_POINT;
   680     TRACE_ENTRY_POINT;
   681     
   681     
   682     iAllDayField->SetAllDayEvent( aActive );
   682     iAllDayField->SetAllDayEvent( aActive );
   683     //set defalut alarmtime when allday field is activated/deactivated
   683     //set defalut alarmtime when allday field is activated/deactivated
   856     switch( previousEntryType )
   856     switch( previousEntryType )
   857         {
   857         {
   858         case CCalEntry::EEvent:
   858         case CCalEntry::EEvent:
   859             {
   859             {
   860             // Delete AllDay, StartDate, EndDate, and Place fields
   860             // Delete AllDay, StartDate, EndDate, and Place fields
   861             iUnifiedEditor.DeleteLine( ECalenEditorAllDayItem, ETrue );
   861             iUnifiedEditor.DeleteLine( ECalenEditorAllDayItem, EFalse );
   862             iUnifiedEditor.DeleteLine( ECalenEditorStartDate, ETrue );
   862             iUnifiedEditor.DeleteLine( ECalenEditorStartDate, EFalse );
   863             iUnifiedEditor.DeleteLine( ECalenEditorEndDate, ETrue );
   863             iUnifiedEditor.DeleteLine( ECalenEditorEndDate, EFalse );
   864             iUnifiedEditor.DeleteLine( ECalenEditorPlace, ETrue );
   864             iUnifiedEditor.DeleteLine( ECalenEditorPlace, EFalse );
   865             }
   865             }
   866             break;
   866             break;
   867         case CCalEntry::EAnniv:
   867         case CCalEntry::EAnniv:
   868             {
   868             {
   869             iUnifiedEditor.DeleteLine( ECalenEditorStartDate, ETrue );
   869             iUnifiedEditor.DeleteLine( ECalenEditorStartDate, EFalse );
   870             }
   870             }
   871             break;
   871             break;
   872         case CCalEntry::EAppt:
   872         case CCalEntry::EAppt:
   873             {
   873             {
   874             if( iUnifiedEditor.Edited().IsAllDayEvent() ) 
   874             if( iUnifiedEditor.Edited().IsAllDayEvent() ) 
   875                 {
   875                 {
   876                 // Delete, AllDay event fields from Editor
   876                 // Delete, AllDay event fields from Editor
   877                 iUnifiedEditor.DeleteLine( ECalenEditorAllDayItem, ETrue );
   877                 iUnifiedEditor.DeleteLine( ECalenEditorAllDayItem, EFalse );
   878                 }
   878                 }
   879             else
   879             else
   880                 {
   880                 {
   881                 // Delete, Non-AllDay event fields from Editor
   881                 // Delete, Non-AllDay event fields from Editor
   882                 iUnifiedEditor.DeleteLine( ECalenEditorAllDayItem, ETrue );
   882                 iUnifiedEditor.DeleteLine( ECalenEditorAllDayItem, EFalse );
   883                 iUnifiedEditor.DeleteLine( ECalenEditorStartTime, ETrue );
   883                 iUnifiedEditor.DeleteLine( ECalenEditorStartTime, EFalse );
   884                 iUnifiedEditor.DeleteLine( ECalenEditorEndTime, ETrue );
   884                 iUnifiedEditor.DeleteLine( ECalenEditorEndTime, EFalse );
   885                 }
   885                 }
   886             iUnifiedEditor.DeleteLine( ECalenEditorStartDate, ETrue );
   886             iUnifiedEditor.DeleteLine( ECalenEditorStartDate, EFalse );
   887             iUnifiedEditor.DeleteLine( ECalenEditorEndDate, ETrue );
   887             iUnifiedEditor.DeleteLine( ECalenEditorEndDate, EFalse );
   888             iUnifiedEditor.DeleteLine( ECalenEditorPlace, ETrue );
   888             iUnifiedEditor.DeleteLine( ECalenEditorPlace, EFalse );
   889 				
   889 				
   890 				
   890 				
   891             }
   891             }
   892             break;
   892             break;
   893         case CCalEntry::ETodo:
   893         case CCalEntry::ETodo:
   894             {
   894             {
   895             iUnifiedEditor.DeleteLine( ECalenEditorStartDate, ETrue );
   895             iUnifiedEditor.DeleteLine( ECalenEditorStartDate, EFalse );
   896             iUnifiedEditor.DeleteLine( ECalenEditorPriority, ETrue );
   896             iUnifiedEditor.DeleteLine( ECalenEditorPriority, EFalse );
   897             }
   897             }
   898             break;
   898             break;
   899         default:
   899         default:
   900             break;
   900             break;
   901         }
   901         }
   920         CCoeControl* alarmDateCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorReminderDate );
   920         CCoeControl* alarmDateCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorReminderDate );
   921         CCoeControl* alarmTimeCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorReminderTime );
   921         CCoeControl* alarmTimeCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorReminderTime );
   922                 
   922                 
   923         if( alarmTimeCtrl )
   923         if( alarmTimeCtrl )
   924             {
   924             {
   925             iUnifiedEditor.DeleteLine( ECalenEditorReminderTime, ETrue );
   925             iUnifiedEditor.DeleteLine( ECalenEditorReminderTime, EFalse );
   926             }
   926             }
   927         if( alarmDateCtrl )
   927         if( alarmDateCtrl )
   928             {
   928             {
   929             iUnifiedEditor.DeleteLine( ECalenEditorReminderDate, ETrue );
   929             iUnifiedEditor.DeleteLine( ECalenEditorReminderDate, EFalse );
   930             }
   930             }
   931         }
   931         }
   932 
   932 
   933     iUnifiedEditor.DeleteLine( ECalenEditorReminder );
   933     iUnifiedEditor.DeleteLine( ECalenEditorReminder,EFalse );
   934     
   934     
   935     /*CCoeControl* PeopleFieldCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorPeople );
   935     /*CCoeControl* PeopleFieldCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorPeople );
   936     if( PeopleFieldCtrl )
   936     if( PeopleFieldCtrl )
   937         {
   937         {
   938         iUnifiedEditor.DeleteLine( ECalenEditorPeople );
   938         iUnifiedEditor.DeleteLine( ECalenEditorPeople );
   939         }
   939         }
   940     */
   940     */
   941     CCoeControl* dbNameCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorDBName );
   941     CCoeControl* dbNameCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorDBName );
   942     if( dbNameCtrl )
   942     if( dbNameCtrl )
   943         {
   943         {
   944         iUnifiedEditor.DeleteLine( ECalenEditorDBName );
   944         iUnifiedEditor.DeleteLine( ECalenEditorDBName,EFalse );
   945         }
   945         }
   946     // TODO: Uncomment this when enabling attachment support
   946     // TODO: Uncomment this when enabling attachment support
   947     iUnifiedEditor.DeleteLine( ECalenEditorAttachment );
   947     iUnifiedEditor.DeleteLine( ECalenEditorAttachment,EFalse );
   948     
   948     
   949     iUnifiedEditor.DeleteLine( ECalenEditorDescription );
   949     iUnifiedEditor.DeleteLine( ECalenEditorDescription,EFalse );
   950     
   950     
   951     // To-Do do not have place field
   951     // To-Do do not have place field
   952     CCoeControl* editorPlaceCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorPlace );
   952     CCoeControl* editorPlaceCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorPlace );
   953     if( editorPlaceCtrl )
   953     if( editorPlaceCtrl )
   954         {
   954         {
   955         iUnifiedEditor.DeleteLine( ECalenEditorPlace );
   955         iUnifiedEditor.DeleteLine( ECalenEditorPlace,EFalse );
   956         }
   956         }
   957     
   957     
   958     // Anniversary & To-Do entry, do not have Repeat field
   958     // Anniversary & To-Do entry, do not have Repeat field
   959     if( ( aPreviousEntryType != CCalEntry::EAnniv ) ||
   959     if( ( aPreviousEntryType != CCalEntry::EAnniv ) ||
   960             ( aPreviousEntryType != CCalEntry::ETodo ) )
   960             ( aPreviousEntryType != CCalEntry::ETodo ) )
   962         // Delete Repeat field.
   962         // Delete Repeat field.
   963         CCoeControl* repeatCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorRepeat );
   963         CCoeControl* repeatCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorRepeat );
   964         CCoeControl* repeatUntilCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorRepeatUntil );
   964         CCoeControl* repeatUntilCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorRepeatUntil );
   965         if( repeatCtrl )
   965         if( repeatCtrl )
   966             {
   966             {
   967             iUnifiedEditor.DeleteLine( ECalenEditorRepeat );
   967             iUnifiedEditor.DeleteLine( ECalenEditorRepeat,EFalse );
   968             }
   968             }
   969         if( repeatUntilCtrl )
   969         if( repeatUntilCtrl )
   970             {
   970             {
   971             iUnifiedEditor.DeleteLine( ECalenEditorRepeatUntil );
   971             iUnifiedEditor.DeleteLine( ECalenEditorRepeatUntil,EFalse );
   972             }
   972             }
   973         }
   973         }
   974     }
   974     }
   975 
   975 
   976 // -----------------------------------------------------------------------------
   976 // -----------------------------------------------------------------------------
  1458     TRACE_EXIT_POINT;
  1458     TRACE_EXIT_POINT;
  1459     
  1459     
  1460     return iDbField->GetCalendarNameForEntryL();
  1460     return iDbField->GetCalendarNameForEntryL();
  1461     }
  1461     }
  1462 
  1462 
       
  1463 TInt CCalenUnifiedEditorControl::GetCalendarNameForEntryL(const TDesC& aCalendarFileName)
       
  1464     {
       
  1465     TRACE_ENTRY_POINT;
       
  1466     TRACE_EXIT_POINT;
       
  1467     
       
  1468     return iDbField->GetCalendarNameForEntryL(aCalendarFileName);
       
  1469     }
       
  1470 
  1463 // -----------------------------------------------------------------------------
  1471 // -----------------------------------------------------------------------------
  1464 // CCalenUnifiedEditorControl::UpdateMeetingDurationL()
  1472 // CCalenUnifiedEditorControl::UpdateMeetingDurationL()
  1465 // This function leaves if the end date/time is before the start date/time.
  1473 // This function leaves if the end date/time is before the start date/time.
  1466 // (other items were commented in a header).
  1474 // (other items were commented in a header).
  1467 // -----------------------------------------------------------------------------
  1475 // -----------------------------------------------------------------------------
  1523 // CCalenUnifiedEditorControl::ReadRrule()
  1531 // CCalenUnifiedEditorControl::ReadRrule()
  1524 // Checks the Rdates and RRule if there is any with the CCalEntry
  1532 // Checks the Rdates and RRule if there is any with the CCalEntry
  1525 // (other items were commented in a header).
  1533 // (other items were commented in a header).
  1526 // -----------------------------------------------------------------------------
  1534 // -----------------------------------------------------------------------------
  1527 //
  1535 //
  1528 void CCalenUnifiedEditorControl::ReadRrule(TTime& firstRdatestartTime, TTime& endTime)
  1536 void CCalenUnifiedEditorControl::ReadRruleL(TTime& firstRdatestartTime, TTime& endTime)
  1529     {   
  1537     {   
  1530     TRACE_ENTRY_POINT;
  1538     TRACE_ENTRY_POINT;
  1531     
  1539     
  1532     RArray<TCalTime> rDateList;
  1540     RArray<TCalTime> rDateList;
  1533     CleanupClosePushL( rDateList );    
  1541     CleanupClosePushL( rDateList );