--- a/creator/src/creator_calendarelement.cpp Tue Sep 14 21:20:12 2010 +0300
+++ b/creator/src/creator_calendarelement.cpp Wed Sep 15 12:13:45 2010 +0300
@@ -488,6 +488,125 @@
}
}
+void CCreatorCalendarElement::AsyncExecuteCommandL()
+ {
+ LOGSTRING("Creator: CCreatorCalendarElement::AsyncExecuteCommandL");
+ // Amount of calendar entries:
+ const CCreatorScriptAttribute* calEntryAmountAttr = this->FindAttributeByName(KAmount);
+ const CCreatorScriptAttribute* calEntryTypeAttr = this->FindAttributeByName(KType);
+ TInt entryAmount = 1;
+ if( calEntryAmountAttr )
+ {
+ entryAmount = ConvertStrToIntL(calEntryAmountAttr->Value());
+ }
+ if( calEntryTypeAttr == 0 )
+ {
+ LOGSTRING("ERROR in CCreatorCalendarElement::AsyncExecuteCommandL: Type attribute is missing.");
+ User::Leave(KErrGeneral); // type is required attribute
+ }
+
+ // Find fields element:
+ CCreatorScriptElement* fieldsElement = FindSubElement(KFields);
+
+ if( iLoopIndex < entryAmount )
+ {
+ CCalenderInterimParameters* param = new (ELeave) CCalenderInterimParameters;
+ CleanupStack::PushL(param);
+ if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeAppointment) == 0 )
+ {
+ if( fieldsElement && fieldsElement->SubElements().Count() > 0 )
+ {
+ FillEntryParamsL(EAppointment, fieldsElement->SubElements(), param);
+ iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAppointments, param);
+ }
+ else
+ {
+ iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAppointments, 0, entryAmount);
+ CleanupStack::PopAndDestroy(param);
+ // We can step out from the for-loop, because the amount is given to engine.
+ // stop loop and signal end of the executing command
+ AsyncCommandFinished();
+ return;
+ }
+ }
+ else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeEvent ) == 0 )
+ {
+ if( fieldsElement && fieldsElement->SubElements().Count() > 0 )
+ {
+ FillEntryParamsL(EEvent, fieldsElement->SubElements(), param);
+ iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryEvents, param);
+ }
+ else
+ {
+ iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryEvents, 0, entryAmount);
+ CleanupStack::PopAndDestroy(param);
+ // We can step out from the for-loop, because the amount is given to engine.
+ // stop loop and signal end of the executing command
+ AsyncCommandFinished();
+ return;
+ }
+ }
+ else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeReminder ) == 0 )
+ {
+ if( fieldsElement && fieldsElement->SubElements().Count() > 0 )
+ {
+ FillEntryParamsL(EReminder, fieldsElement->SubElements(), param);
+ iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryReminders, param);
+ }
+ else
+ {
+ iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryReminders, 0, entryAmount);
+ CleanupStack::PopAndDestroy(param);
+ // We can step out from the for-loop, because the amount is given to engine.
+ // stop loop and signal end of the executing command
+ AsyncCommandFinished();
+ return;
+ }
+ }
+ else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeAnniversary ) == 0 )
+ {
+ if( fieldsElement && fieldsElement->SubElements().Count() > 0 )
+ {
+ FillEntryParamsL(EAnniversary, fieldsElement->SubElements(), param);
+ iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAnniversaries, param);
+ }
+ else
+ {
+ iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAnniversaries, 0, entryAmount);
+ CleanupStack::PopAndDestroy(param);
+ // We can step out from the for-loop, because the amount is given to engine.
+ // stop loop and signal end of the executing command
+ AsyncCommandFinished();
+ return;
+ }
+ }
+ else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeTodo ) == 0 )
+ {
+ if( fieldsElement && fieldsElement->SubElements().Count() > 0 )
+ {
+ FillEntryParamsL(ETodo, fieldsElement->SubElements(), param);
+ iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryToDos, param);
+ }
+ else
+ {
+ iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryToDos, 0, entryAmount);
+ CleanupStack::PopAndDestroy(param);
+ // We can step out from the for-loop, because the amount is given to engine.
+ // stop loop and signal end of the executing command
+ AsyncCommandFinished();
+ return;
+ }
+ }
+ CleanupStack::Pop(); // param
+ StartNextLoop();
+ }
+ else
+ {
+ // stop loop and signal end of the executing command
+ AsyncCommandFinished();
+ }
+ }
+
void CCreatorCalendarElement::ExecuteCommandL()
{
LOGSTRING("Creator: CCreatorCalendarElement::ExecuteCommandL");