diff -r 1984aceb8774 -r 21239b3bcd78 calendarui/editors/src/calendbfield.cpp --- a/calendarui/editors/src/calendbfield.cpp Wed Mar 31 21:29:10 2010 +0300 +++ b/calendarui/editors/src/calendbfield.cpp Wed Apr 14 15:55:57 2010 +0300 @@ -112,6 +112,13 @@ { TRACE_ENTRY_POINT; + if( iAsyncDBquery ) + { + iAsyncDBquery->Cancel(); + delete iAsyncDBquery; + iAsyncDBquery = NULL; + } + delete iDbNamesArrayText; delete iDbNamesArray; delete iDbNamesTextValues; @@ -204,6 +211,41 @@ } // ----------------------------------------------------------------------------- +// CCalenDbField::SetDataToEditorL +// update data in form +// ----------------------------------------------------------------------------- +// +void CCalenDbField::SetDataToEditorL(const TCalCollectionId& aColId) + { + TRACE_ENTRY_POINT; + //Get MultipleDbInfo array + RPointerArray calendarInfoList; + iServices->GetAllCalendarInfoL(calendarInfoList); + CleanupClosePushL(calendarInfoList); + + TInt index = KErrNotFound; + + HBufC* calendarFileName= iServices->GetCalFileNameForCollectionId(aColId).AllocLC(); + index = calendarInfoList.Find(*calendarFileName, CCalenDbField::CalendarInfoNameIdentifierL); + CleanupStack::PopAndDestroy(calendarFileName); + + if (KErrNotFound == index) + { + iDbNamesTextValues->SetCurrentValueIndex(0); + } + else + { + iDbNamesTextValues->SetCurrentValueIndex(index); + } + iUnifiedEditor.EditorDataHandler().SetCalendarFieldEditedL( + IsCalendarEdited(), iPreviousColId, iCurrentColId); + + CleanupStack::PopAndDestroy(&calendarInfoList); + + TRACE_EXIT_POINT; + } + +// ----------------------------------------------------------------------------- // CCalenDbField::HandleControlStateChangeL // (other items were commented in a header). // ----------------------------------------------------------------------------- @@ -220,25 +262,10 @@ ReadDataFromFormL( continueOnError ); iUnifiedEditor.EditorDataHandler().SetCalendarFieldEditedL(IsCalendarEdited() ,iPreviousColId,iCurrentColId); - //Check the child entries for the repeated entry - //The entry which is changing the calendar having any childs - //show this information note to the user. - CCalEntry& originalEntry = iUnifiedEditor.EditorDataHandler().Entry(); - RPointerArray childEntries; - CleanupClosePushL(childEntries); - iServices->EntryViewL(iPreviousColId)->FetchL(originalEntry.UidL(), childEntries); - if(IsCalendarEdited() && (childEntries.Count() > 1)) - { - CAknQueryDialog* dlg = CAknQueryDialog::NewL(); - if( !dlg->ExecuteLD( R_CALEN_DB_CHANGE_QUERY ) ) - { - iCurrentColId = iPreviousColId; - SetDataToEditorL(); - iUnifiedEditor.UpdateFormL(); - } - } - CleanupStack::PopAndDestroy( &childEntries ); + TCallBack callback(DoAsyncShowChangeDBQueryL,this); + iAsyncDBquery = new(ELeave) CAsyncCallBack(callback,CActive::EPriorityStandard); + iAsyncDBquery->CallBack(); break; } default: @@ -248,6 +275,23 @@ TRACE_EXIT_POINT; } +// ---------------------------------------------------------------------------- +// CallBackForShowinginfonote +// (other items were commented in a header). +// ---------------------------------------------------------------------------- +// +TInt CCalenDbField::DoAsyncShowChangeDBQueryL(TAny* aThisPtr) + { + TRACE_ENTRY_POINT + CCalenDbField* self = static_cast(aThisPtr); + if(self) + { + self->ShowChangeDBQueryL(); + } + TRACE_EXIT_POINT + return 0; + } + // ----------------------------------------------------------------------------- // CCalenDbField::ReadDataFromFormL // (other items were commented in a header). @@ -355,4 +399,34 @@ TRACE_EXIT_POINT; return (!calendarFileName.CompareF(*aName)); } +// ----------------------------------------------------------------------------- +// CCalenDbField::ShowChangeDBQueryL +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CCalenDbField::ShowChangeDBQueryL() + { + + //Check the child entries for the repeated entry + //The entry which is changing the calendar having any childs + //show this information note to the user. + CCalEntry& originalEntry = iUnifiedEditor.EditorDataHandler().Entry(); + RPointerArray childEntries; + CleanupClosePushL(childEntries); + iServices->EntryViewL(iPreviousColId)->FetchL(originalEntry.UidL(), childEntries); + if(IsCalendarEdited() && (childEntries.Count() > 1)) + { + TCalCollectionId currentId = iCurrentColId; + SetDataToEditorL(); + iUnifiedEditor.UpdateFormL(); + CAknQueryDialog* dlg = CAknQueryDialog::NewL(); + if( dlg->ExecuteLD( R_CALEN_DB_CHANGE_QUERY ) ) + { + iCurrentColId = currentId; + SetDataToEditorL(iCurrentColId); + iUnifiedEditor.UpdateFormL(); + } + } + CleanupStack::PopAndDestroy( &childEntries ); + } // End of File