calendarui/editors/src/calenunifiededitor.cpp
branchRCL_3
changeset 31 97232defd20e
parent 30 bd7edf625bdd
--- a/calendarui/editors/src/calenunifiededitor.cpp	Wed Sep 01 12:32:31 2010 +0100
+++ b/calendarui/editors/src/calenunifiededitor.cpp	Tue Sep 14 21:17:03 2010 +0300
@@ -31,6 +31,8 @@
 #include "calenattachmentmodel.h"
 #include "CleanupResetAndDestroy.h"
 #include "CalendarPrivateCRKeys.h"
+#include "KoreanLunarDateEditor.h"
+#include <featmgr.h>
 #include "CalenUid.h"
 
 // system includes
@@ -174,6 +176,14 @@
     iAsyncCallback->Cancel();
     delete iAsyncCallback;
     
+    // Do not call UnInitializeLib() if InitalizeLib() leaves.
+    if ( iFeatMgrInitialized )
+        {
+        // Frees the TLS. Must be done after FeatureManager is used.
+        FeatureManager::UnInitializeLib();  
+        }  
+
+    
     TRACE_EXIT_POINT;
     }
 
@@ -302,6 +312,11 @@
     iIdle->Start( TCallBack( KeyCallBack, this) );
     iCoeEnv->AddFepObserverL( *this );
     
+    // Sets up TLS, must be done before FeatureManager is used.
+    FeatureManager::InitializeLibL();
+    // Used in destructor. 
+    iFeatMgrInitialized = ETrue;
+    
     TRACE_EXIT_POINT;
     }
 
@@ -1482,7 +1497,15 @@
 SEikControlInfo CCalenUnifiedEditor::CreateCustomControlL( TInt aControlType )
     {
     TRACE_ENTRY_POINT;
-
+    if( aControlType == ECalenCtLunarDateEditor  && FeatureManager::FeatureSupported( KFeatureIdKorean ) ) 
+            {
+            SEikControlInfo controlInfo;
+            controlInfo.iControl =  new (ELeave) CKoreanLunarDateEditor(iServices);
+            controlInfo.iControl->SetParent( this );
+            controlInfo.iFlags = 0;
+            controlInfo.iTrailerTextId = 0;
+            return controlInfo;
+            }
     __ASSERT_ALWAYS( aControlType==ECalenCtDescriptionField, User::Invariant() );
 
     TRACE_EXIT_POINT;
@@ -1504,6 +1527,11 @@
         TRACE_EXIT_POINT;
         return MEikDialogPageObserver::EEdwinDerived;
         }
+    if( aControlType == ECalenCtLunarDateEditor  && FeatureManager::FeatureSupported( KFeatureIdKorean ) )
+        {
+        TRACE_EXIT_POINT;
+        return MEikDialogPageObserver::EMfneDerived;
+        }
 
     TRACE_EXIT_POINT;
     return MEikDialogPageObserver::EUnknownType;
@@ -2175,12 +2203,16 @@
         {
         if( entry->EntryTypeL() == CCalEntry::EAnniv )
             {
-            // Set yearly rule to Anniversary entry, to create Annaiversary instance yearly 
-            TCalRRule rrule( TCalRRule::EYearly );
-            TCalTime startDate;
-            rrule.SetDtStart( newInstanceStartDate );
-            rrule.SetInterval( 1 ); // once a year
-            entry->SetRRuleL( rrule );
+			if( !( FeatureManager::FeatureSupported( KFeatureIdKorean ) 
+					&& entry->UserInt32L() != ESolar ) )
+				{
+				// Set yearly rule to Anniversary entry, to create Annaiversary instance yearly 
+				TCalRRule rrule( TCalRRule::EYearly );
+				TCalTime startDate;
+				rrule.SetDtStart( newInstanceStartDate );
+				rrule.SetInterval( 1 ); // once a year
+				entry->SetRRuleL( rrule );
+				}
             }
 		}