calendarui/editors/src/calenunifiededitorcontrol.cpp
branchRCL_3
changeset 30 d68a4b5d5885
parent 27 55d60436f00b
child 36 9c5b1510919f
--- a/calendarui/editors/src/calenunifiededitorcontrol.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/editors/src/calenunifiededitorcontrol.cpp	Tue May 25 12:41:10 2010 +0300
@@ -329,7 +329,15 @@
         iRepeatField->InitRepetFieldLayoutL();
         }
 
-    iDbField->InitDbFieldLayoutL();
+    RPointerArray<CCalCalendarInfo> calendarInfoList; 
+    iUnifiedEditor.GetServices().GetAllCalendarInfoL(calendarInfoList);
+    CleanupClosePushL( calendarInfoList );
+    if( calendarInfoList.Count() > 1 )
+      {
+        iDbField->InitDbFieldLayoutL();
+      }
+    CleanupStack::PopAndDestroy( &calendarInfoList );
+    
     iDescription->InitDescritpionFieldLayoutL();
     
     TRACE_EXIT_POINT;
@@ -344,10 +352,27 @@
     {
     TRACE_ENTRY_POINT;
     // event type, subject, date & year,more details
-     
-    iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_DATE_ITEM, 
-                  ECalenEditorStartDate, ECalenEditorSubject ); 
+    
+    RPointerArray<CCalCalendarInfo> calendarInfoList; 
+    iUnifiedEditor.GetServices().GetAllCalendarInfoL(calendarInfoList);
+    CleanupClosePushL( calendarInfoList );
+
+    if( calendarInfoList.Count() > 1 )
+        {
+        iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DB_NAME_ITEM,
+            ECalenEditorDBName, ECalenEditorSubject );
 
+        iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_DATE_ITEM, 
+            ECalenEditorStartDate, ECalenEditorDBName );
+        }
+    else
+        {
+        iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_DATE_ITEM, 
+            ECalenEditorStartDate, ECalenEditorSubject );
+        }
+
+    CleanupStack::PopAndDestroy( &calendarInfoList );
+    
     // "Start Date" Label should be "Date of Birth" for Birthday
     iUnifiedEditor.SetControlCaptionL( ECalenEditorStartDate,
                     R_QTN_CALEN_EDITOR_DATE_OF_BIRTH );
@@ -359,13 +384,13 @@
                     ECalenEditorPlace, ECalenEditorReminder );
 /*    iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_PEOPLE_ITEM,
                     ECalenEditorPeople, ECalenEditorPlace );
-*/    iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DB_NAME_ITEM,
-                    ECalenEditorDBName, ECalenEditorPlace );
+*/   /* iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DB_NAME_ITEM,
+                    ECalenEditorDBName, ECalenEditorPlace );*/
 
     // TODO: Uncomment this when enabling attachment support
     // Replace ECalenEditorDBName with ECalenEditorAttachment in the next statement
     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_ATTACHMENT_ITEM,
-                    ECalenEditorAttachment, ECalenEditorDBName );
+                    ECalenEditorAttachment, ECalenEditorPlace );
 
     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DESCRIPTION_ITEM,
                     ECalenEditorDescription, ECalenEditorAttachment );
@@ -388,10 +413,26 @@
     // all day event 
     // subject,event type,all day,start date,end date,place,more details 
     
-  
+    RPointerArray<CCalCalendarInfo> calendarInfoList; 
+    iUnifiedEditor.GetServices().GetAllCalendarInfoL(calendarInfoList);
+    CleanupClosePushL( calendarInfoList );
+
+    if( calendarInfoList.Count() > 1 )
+        {
+    iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DB_NAME_ITEM,
+            ECalenEditorDBName, ECalenEditorSubject );
+
     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_ALL_DAY_ITEM,
+            ECalenEditorAllDayItem, ECalenEditorDBName );
+        }
+    else
+        {
+    iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_ALL_DAY_ITEM, 
             ECalenEditorAllDayItem, ECalenEditorSubject );
+        }
 
