657 iCalendarInfoNew = NULL; |
657 iCalendarInfoNew = NULL; |
658 } |
658 } |
659 |
659 |
660 iCalendarInfoNew = CCalCalendarInfo::NewL(); |
660 iCalendarInfoNew = CCalCalendarInfo::NewL(); |
661 iCalendarInfoNew->SetNameL(KNullDesC16); |
661 iCalendarInfoNew->SetNameL(KNullDesC16); |
662 iCalendarInfoNew->SetColor(255); |
662 iCalendarInfoNew->SetColor(KCalenBlue.Value()); |
663 iCalendarInfoNew->SetEnabled(ETrue); |
663 iCalendarInfoNew->SetEnabled(ETrue); |
664 iDbEditor = CCalenMultiDBEditor::NewL(*this,*iCalendarInfoNew, iController, EFalse ); |
664 iDbEditor = CCalenMultiDBEditor::NewL(*this,*iCalendarInfoNew, iController, EFalse ); |
665 |
665 |
666 //Async dialog |
666 //Async dialog |
667 retValue = iDbEditor->ExecuteLD(); |
667 retValue = iDbEditor->ExecuteLD(); |
679 |
679 |
680 // ---------------------------------------------------------------------------- |
680 // ---------------------------------------------------------------------------- |
681 // CCalenMultipleDbUi::UpdateAddOrEditL |
681 // CCalenMultipleDbUi::UpdateAddOrEditL |
682 // ---------------------------------------------------------------------------- |
682 // ---------------------------------------------------------------------------- |
683 // |
683 // |
684 void CCalenMultipleDbUi::UpdateOnAddOrEditL(TBool aItemAdded) |
684 TInt CCalenMultipleDbUi::UpdateOnAddOrEditL(TBool aItemAdded) |
685 { |
685 { |
686 TRACE_ENTRY_POINT |
686 TRACE_ENTRY_POINT |
687 |
687 TInt retError = KErrNone; |
|
688 |
688 iDbEditor = NULL; |
689 iDbEditor = NULL; |
689 |
690 |
690 if(aItemAdded) |
691 if(aItemAdded) |
691 { |
692 { |
|
693 TRAP(retError, |
692 // Set calendar properties for new calendar being created. |
694 // Set calendar properties for new calendar being created. |
693 SetCalendarAddPropertiesL(*iCalendarInfoNew); |
695 SetCalendarAddPropertiesL(*iCalendarInfoNew); |
694 |
696 |
|
697 //This makes sure calendarInfo will get deleted anyway! |
695 iController.AddCalendarL(iCalendarInfoNew); |
698 iController.AddCalendarL(iCalendarInfoNew); |
|
699 ); |
|
700 |
696 iCalendarInfoNew = NULL; |
701 iCalendarInfoNew = NULL; |
697 |
702 |
698 //Highlight the newly created list item |
703 //Highlight the newly created list item |
699 iListBox->ScrollToMakeItemVisible(iListBox->BottomItemIndex()); |
704 iListBox->ScrollToMakeItemVisible(iListBox->BottomItemIndex()); |
700 iListBox->SetCurrentItemIndexAndDraw(iDesArray->Count()-1); |
705 iListBox->SetCurrentItemIndexAndDraw(iDesArray->Count()-1); |
701 } |
706 } |
702 else |
707 else |
705 //if there is conflict iConflictOccured = true then skip below condition. |
710 //if there is conflict iConflictOccured = true then skip below condition. |
706 if (!iConflictOccured && iCalendarInfoOriginal && |
711 if (!iConflictOccured && iCalendarInfoOriginal && |
707 CheckForChangesL(*iCalendarInfoOriginal, |
712 CheckForChangesL(*iCalendarInfoOriginal, |
708 *iCalendarInfoEdited)) |
713 *iCalendarInfoEdited)) |
709 { |
714 { |
|
715 TRAP(retError, |
710 // update the calendar properties such as modification time, sync status. |
716 // update the calendar properties such as modification time, sync status. |
711 SetCalendarUpdatePropertiesL(*iCalendarInfoEdited); |
717 SetCalendarUpdatePropertiesL(*iCalendarInfoEdited); |
712 |
718 |
713 iController.UpdateCalendarL(iCalendarInfoEdited); |
719 iController.UpdateCalendarL(iCalendarInfoEdited); |
|
720 ); |
|
721 |
714 } |
722 } |
715 |
723 |
716 iConflictOccured = EFalse; |
724 iConflictOccured = EFalse; |
717 delete iCalendarInfoOriginal,iCalendarInfoOriginal = NULL; |
725 delete iCalendarInfoOriginal,iCalendarInfoOriginal = NULL; |
718 } |
726 } |
|
727 |
719 iIsDbEditorOpen = EFalse ; //iIsDbEditorOpen should be set before calling UpdateListboxL() |
728 iIsDbEditorOpen = EFalse ; //iIsDbEditorOpen should be set before calling UpdateListboxL() |
720 UpdateListboxL(); |
729 |
|
730 TRAP_IGNORE(UpdateListboxL()); |
|
731 |
721 |
732 |
722 TRACE_EXIT_POINT |
733 TRACE_EXIT_POINT |
|
734 return retError; |
723 } |
735 } |
724 |
736 |
725 // ---------------------------------------------------------------------------- |
737 // ---------------------------------------------------------------------------- |
726 // CCalenMultipleDbUi::ExitDialogL |
738 // CCalenMultipleDbUi::ExitDialogL |
727 // Edit item from listbox |
739 // Edit item from listbox |