calendarui/editors/src/calenunifiededitor.cpp
branchRCL_3
changeset 31 97232defd20e
parent 30 bd7edf625bdd
equal deleted inserted replaced
30:bd7edf625bdd 31:97232defd20e
    29 #include "CalenDescription.h"
    29 #include "CalenDescription.h"
    30 #include "calenattachmentinfo.h"
    30 #include "calenattachmentinfo.h"
    31 #include "calenattachmentmodel.h"
    31 #include "calenattachmentmodel.h"
    32 #include "CleanupResetAndDestroy.h"
    32 #include "CleanupResetAndDestroy.h"
    33 #include "CalendarPrivateCRKeys.h"
    33 #include "CalendarPrivateCRKeys.h"
       
    34 #include "KoreanLunarDateEditor.h"
       
    35 #include <featmgr.h>
    34 #include "CalenUid.h"
    36 #include "CalenUid.h"
    35 
    37 
    36 // system includes
    38 // system includes
    37 #include <coemain.h>
    39 #include <coemain.h>
    38 #include <eikdialg.h>
    40 #include <eikdialg.h>
   172     iCollectionIds.Reset();
   174     iCollectionIds.Reset();
   173     
   175     
   174     iAsyncCallback->Cancel();
   176     iAsyncCallback->Cancel();
   175     delete iAsyncCallback;
   177     delete iAsyncCallback;
   176     
   178     
       
   179     // Do not call UnInitializeLib() if InitalizeLib() leaves.
       
   180     if ( iFeatMgrInitialized )
       
   181         {
       
   182         // Frees the TLS. Must be done after FeatureManager is used.
       
   183         FeatureManager::UnInitializeLib();  
       
   184         }  
       
   185 
       
   186     
   177     TRACE_EXIT_POINT;
   187     TRACE_EXIT_POINT;
   178     }
   188     }
   179 
   189 
   180 // -----------------------------------------------------------------------------
   190 // -----------------------------------------------------------------------------
   181 // CCalenUnifiedEditor::CCalenUnifiedEditor
   191 // CCalenUnifiedEditor::CCalenUnifiedEditor
   299     
   309     
   300     
   310     
   301     iIdle = CIdle::NewL( CActive::EPriorityUserInput );
   311     iIdle = CIdle::NewL( CActive::EPriorityUserInput );
   302     iIdle->Start( TCallBack( KeyCallBack, this) );
   312     iIdle->Start( TCallBack( KeyCallBack, this) );
   303     iCoeEnv->AddFepObserverL( *this );
   313     iCoeEnv->AddFepObserverL( *this );
       
   314     
       
   315     // Sets up TLS, must be done before FeatureManager is used.
       
   316     FeatureManager::InitializeLibL();
       
   317     // Used in destructor. 
       
   318     iFeatMgrInitialized = ETrue;
   304     
   319     
   305     TRACE_EXIT_POINT;
   320     TRACE_EXIT_POINT;
   306     }
   321     }
   307 
   322 
   308 // -----------------------------------------------------------------------------
   323 // -----------------------------------------------------------------------------
  1480 // -----------------------------------------------------------------------------
  1495 // -----------------------------------------------------------------------------
  1481 //
  1496 //
  1482 SEikControlInfo CCalenUnifiedEditor::CreateCustomControlL( TInt aControlType )
  1497 SEikControlInfo CCalenUnifiedEditor::CreateCustomControlL( TInt aControlType )
  1483     {
  1498     {
  1484     TRACE_ENTRY_POINT;
  1499     TRACE_ENTRY_POINT;
  1485 
  1500     if( aControlType == ECalenCtLunarDateEditor  && FeatureManager::FeatureSupported( KFeatureIdKorean ) ) 
       
  1501             {
       
  1502             SEikControlInfo controlInfo;
       
  1503             controlInfo.iControl =  new (ELeave) CKoreanLunarDateEditor(iServices);
       
  1504             controlInfo.iControl->SetParent( this );
       
  1505             controlInfo.iFlags = 0;
       
  1506             controlInfo.iTrailerTextId = 0;
       
  1507             return controlInfo;
       
  1508             }
  1486     __ASSERT_ALWAYS( aControlType==ECalenCtDescriptionField, User::Invariant() );
  1509     __ASSERT_ALWAYS( aControlType==ECalenCtDescriptionField, User::Invariant() );
  1487 
  1510 
  1488     TRACE_EXIT_POINT;
  1511     TRACE_EXIT_POINT;
  1489     return iUnifiedEditorControl->Description()->CreateFieldL();
  1512     return iUnifiedEditorControl->Description()->CreateFieldL();
  1490     }
  1513     }
  1501 
  1524 
  1502     if( aControlType == ECalenCtDescriptionField )
  1525     if( aControlType == ECalenCtDescriptionField )
  1503         {
  1526         {
  1504         TRACE_EXIT_POINT;
  1527         TRACE_EXIT_POINT;
  1505         return MEikDialogPageObserver::EEdwinDerived;
  1528         return MEikDialogPageObserver::EEdwinDerived;
       
  1529         }
       
  1530     if( aControlType == ECalenCtLunarDateEditor  && FeatureManager::FeatureSupported( KFeatureIdKorean ) )
       
  1531         {
       
  1532         TRACE_EXIT_POINT;
       
  1533         return MEikDialogPageObserver::EMfneDerived;
  1506         }
  1534         }
  1507 
  1535 
  1508     TRACE_EXIT_POINT;
  1536     TRACE_EXIT_POINT;
  1509     return MEikDialogPageObserver::EUnknownType;
  1537     return MEikDialogPageObserver::EUnknownType;
  1510     }
  1538     }
  2173     entry->SetStartAndEndTimeL( newInstanceStartDate, newInstanceEndDate );
  2201     entry->SetStartAndEndTimeL( newInstanceStartDate, newInstanceEndDate );
  2174     if(iEditedCalEntry.EntryTypeL() != GetEntryType())
  2202     if(iEditedCalEntry.EntryTypeL() != GetEntryType())
  2175         {
  2203         {
  2176         if( entry->EntryTypeL() == CCalEntry::EAnniv )
  2204         if( entry->EntryTypeL() == CCalEntry::EAnniv )
  2177             {
  2205             {
  2178             // Set yearly rule to Anniversary entry, to create Annaiversary instance yearly 
  2206 			if( !( FeatureManager::FeatureSupported( KFeatureIdKorean ) 
  2179             TCalRRule rrule( TCalRRule::EYearly );
  2207 					&& entry->UserInt32L() != ESolar ) )
  2180             TCalTime startDate;
  2208 				{
  2181             rrule.SetDtStart( newInstanceStartDate );
  2209 				// Set yearly rule to Anniversary entry, to create Annaiversary instance yearly 
  2182             rrule.SetInterval( 1 ); // once a year
  2210 				TCalRRule rrule( TCalRRule::EYearly );
  2183             entry->SetRRuleL( rrule );
  2211 				TCalTime startDate;
       
  2212 				rrule.SetDtStart( newInstanceStartDate );
       
  2213 				rrule.SetInterval( 1 ); // once a year
       
  2214 				entry->SetRRuleL( rrule );
       
  2215 				}
  2184             }
  2216             }
  2185 		}
  2217 		}
  2186     
  2218     
  2187 
  2219 
  2188     
  2220