+    CleanupStack::PopAndDestroy( &calendarInfoList );
+    
     if( !iUnifiedEditor.Edited().IsAllDayEvent() )
         {
         iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_TIME_ITEM, 
@@ -418,13 +459,13 @@
     /*iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_PEOPLE_ITEM,
                     ECalenEditorPeople, ECalenEditorRepeat );
     */
-    iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DB_NAME_ITEM,
+   /* iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DB_NAME_ITEM,
                     ECalenEditorDBName, ECalenEditorRepeat );
-    
+    */
     // TODO: Uncomment this when enabling attachment support
     // Replace ECalenEditorDBName with ECalenEditorAttachment in the next statement
     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_ATTACHMENT_ITEM,
-                    ECalenEditorAttachment, ECalenEditorDBName );
+                    ECalenEditorAttachment, ECalenEditorRepeat );
     
     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DESCRIPTION_ITEM,
                     ECalenEditorDescription, ECalenEditorAttachment );
@@ -441,9 +482,25 @@
     {
     TRACE_ENTRY_POINT;
     // event type,subject,due date,more details
+   RPointerArray<CCalCalendarInfo> calendarInfoList; 
+   iUnifiedEditor.GetServices().GetAllCalendarInfoL(calendarInfoList);
+   CleanupClosePushL( calendarInfoList );
+   
+    if( calendarInfoList.Count() > 1 )
+        {
+        iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DB_NAME_ITEM,
+                        ECalenEditorDBName, ECalenEditorSubject );
+        
+        iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_DATE_ITEM, 
+                            ECalenEditorStartDate, ECalenEditorDBName );
+        }
+    else
+        {
+        iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_DATE_ITEM, 
+                               ECalenEditorStartDate, ECalenEditorSubject );
+        }
     
-    iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_DATE_ITEM, 
-                    ECalenEditorStartDate, ECalenEditorSubject );
+    CleanupStack::PopAndDestroy( &calendarInfoList );
 
     // "Start Date" Label should be "Due date" for To-Do
     iUnifiedEditor.SetControlCaptionL( ECalenEditorStartDate,
@@ -455,13 +512,13 @@
     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_PRIORITY_ITEM, 
                     ECalenEditorPriority, ECalenEditorReminder );
 
-    iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DB_NAME_ITEM,
-                    ECalenEditorDBName, ECalenEditorPriority );
+    /*iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DB_NAME_ITEM,
+                    ECalenEditorDBName, ECalenEditorPriority );*/
     
     // TODO: Uncomment this when enabling attachment support
     // Replace ECalenEditorDBName with ECalenEditorAttachment in the next statement
     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_ATTACHMENT_ITEM,
-                    ECalenEditorAttachment, ECalenEditorDBName );
+                    ECalenEditorAttachment, ECalenEditorPriority );
     
     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DESCRIPTION_ITEM,
                     ECalenEditorDescription, ECalenEditorAttachment );
@@ -868,8 +925,11 @@
         iUnifiedEditor.DeleteLine( ECalenEditorPeople );
         }
     */
-    iUnifiedEditor.DeleteLine( ECalenEditorDBName );
-    
+    CCoeControl* dbNameCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorDBName );
+    if( dbNameCtrl )
+        {
+        iUnifiedEditor.DeleteLine( ECalenEditorDBName );
+        }
     // TODO: Uncomment this when enabling attachment support
     iUnifiedEditor.DeleteLine( ECalenEditorAttachment );
     
@@ -1283,9 +1343,13 @@
         case CCalEntry::EAnniv:
             {
             iUnifiedEditor.DeleteLine( ECalenEditorStartDate, EFalse );
-            iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_BIRTHDAY_YEAR_ITEM, 
+            iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_DATE_ITEM, 
                     ECalenEditorStartDate, ECalenEditorEventType );
             
+            // "Start Date" Label should be "Date of Birth" for Birthday
+            iUnifiedEditor.SetControlCaptionL( ECalenEditorStartDate,
+                            R_QTN_CALEN_EDITOR_DATE_OF_BIRTH );
+            
             }
             break;