calendarui/editors/src/calenunifiededitorcontrol.cpp
branchRCL_3
changeset 86 ed599363c2d7
parent 74 97232defd20e
equal deleted inserted replaced
78:356f28cd5ca0 86:ed599363c2d7
    22 #include <e32des16.h>
    22 #include <e32des16.h>
    23 #include <calentry.h>
    23 #include <calentry.h>
    24 #include <CalenDefaultEditorsData.rsg>
    24 #include <CalenDefaultEditorsData.rsg>
    25 #include <calendateutils.h>
    25 #include <calendateutils.h>
    26 #include <calenservices.h>
    26 #include <calenservices.h>
    27 #include <featmgr.h>
    27 
    28 // user includes
    28 // user includes
    29 #include "calenunifiededitorcontrol.h"
    29 #include "calenunifiededitorcontrol.h"
    30 #include "calenunifiededitor.h"
    30 #include "calenunifiededitor.h"
    31 #include "CalenDefaultEditors.hrh"
    31 #include "CalenDefaultEditors.hrh"
    32 #include "calenentryutil.h"
    32 #include "calenentryutil.h"
    35 #include "calenrepeatfield.h"
    35 #include "calenrepeatfield.h"
    36 #include "calenalldayfield.h"
    36 #include "calenalldayfield.h"
    37 #include "calenpriorityfield.h"
    37 #include "calenpriorityfield.h"
    38 #include "calendbfield.h"
    38 #include "calendbfield.h"
    39 #include "CalenDescription.h"
    39 #include "CalenDescription.h"
    40 #include "KoreanLunarDateEditor.h"
       
    41 #include "KoreanLunarTypeField.h"
       
    42 
       
    43 
    40 
    44 // debug
    41 // debug
    45 #include "calendarui_debug.h"
    42 #include "calendarui_debug.h"
    46 
    43 
    47 // Constants
    44 // Constants
    82     delete iAllDayField;
    79     delete iAllDayField;
    83     delete iPriorityField;
    80     delete iPriorityField;
    84     delete iDbField;
    81     delete iDbField;
    85     delete iDescription;
    82     delete iDescription;
    86     
    83     
    87     if( iKoreanLunarTypeField )
       
    88         {
       
    89         delete iKoreanLunarTypeField;
       
    90         }
       
    91         
       
    92     // Do not call UnInitializeLib() if InitalizeLib() leaves.
       
    93     if ( iFeatMgrInitialized )
       
    94         {
       
    95         // Frees the TLS. Must be done after FeatureManager is used.
       
    96         FeatureManager::UnInitializeLib();  
       
    97         }  
       
    98     
       
    99     TRACE_EXIT_POINT;
    84     TRACE_EXIT_POINT;
   100     }
    85     }
   101 
    86 
   102 // -----------------------------------------------------------------------------
    87 // -----------------------------------------------------------------------------
   103 // CCalenUnifiedEditorControl::ConstructL
    88 // CCalenUnifiedEditorControl::ConstructL
   113     iRepeatField = CCalenRepeatField::NewL( iUnifiedEditor );
    98     iRepeatField = CCalenRepeatField::NewL( iUnifiedEditor );
   114     iAllDayField = CCalenAllDayField::NewL( iUnifiedEditor );
    99     iAllDayField = CCalenAllDayField::NewL( iUnifiedEditor );
   115     iPriorityField = CCalenPriorityField::NewL( iUnifiedEditor );
   100     iPriorityField = CCalenPriorityField::NewL( iUnifiedEditor );
   116     iDbField = CCalenDbField::NewL( iUnifiedEditor,aServices );
   101     iDbField = CCalenDbField::NewL( iUnifiedEditor,aServices );
   117     iDescription = CCalenDescription::NewL( iUnifiedEditor );
   102     iDescription = CCalenDescription::NewL( iUnifiedEditor );
   118     
       
   119     // Sets up TLS, must be done before FeatureManager is used.
       
   120     FeatureManager::InitializeLibL();
       
   121     // Used in destructor. 
       
   122     iFeatMgrInitialized = ETrue;
       
   123     
       
   124 	if( FeatureManager::FeatureSupported( KFeatureIdKorean ) )
       
   125         {
       
   126         iKoreanLunarTypeField =  CKoreanLunarTypeField::NewL( iUnifiedEditor );
       
   127         }   
       
   128     
   103     
   129     TRACE_EXIT_POINT;    
   104     TRACE_EXIT_POINT;    
   130     }
   105     }
   131 
   106 
   132 // -----------------------------------------------------------------------------
   107 // -----------------------------------------------------------------------------
   218                 TTime entryStartTime = iUnifiedEditor.Edited().StartDateTime();
   193                 TTime entryStartTime = iUnifiedEditor.Edited().StartDateTime();
   219                 TTime entryEndTime = iUnifiedEditor.Edited().EndDateTime();
   194                 TTime entryEndTime = iUnifiedEditor.Edited().EndDateTime();
   220                 
   195                 
   221                 User::LeaveIfError( entryEndTime.MinutesFrom( entryStartTime, duration ) );
   196                 User::LeaveIfError( entryEndTime.MinutesFrom( entryStartTime, duration ) );
   222                 
   197                 
   223                 ReadRruleL(firstRDate,rruleEndTime);                                           
   198                 ReadRrule(firstRDate,rruleEndTime);                                           
   224                 
   199                 
   225                 if( firstRDate <= entryStartTime)
   200                 if( firstRDate <= entryStartTime)
   226                     {                    
   201                     {                    
   227                     SetTimeField( ECalenEditorStartTime, firstRDate, ETrue );
   202                     SetTimeField( ECalenEditorStartTime, firstRDate, ETrue );
   228                     SetTimeField( ECalenEditorEndTime, rruleEndTime, ETrue );                
   203                     SetTimeField( ECalenEditorEndTime, rruleEndTime, ETrue );                
   365       {
   340       {
   366         iDbField->InitDbFieldLayoutL();
   341         iDbField->InitDbFieldLayoutL();
   367       }
   342       }
   368     CleanupStack::PopAndDestroy( &calendarInfoList );
   343     CleanupStack::PopAndDestroy( &calendarInfoList );
   369     
   344     
   370     
       
   371     if( CCalEntry::EAnniv == iUnifiedEditor.GetEntryType() 
       
   372 	     && FeatureManager::FeatureSupported( KFeatureIdKorean ) )
       
   373         {
       
   374         iKoreanLunarTypeField->PreLayoutDynInitL();
       
   375         }
       
   376 
       
   377     iDescription->InitDescritpionFieldLayoutL();
   345     iDescription->InitDescritpionFieldLayoutL();
   378     
   346     
   379     TRACE_EXIT_POINT;
   347     TRACE_EXIT_POINT;
   380     }
   348     }
   381 
   349 
   386 //
   354 //
   387 void CCalenUnifiedEditorControl::AddDefaultBirthDayEditorL()
   355 void CCalenUnifiedEditorControl::AddDefaultBirthDayEditorL()
   388     {
   356     {
   389     TRACE_ENTRY_POINT;
   357     TRACE_ENTRY_POINT;
   390     // event type, subject, date & year,more details
   358     // event type, subject, date & year,more details
   391 
   359     
   392      TInt prevItem = 0;
   360     RPointerArray<CCalCalendarInfo> calendarInfoList; 
   393      prevItem=ECalenEditorSubject;
   361     iUnifiedEditor.GetServices().GetAllCalendarInfoL(calendarInfoList);
   394     
   362     CleanupClosePushL( calendarInfoList );
   395      if(FeatureManager::FeatureSupported( KFeatureIdKorean ))
   363 
   396     	 {
   364     if( calendarInfoList.Count() > 1 )
   397     	 iUnifiedEditor.InsertFieldL( R_KOREAN_LUNAR_NOTEVIEW_TYPE_LINE,
   365         {
   398     	 EKoreanLunarTypeSelectSolarLunarLeap, ECalenEditorSubject );
   366         iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DB_NAME_ITEM,
   399     	 prevItem=EKoreanLunarTypeSelectSolarLunarLeap;   	 
   367             ECalenEditorDBName, ECalenEditorSubject );
   400     	 }
   368 
   401     	 
   369         iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_DATE_ITEM, 
   402      TLunarCalendarType type =  iUnifiedEditor.Edited().CalendarType();
   370             ECalenEditorStartDate, ECalenEditorDBName );
   403      
   371         }
   404      if( type != ESolar && FeatureManager::FeatureSupported( KFeatureIdKorean ))
       
   405     	{
       
   406     	iUnifiedEditor.InsertFieldL( R_KOREAN_LUNAR_DATE_EDITOR_LINE,
       
   407     								 EKoreanLunarAniversityStart, prevItem );
       
   408     	prevItem=EKoreanLunarAniversityStart;
       
   409     		
       
   410         TTime birthDayYear = iUnifiedEditor.Edited().EventDateTime();
       
   411         SetDateField( ECalenEditorStartDate, birthDayYear, ETrue );
       
   412     	}
       
   413     else
   372     else
   414     	{
   373         {
   415     	 RPointerArray<CCalCalendarInfo> calendarInfoList; 
   374         iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_DATE_ITEM, 
   416     	 iUnifiedEditor.GetServices().GetAllCalendarInfoL(calendarInfoList);
   375             ECalenEditorStartDate, ECalenEditorSubject );
   417     	 CleanupClosePushL( calendarInfoList );
   376         }
   418 
   377 
   419     	 if( calendarInfoList.Count() > 1 )
   378     CleanupStack::PopAndDestroy( &calendarInfoList );
   420     	 	{
   379     
   421     	    iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DB_NAME_ITEM,
   380     // "Start Date" Label should be "Date of Birth" for Birthday
   422     	             					 ECalenEditorDBName, prevItem );
   381     iUnifiedEditor.SetControlCaptionL( ECalenEditorStartDate,
   423     	    prevItem = ECalenEditorDBName;
   382                     R_QTN_CALEN_EDITOR_DATE_OF_BIRTH );
   424     	    iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_DATE_ITEM, 
   383 
   425     	             					 ECalenEditorStartDate, prevItem );
   384     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_REMINDER_ITEM,
   426     	    prevItem=ECalenEditorStartDate;
   385                     ECalenEditorReminder, ECalenEditorStartDate );
   427     	    }
       
   428     	 else
       
   429     	    {
       
   430     	    iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_DATE_ITEM, 
       
   431     	             					 ECalenEditorStartDate, prevItem );
       
   432     	    prevItem = ECalenEditorStartDate;
       
   433     	    }
       
   434 
       
   435     	 CleanupStack::PopAndDestroy( &calendarInfoList );
       
   436     	     
       
   437     	 // "Start Date" Label should be "Date of Birth" for Birthday
       
   438     	 iUnifiedEditor.SetControlCaptionL( ECalenEditorStartDate,
       
   439     	                     				R_QTN_CALEN_EDITOR_DATE_OF_BIRTH );
       
   440     	 }
       
   441     	
       
   442 
       
   443      iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_REMINDER_ITEM,
       
   444                     ECalenEditorReminder, prevItem );
       
   445 
       
   446 
   386 
   447     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_PLACE_ITEM,
   387     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_PLACE_ITEM,
   448                     ECalenEditorPlace, ECalenEditorReminder );
   388                     ECalenEditorPlace, ECalenEditorReminder );
       
   389 /*    iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_PEOPLE_ITEM,
       
   390                     ECalenEditorPeople, ECalenEditorPlace );
       
   391 */   /* iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DB_NAME_ITEM,
       
   392                     ECalenEditorDBName, ECalenEditorPlace );*/
   449 
   393 
   450     // TODO: Uncomment this when enabling attachment support
   394     // TODO: Uncomment this when enabling attachment support
   451     // Replace ECalenEditorDBName with ECalenEditorAttachment in the next statement
   395     // Replace ECalenEditorDBName with ECalenEditorAttachment in the next statement
   452     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_ATTACHMENT_ITEM,
   396     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_ATTACHMENT_ITEM,
   453                     ECalenEditorAttachment, ECalenEditorPlace );
   397                     ECalenEditorAttachment, ECalenEditorPlace );
   618 void CCalenUnifiedEditorControl::SetDateField( TInt aControlId, const TTime& aTime,
   562 void CCalenUnifiedEditorControl::SetDateField( TInt aControlId, const TTime& aTime,
   619                                               TBool aDoDraw )
   563                                               TBool aDoDraw )
   620     {
   564     {
   621     TRACE_ENTRY_POINT;
   565     TRACE_ENTRY_POINT;
   622 
   566 
   623     TBool useLunarDate = EFalse;
   567     CEikDateEditor* dateField = NULL;
   624     if(aControlId == ECalenEditorStartDate 
   568     dateField = static_cast<CEikDateEditor*>( iUnifiedEditor.ControlOrNull( aControlId ) );
   625 	  && FeatureManager::FeatureSupported( KFeatureIdKorean ))
   569     if( dateField )
   626        	{
   570         {
   627         if( CCalEntry::EAnniv == iUnifiedEditor.GetEntryType() )
   571         dateField->SetDate( aTime );
   628         	{
   572         if( aDoDraw )
   629         	TLunarCalendarType type =  iUnifiedEditor.Edited().CalendarType();
   573             {
   630         	if( type != ESolar )
   574             dateField->DrawDeferred();
   631         		{
   575             }
   632         		useLunarDate = ETrue;
   576         }
   633         		}
   577 
   634         	}
       
   635        	}
       
   636     
       
   637     if(useLunarDate || aControlId == EKoreanLunarAniversityStart 
       
   638 	    && FeatureManager::FeatureSupported( KFeatureIdKorean ) )
       
   639     	{
       
   640     	CKoreanLunarDateEditor* dateField = NULL;
       
   641     	    dateField = static_cast<CKoreanLunarDateEditor*>( iUnifiedEditor.ControlOrNull( EKoreanLunarAniversityStart ) );
       
   642     	    if( dateField )
       
   643     	        {
       
   644     	        dateField->SetDate(aTime, EFalse);
       
   645     	        }
       
   646     	    if ( aDoDraw )
       
   647 			{
       
   648 			dateField->DrawDeferred();
       
   649 			}
       
   650     	}
       
   651     else
       
   652         {
       
   653     	CEikDateEditor* dateField = NULL;
       
   654     	dateField = static_cast<CEikDateEditor*>( iUnifiedEditor.ControlOrNull( aControlId ) );
       
   655     	if( dateField )
       
   656     	    {
       
   657     	    dateField->SetDate( aTime );
       
   658     	    if( aDoDraw )
       
   659     	        {
       
   660     	        dateField->DrawDeferred();
       
   661     	        }
       
   662     	    }
       
   663     	}
       
   664     TRACE_EXIT_POINT;
   578     TRACE_EXIT_POINT;
   665     }
   579     }
   666 
   580 
   667 // -----------------------------------------------------------------------------
   581 // -----------------------------------------------------------------------------
   668 // CCalenUnifiedEditorControl::SetDateTimeField
   582 // CCalenUnifiedEditorControl::SetDateTimeField
   759 // -----------------------------------------------------------------------------
   673 // -----------------------------------------------------------------------------
   760 // CCalenUnifiedEditorControl::SetAllDayEvent
   674 // CCalenUnifiedEditorControl::SetAllDayEvent
   761 // To Set AllDay field value
   675 // To Set AllDay field value
   762 // -----------------------------------------------------------------------------
   676 // -----------------------------------------------------------------------------
   763 //
   677 //
   764 void CCalenUnifiedEditorControl::SetAllDayEventL( TBool aActive )
   678 void CCalenUnifiedEditorControl::SetAllDayEvent( TBool aActive )
   765     {
   679     {
   766     TRACE_ENTRY_POINT;
   680     TRACE_ENTRY_POINT;
   767     
   681     
   768     iAllDayField->SetAllDayEvent( aActive );
   682     iAllDayField->SetAllDayEvent( aActive );
   769     //set defalut alarmtime when allday field is activated/deactivated
   683     //set defalut alarmtime when allday field is activated/deactivated
   805         case ECalenEditorDBName:
   719         case ECalenEditorDBName:
   806             {
   720             {
   807             iDbField->HandleControlStateChangeL( aControlId );
   721             iDbField->HandleControlStateChangeL( aControlId );
   808             }
   722             }
   809             break;
   723             break;
   810         case EKoreanLunarTypeSelectSolarLunarLeap:
       
   811         	{
       
   812         	if (FeatureManager::FeatureSupported( KFeatureIdKorean ))
       
   813         		{
       
   814         		iKoreanLunarTypeField->HandleControlStateChangeL( aControlId );
       
   815         		}
       
   816         	}
       
   817             break;
       
   818         case EKoreanLunarAniversityStart:
       
   819         	{
       
   820         	iKoreanLunarDateEditor->HandleControlStateChangeL( aControlId );
       
   821         	}
       
   822         	  
       
   823         default:
   724         default:
   824             break;
   725             break;
   825         }
   726         }
   826    
   727    
   827     TRACE_EXIT_POINT;
   728     TRACE_EXIT_POINT;
   847             }
   748             }
   848             break;
   749             break;
   849             
   750             
   850         case ECalenEditorStartTime:    
   751         case ECalenEditorStartTime:    
   851         case ECalenEditorStartDate:
   752         case ECalenEditorStartDate:
   852         case EKoreanLunarAniversityStart:
       
   853             {
   753             {
   854             ReadStartDateTimeFromEditorL( ETrue, aFocusedId );
   754             ReadStartDateTimeFromEditorL( ETrue, aFocusedId );
   855             UpdateMeetingDurationL();
   755             UpdateMeetingDurationL();
   856             }
   756             }
   857             break;
   757             break;
   902             break;
   802             break;
   903         case ECalenEditorAttachment:
   803         case ECalenEditorAttachment:
   904             break;
   804             break;
   905         case ECalenEditorDescription:
   805         case ECalenEditorDescription:
   906             break;
   806             break;
   907         case EKoreanLunarTypeSelectSolarLunarLeap:
       
   908         	break;
       
   909         default:
   807         default:
   910             break;
   808             break;
   911         }
   809         }
   912     
   810     
   913     iReminderField->PrepareForFocusTransitionL( aFocusedId );
   811     iReminderField->PrepareForFocusTransitionL( aFocusedId );
   944     
   842     
   945     TRACE_EXIT_POINT;
   843     TRACE_EXIT_POINT;
   946     }
   844     }
   947 
   845 
   948 // -----------------------------------------------------------------------------
   846 // -----------------------------------------------------------------------------
   949 // CCalenUnifiedEditorControl::OnLunarTypeChangedL
       
   950 // Handles lunar type changed
       
   951 // -----------------------------------------------------------------------------
       
   952 //
       
   953 void CCalenUnifiedEditorControl::OnLunarTypeChangedL( TLunarCalendarType aNewEventType )
       
   954     {
       
   955     TRACE_ENTRY_POINT;
       
   956     if( FeatureManager::FeatureSupported( KFeatureIdKorean ) )
       
   957         {
       
   958     	TLunarCalendarType oldType = iUnifiedEditor.Edited().CalendarType();
       
   959     	if(oldType != aNewEventType)
       
   960     		{
       
   961     		iUnifiedEditor.Edited().SetCalendarTypeL(aNewEventType);
       
   962     		if(aNewEventType == ESolar)
       
   963     			{
       
   964     			iUnifiedEditor.DeleteLine(EKoreanLunarAniversityStart, ETrue);
       
   965 				iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_DATE_ITEM, 
       
   966 						  					 ECalenEditorStartDate, EKoreanLunarTypeSelectSolarLunarLeap );
       
   967 				iUnifiedEditor.SetControlCaptionL( ECalenEditorStartDate,
       
   968 												   R_QTN_CALEN_EDITOR_DATE_OF_BIRTH );
       
   969 				SetDataToEditorL();
       
   970     			}
       
   971 			else
       
   972                 {
       
   973                 if(oldType == ESolar)
       
   974                     {
       
   975                     iUnifiedEditor.DeleteLine(ECalenEditorStartDate, ETrue);
       
   976                     iUnifiedEditor.InsertFieldL( R_KOREAN_LUNAR_DATE_EDITOR_LINE,
       
   977                     EKoreanLunarAniversityStart, EKoreanLunarTypeSelectSolarLunarLeap );
       
   978                     SetDataToEditorL();
       
   979                     }
       
   980     			}
       
   981     		}
       
   982     	}
       
   983     TRACE_EXIT_POINT;
       
   984     }
       
   985 
       
   986 // -----------------------------------------------------------------------------
       
   987 // CCalenUnifiedEditorControl::DeletePreviousEntryTypeFieldsL
   847 // CCalenUnifiedEditorControl::DeletePreviousEntryTypeFieldsL
   988 // Delete previous entry type fields on selcting 
   848 // Delete previous entry type fields on selcting 
   989 // the new entry type
   849 // the new entry type
   990 // -----------------------------------------------------------------------------
   850 // -----------------------------------------------------------------------------
   991 //
   851 //
   996     switch( previousEntryType )
   856     switch( previousEntryType )
   997         {
   857         {
   998         case CCalEntry::EEvent:
   858         case CCalEntry::EEvent:
   999             {
   859             {
  1000             // Delete AllDay, StartDate, EndDate, and Place fields
   860             // Delete AllDay, StartDate, EndDate, and Place fields
  1001             iUnifiedEditor.DeleteLine( ECalenEditorAllDayItem, EFalse );
   861             iUnifiedEditor.DeleteLine( ECalenEditorAllDayItem, ETrue );
  1002             iUnifiedEditor.DeleteLine( ECalenEditorStartDate, EFalse );
   862             iUnifiedEditor.DeleteLine( ECalenEditorStartDate, ETrue );
  1003             iUnifiedEditor.DeleteLine( ECalenEditorEndDate, EFalse );
   863             iUnifiedEditor.DeleteLine( ECalenEditorEndDate, ETrue );
  1004             iUnifiedEditor.DeleteLine( ECalenEditorPlace, EFalse );
   864             iUnifiedEditor.DeleteLine( ECalenEditorPlace, ETrue );
  1005             }
   865             }
  1006             break;
   866             break;
  1007         case CCalEntry::EAnniv:
   867         case CCalEntry::EAnniv:
  1008             {
   868             {
  1009           	TLunarCalendarType type =  iUnifiedEditor.Edited().CalendarType();
   869             iUnifiedEditor.DeleteLine( ECalenEditorStartDate, ETrue );
  1010 			if( type != ESolar && FeatureManager::FeatureSupported( KFeatureIdKorean ) )
       
  1011 				{
       
  1012 				iUnifiedEditor.DeleteLine( EKoreanLunarAniversityStart, EFalse );
       
  1013                 }
       
  1014             else
       
  1015 				{
       
  1016 				iUnifiedEditor.DeleteLine( ECalenEditorStartDate, EFalse );
       
  1017             	}
       
  1018 			
       
  1019 			if(FeatureManager::FeatureSupported( KFeatureIdKorean ))
       
  1020 				{
       
  1021 				iUnifiedEditor.DeleteLine( EKoreanLunarTypeSelectSolarLunarLeap, EFalse );
       
  1022 				}
       
  1023             }
   870             }
  1024             break;
   871             break;
  1025         case CCalEntry::EAppt:
   872         case CCalEntry::EAppt:
  1026             {
   873             {
  1027             if( iUnifiedEditor.Edited().IsAllDayEvent() ) 
   874             if( iUnifiedEditor.Edited().IsAllDayEvent() ) 
  1028                 {
   875                 {
  1029                 // Delete, AllDay event fields from Editor
   876                 // Delete, AllDay event fields from Editor
  1030                 iUnifiedEditor.DeleteLine( ECalenEditorAllDayItem, EFalse );
   877                 iUnifiedEditor.DeleteLine( ECalenEditorAllDayItem, ETrue );
  1031                 }
   878                 }
  1032             else
   879             else
  1033                 {
   880                 {
  1034                 // Delete, Non-AllDay event fields from Editor
   881                 // Delete, Non-AllDay event fields from Editor
  1035                 iUnifiedEditor.DeleteLine( ECalenEditorAllDayItem, EFalse );
   882                 iUnifiedEditor.DeleteLine( ECalenEditorAllDayItem, ETrue );
  1036                 iUnifiedEditor.DeleteLine( ECalenEditorStartTime, EFalse );
   883                 iUnifiedEditor.DeleteLine( ECalenEditorStartTime, ETrue );
  1037                 iUnifiedEditor.DeleteLine( ECalenEditorEndTime, EFalse );
   884                 iUnifiedEditor.DeleteLine( ECalenEditorEndTime, ETrue );
  1038                 }
   885                 }
  1039             iUnifiedEditor.DeleteLine( ECalenEditorStartDate, EFalse );
   886             iUnifiedEditor.DeleteLine( ECalenEditorStartDate, ETrue );
  1040             iUnifiedEditor.DeleteLine( ECalenEditorEndDate, EFalse );
   887             iUnifiedEditor.DeleteLine( ECalenEditorEndDate, ETrue );
  1041             iUnifiedEditor.DeleteLine( ECalenEditorPlace, EFalse );
   888             iUnifiedEditor.DeleteLine( ECalenEditorPlace, ETrue );
  1042 				
   889 				
  1043 				
   890 				
  1044             }
   891             }
  1045             break;
   892             break;
  1046         case CCalEntry::ETodo:
   893         case CCalEntry::ETodo:
  1047             {
   894             {
  1048             iUnifiedEditor.DeleteLine( ECalenEditorStartDate, EFalse );
   895             iUnifiedEditor.DeleteLine( ECalenEditorStartDate, ETrue );
  1049             iUnifiedEditor.DeleteLine( ECalenEditorPriority, EFalse );
   896             iUnifiedEditor.DeleteLine( ECalenEditorPriority, ETrue );
  1050             }
   897             }
  1051             break;
   898             break;
  1052         default:
   899         default:
  1053             break;
   900             break;
  1054         }
   901         }
  1073         CCoeControl* alarmDateCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorReminderDate );
   920         CCoeControl* alarmDateCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorReminderDate );
  1074         CCoeControl* alarmTimeCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorReminderTime );
   921         CCoeControl* alarmTimeCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorReminderTime );
  1075                 
   922                 
  1076         if( alarmTimeCtrl )
   923         if( alarmTimeCtrl )
  1077             {
   924             {
  1078             iUnifiedEditor.DeleteLine( ECalenEditorReminderTime, EFalse );
   925             iUnifiedEditor.DeleteLine( ECalenEditorReminderTime, ETrue );
  1079             }
   926             }
  1080         if( alarmDateCtrl )
   927         if( alarmDateCtrl )
  1081             {
   928             {
  1082             iUnifiedEditor.DeleteLine( ECalenEditorReminderDate, EFalse );
   929             iUnifiedEditor.DeleteLine( ECalenEditorReminderDate, ETrue );
  1083             }
   930             }
  1084         }
   931         }
  1085 
   932 
  1086     iUnifiedEditor.DeleteLine( ECalenEditorReminder,EFalse );
   933     iUnifiedEditor.DeleteLine( ECalenEditorReminder );
  1087     
   934     
  1088     /*CCoeControl* PeopleFieldCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorPeople );
   935     /*CCoeControl* PeopleFieldCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorPeople );
  1089     if( PeopleFieldCtrl )
   936     if( PeopleFieldCtrl )
  1090         {
   937         {
  1091         iUnifiedEditor.DeleteLine( ECalenEditorPeople );
   938         iUnifiedEditor.DeleteLine( ECalenEditorPeople );
  1092         }
   939         }
  1093     */
   940     */
  1094     CCoeControl* dbNameCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorDBName );
   941     CCoeControl* dbNameCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorDBName );
  1095     if( dbNameCtrl )
   942     if( dbNameCtrl )
  1096         {
   943         {
  1097         iUnifiedEditor.DeleteLine( ECalenEditorDBName,EFalse );
   944         iUnifiedEditor.DeleteLine( ECalenEditorDBName );
  1098         }
   945         }
  1099     // TODO: Uncomment this when enabling attachment support
   946     // TODO: Uncomment this when enabling attachment support
  1100     iUnifiedEditor.DeleteLine( ECalenEditorAttachment,EFalse );
   947     iUnifiedEditor.DeleteLine( ECalenEditorAttachment );
  1101     
   948     
  1102     iUnifiedEditor.DeleteLine( ECalenEditorDescription,EFalse );
   949     iUnifiedEditor.DeleteLine( ECalenEditorDescription );
  1103     
   950     
  1104     // To-Do do not have place field
   951     // To-Do do not have place field
  1105     CCoeControl* editorPlaceCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorPlace );
   952     CCoeControl* editorPlaceCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorPlace );
  1106     if( editorPlaceCtrl )
   953     if( editorPlaceCtrl )
  1107         {
   954         {
  1108         iUnifiedEditor.DeleteLine( ECalenEditorPlace,EFalse );
   955         iUnifiedEditor.DeleteLine( ECalenEditorPlace );
  1109         }
   956         }
  1110     
   957     
  1111     // Anniversary & To-Do entry, do not have Repeat field
   958     // Anniversary & To-Do entry, do not have Repeat field
  1112     if( ( aPreviousEntryType != CCalEntry::EAnniv ) ||
   959     if( ( aPreviousEntryType != CCalEntry::EAnniv ) ||
  1113             ( aPreviousEntryType != CCalEntry::ETodo ) )
   960             ( aPreviousEntryType != CCalEntry::ETodo ) )
  1115         // Delete Repeat field.
   962         // Delete Repeat field.
  1116         CCoeControl* repeatCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorRepeat );
   963         CCoeControl* repeatCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorRepeat );
  1117         CCoeControl* repeatUntilCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorRepeatUntil );
   964         CCoeControl* repeatUntilCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorRepeatUntil );
  1118         if( repeatCtrl )
   965         if( repeatCtrl )
  1119             {
   966             {
  1120             iUnifiedEditor.DeleteLine( ECalenEditorRepeat,EFalse );
   967             iUnifiedEditor.DeleteLine( ECalenEditorRepeat );
  1121             }
   968             }
  1122         if( repeatUntilCtrl )
   969         if( repeatUntilCtrl )
  1123             {
   970             {
  1124             iUnifiedEditor.DeleteLine( ECalenEditorRepeatUntil,EFalse );
   971             iUnifiedEditor.DeleteLine( ECalenEditorRepeatUntil );
  1125             }
   972             }
  1126         }
   973         }
  1127     }
   974     }
  1128 
   975 
  1129 // -----------------------------------------------------------------------------
   976 // -----------------------------------------------------------------------------
  1211         if( repeatCtrl )
  1058         if( repeatCtrl )
  1212             {
  1059             {
  1213             iRepeatField->ReadDataFromFormL( aContinueOnError );
  1060             iRepeatField->ReadDataFromFormL( aContinueOnError );
  1214             }
  1061             }
  1215         }
  1062         }
  1216     
       
  1217     if( iUnifiedEditor.GetEntryType() == CCalEntry::EAnniv 
       
  1218         &&  FeatureManager::FeatureSupported( KFeatureIdKorean ) )
       
  1219     	{
       
  1220     	CCoeControl* lunarcaltype = iUnifiedEditor.ControlOrNull( EKoreanLunarTypeSelectSolarLunarLeap );
       
  1221     	if( lunarcaltype )
       
  1222     		{
       
  1223     	    iKoreanLunarTypeField->ReadDataFromFormL( aContinueOnError );
       
  1224     	    }
       
  1225     	}
       
  1226     
  1063     
  1227     iDbField->ReadDataFromFormL( aContinueOnError );
  1064     iDbField->ReadDataFromFormL( aContinueOnError );
  1228     
  1065     
  1229     TRACE_EXIT_POINT;
  1066     TRACE_EXIT_POINT;
  1230     }
  1067     }
  1412 // -----------------------------------------------------------------------------
  1249 // -----------------------------------------------------------------------------
  1413 //
  1250 //
  1414 TTime CCalenUnifiedEditorControl::ReadTimeField( TInt aControlId )
  1251 TTime CCalenUnifiedEditorControl::ReadTimeField( TInt aControlId )
  1415     {
  1252     {
  1416     TRACE_ENTRY_POINT;
  1253     TRACE_ENTRY_POINT;
  1417 
       
  1418     if(aControlId == ECalenEditorStartDate && FeatureManager::FeatureSupported( KFeatureIdKorean ))
       
  1419 		{
       
  1420 		if( CCalEntry::EAnniv == iUnifiedEditor.GetEntryType() )
       
  1421 			{
       
  1422 			TLunarCalendarType type =  iUnifiedEditor.Edited().CalendarType();
       
  1423 			if( type != ESolar )
       
  1424 				{
       
  1425 				aControlId = EKoreanLunarAniversityStart;
       
  1426 				TRACE_EXIT_POINT;
       
  1427 				return static_cast<CKoreanLunarDateEditor*>( iUnifiedEditor.Control( aControlId ) )->Date();
       
  1428 				}
       
  1429 			}
       
  1430 		}
       
  1431     TRACE_EXIT_POINT;
  1254     TRACE_EXIT_POINT;
  1432     return static_cast<CEikTTimeEditor*>( iUnifiedEditor.Control( aControlId ) )->GetTTime();
  1255     return static_cast<CEikTTimeEditor*>( iUnifiedEditor.Control( aControlId ) )->GetTTime();
  1433     }
  1256     }
  1434 
  1257 
  1435 // -----------------------------------------------------------------------------
  1258 // -----------------------------------------------------------------------------
  1438 // -----------------------------------------------------------------------------
  1261 // -----------------------------------------------------------------------------
  1439 //
  1262 //
  1440 TTime CCalenUnifiedEditorControl::ReadDateField( TInt aControlId )
  1263 TTime CCalenUnifiedEditorControl::ReadDateField( TInt aControlId )
  1441     {
  1264     {
  1442     TRACE_ENTRY_POINT;
  1265     TRACE_ENTRY_POINT;
  1443 
       
  1444     if(aControlId == ECalenEditorStartDate && FeatureManager::FeatureSupported( KFeatureIdKorean ))
       
  1445     	{
       
  1446     	if( CCalEntry::EAnniv == iUnifiedEditor.GetEntryType() )
       
  1447     		{
       
  1448     		TLunarCalendarType type =  iUnifiedEditor.Edited().CalendarType();
       
  1449     		if( type != ESolar )
       
  1450     			{
       
  1451     			aControlId = EKoreanLunarAniversityStart;
       
  1452 				TRACE_EXIT_POINT;
       
  1453     			return static_cast<CKoreanLunarDateEditor*>( iUnifiedEditor.Control( aControlId ) )->Date();
       
  1454     			}
       
  1455     		}
       
  1456     	}
       
  1457     	
       
  1458     TRACE_EXIT_POINT;
  1266     TRACE_EXIT_POINT;
  1459     return static_cast<CEikDateEditor*>( iUnifiedEditor.Control( aControlId ) )->Date();
  1267     return static_cast<CEikDateEditor*>( iUnifiedEditor.Control( aControlId ) )->Date();
  1460     }
  1268     }
  1461 
  1269 
  1462 // -----------------------------------------------------------------------------
  1270 // -----------------------------------------------------------------------------
  1545             }
  1353             }
  1546             break;
  1354             break;
  1547             
  1355             
  1548         case CCalEntry::EAnniv:
  1356         case CCalEntry::EAnniv:
  1549             {
  1357             {
  1550             TLunarCalendarType type =  iUnifiedEditor.Edited().CalendarType();
  1358             iUnifiedEditor.DeleteLine( ECalenEditorStartDate, EFalse );
  1551             if( type != ESolar && FeatureManager::FeatureSupported( KFeatureIdKorean ))
  1359             iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_DATE_ITEM, 
  1552 				{
  1360                     ECalenEditorStartDate, ECalenEditorEventType );
  1553 				iUnifiedEditor.DeleteLine( EKoreanLunarAniversityStart, EFalse );
  1361             
  1554 				iUnifiedEditor.InsertFieldL( R_KOREAN_LUNAR_DATE_EDITOR_LINE,
  1362             // "Start Date" Label should be "Date of Birth" for Birthday
  1555 								EKoreanLunarAniversityStart, EKoreanLunarTypeSelectSolarLunarLeap );
  1363             iUnifiedEditor.SetControlCaptionL( ECalenEditorStartDate,
  1556                 }
  1364                             R_QTN_CALEN_EDITOR_DATE_OF_BIRTH );
  1557             else
  1365             
  1558                 {
       
  1559             	iUnifiedEditor.DeleteLine( ECalenEditorStartDate, EFalse );
       
  1560             	iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_DATE_ITEM, 
       
  1561                 ECalenEditorStartDate, ECalenEditorEventType );
       
  1562             	// "Start Date" Label should be "Date of Birth" for Birthday
       
  1563             	iUnifiedEditor.SetControlCaptionL( ECalenEditorStartDate,
       
  1564                             						   R_QTN_CALEN_EDITOR_DATE_OF_BIRTH );
       
  1565                	}
       
  1566 
       
  1567             }
  1366             }
  1568             break;
  1367             break;
  1569             
  1368             
  1570         case CCalEntry::EAppt:
  1369         case CCalEntry::EAppt:
  1571             {
  1370             {
  1658     TRACE_ENTRY_POINT;
  1457     TRACE_ENTRY_POINT;
  1659     TRACE_EXIT_POINT;
  1458     TRACE_EXIT_POINT;
  1660     
  1459     
  1661     return iDbField->GetCalendarNameForEntryL();
  1460     return iDbField->GetCalendarNameForEntryL();
  1662     }
  1461     }
  1663 
       
  1664 TInt CCalenUnifiedEditorControl::GetCalendarNameForEntryL(const TDesC& aCalendarFileName)
  1462 TInt CCalenUnifiedEditorControl::GetCalendarNameForEntryL(const TDesC& aCalendarFileName)
  1665     {
  1463     {
  1666     TRACE_ENTRY_POINT;
  1464     TRACE_ENTRY_POINT;
  1667     TRACE_EXIT_POINT;
  1465     TRACE_EXIT_POINT;
  1668     
       
  1669     return iDbField->GetCalendarNameForEntryL(aCalendarFileName);
  1466     return iDbField->GetCalendarNameForEntryL(aCalendarFileName);
  1670     }
  1467     }
  1671 
  1468 
  1672 // -----------------------------------------------------------------------------
  1469 // -----------------------------------------------------------------------------
  1673 // CCalenUnifiedEditorControl::UpdateMeetingDurationL()
  1470 // CCalenUnifiedEditorControl::UpdateMeetingDurationL()
  1732 // CCalenUnifiedEditorControl::ReadRrule()
  1529 // CCalenUnifiedEditorControl::ReadRrule()
  1733 // Checks the Rdates and RRule if there is any with the CCalEntry
  1530 // Checks the Rdates and RRule if there is any with the CCalEntry
  1734 // (other items were commented in a header).
  1531 // (other items were commented in a header).
  1735 // -----------------------------------------------------------------------------
  1532 // -----------------------------------------------------------------------------
  1736 //
  1533 //
  1737 void CCalenUnifiedEditorControl::ReadRruleL(TTime& firstRdatestartTime, TTime& endTime)
  1534 void CCalenUnifiedEditorControl::ReadRrule(TTime& firstRdatestartTime, TTime& endTime)
  1738     {   
  1535     {   
  1739     TRACE_ENTRY_POINT;
  1536     TRACE_ENTRY_POINT;
  1740     
  1537     
  1741     RArray<TCalTime> rDateList;
  1538     RArray<TCalTime> rDateList;
  1742     CleanupClosePushL( rDateList );    
  1539     CleanupClosePushL( rDateList );