calendarui/controller/src/calenmultipledbui.cpp
branchRCL_3
changeset 59 aba12c885d83
parent 48 bf573002ff72
child 60 96907930389d
--- a/calendarui/controller/src/calenmultipledbui.cpp	Mon Jun 21 15:38:59 2010 +0300
+++ b/calendarui/controller/src/calenmultipledbui.cpp	Thu Jul 15 18:37:27 2010 +0300
@@ -659,7 +659,7 @@
     
     iCalendarInfoNew = CCalCalendarInfo::NewL();
     iCalendarInfoNew->SetNameL(KNullDesC16);
-    iCalendarInfoNew->SetColor(255);
+    iCalendarInfoNew->SetColor(KCalenBlue.Value());
     iCalendarInfoNew->SetEnabled(ETrue);
     iDbEditor = CCalenMultiDBEditor::NewL(*this,*iCalendarInfoNew, iController, EFalse );
   
@@ -681,20 +681,25 @@
 // CCalenMultipleDbUi::UpdateAddOrEditL
 // ----------------------------------------------------------------------------
 //
-void CCalenMultipleDbUi::UpdateOnAddOrEditL(TBool aItemAdded)
+TInt CCalenMultipleDbUi::UpdateOnAddOrEditL(TBool aItemAdded)
     {
     TRACE_ENTRY_POINT
-	
+	TInt retError = KErrNone;
+    
 	iDbEditor = NULL;
     
     if(aItemAdded)
         {
+        TRAP(retError,
         // Set calendar properties for new calendar being created.
         SetCalendarAddPropertiesL(*iCalendarInfoNew);
        
+        //This makes sure calendarInfo will get deleted anyway!
         iController.AddCalendarL(iCalendarInfoNew);
+        );
+        
         iCalendarInfoNew = NULL;
-       
+        
         //Highlight the newly created list item
         iListBox->ScrollToMakeItemVisible(iListBox->BottomItemIndex());
         iListBox->SetCurrentItemIndexAndDraw(iDesArray->Count()-1);
@@ -707,19 +712,26 @@
                 CheckForChangesL(*iCalendarInfoOriginal,
                 *iCalendarInfoEdited))
             {
+            TRAP(retError,
             // update the calendar properties such as modification time, sync status.
             SetCalendarUpdatePropertiesL(*iCalendarInfoEdited);
             
             iController.UpdateCalendarL(iCalendarInfoEdited);
+            );
+            
             }
 
         iConflictOccured = EFalse;
         delete iCalendarInfoOriginal,iCalendarInfoOriginal = NULL;
         }
+    
     iIsDbEditorOpen = EFalse ; //iIsDbEditorOpen should be set before calling UpdateListboxL() 
-    UpdateListboxL();
+    
+    TRAP_IGNORE(UpdateListboxL());
+    
     
     TRACE_EXIT_POINT
+	return retError;
     }
 
 // ----------------------------------------------------------------------------