1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "creator_calendarelement.h" |
|
21 #include "creator_traces.h" |
|
22 #include "creator_calendar.h" |
|
23 |
|
24 using namespace creatorcalendar; |
|
25 |
|
26 CCreatorCalendarElement* CCreatorCalendarElement::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext ) |
|
27 { |
|
28 CCreatorCalendarElement* self = new (ELeave) CCreatorCalendarElement(aEngine); |
|
29 CleanupStack::PushL(self); |
|
30 self->ConstructL(aName, aContext); |
|
31 CleanupStack::Pop(self); |
|
32 return self; |
|
33 } |
|
34 |
|
35 void CCreatorCalendarElement::FillEntryParamsL(TEntryType aType, const RPointerArray<CCreatorScriptElement>& fields, CCalenderInterimParameters* parameters) |
|
36 { |
|
37 if( parameters == 0 ) |
|
38 return; |
|
39 |
|
40 TBool startResolved = EFalse; |
|
41 TBool endResolved = EFalse; |
|
42 |
|
43 for( TInt i = 0; i < fields.Count(); ++i ) |
|
44 { |
|
45 TPtrC elemName = fields[i]->Name(); |
|
46 TPtrC elemContent = fields[i]->Content(); |
|
47 const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength); |
|
48 |
|
49 if( elemName == KSummary || elemName == KDescription ) |
|
50 { |
|
51 if( randomAttr || elemContent.Length() == 0 ) |
|
52 { |
|
53 TPtrC reason; |
|
54 if( aType == EAppointment ) |
|
55 { |
|
56 reason.Set(iEngine->RandomString (CCreatorEngine::EMeetingReason )); |
|
57 } |
|
58 else if( aType == EEvent ) |
|
59 { |
|
60 reason.Set(iEngine->RandomString(CCreatorEngine::EMemoText)); |
|
61 } |
|
62 else if( aType == EReminder ) |
|
63 { |
|
64 reason.Set(iEngine->RandomString(CCreatorEngine::EReminderText)); |
|
65 } |
|
66 else if( aType == EAnniversary ) |
|
67 { |
|
68 reason.Set(iEngine->RandomString(CCreatorEngine::EAnniversaryReason)); |
|
69 } |
|
70 else if( aType == ETodo ) |
|
71 { |
|
72 reason.Set(iEngine->RandomString(CCreatorEngine::EToDoText)); |
|
73 } |
|
74 |
|
75 if( elemName == KDescription ) |
|
76 { |
|
77 delete parameters->iDescription; |
|
78 parameters->iDescription = 0; |
|
79 parameters->iDescription = HBufC::NewL(reason.Length()); |
|
80 parameters->iDescription->Des().Copy(reason); |
|
81 } |
|
82 else if(elemName == KSummary) |
|
83 { |
|
84 delete parameters->iSummary; |
|
85 parameters->iSummary = 0; |
|
86 parameters->iSummary = HBufC::NewL(reason.Length()); |
|
87 parameters->iSummary->Des().Copy(reason); |
|
88 } |
|
89 } |
|
90 else if( elemName == KDescription ) |
|
91 { |
|
92 delete parameters->iDescription; |
|
93 parameters->iDescription = 0; |
|
94 parameters->iDescription = HBufC::NewL(elemContent.Length()); |
|
95 parameters->iDescription->Des().Copy(elemContent); |
|
96 } |
|
97 else if( elemName == KSummary) |
|
98 { |
|
99 delete parameters->iSummary; |
|
100 parameters->iSummary = 0; |
|
101 parameters->iSummary = HBufC::NewL(elemContent.Length()); |
|
102 parameters->iSummary->Des().Copy(elemContent); |
|
103 } |
|
104 } |
|
105 else if( elemName == KLocation ) |
|
106 { |
|
107 delete parameters->iLocation; |
|
108 parameters->iLocation = 0; |
|
109 |
|
110 if( randomAttr || elemContent.Length() == 0 ) |
|
111 { |
|
112 TPtrC reason = iEngine->RandomString (CCreatorEngine::EMeetingPlace ); |
|
113 parameters->iLocation = HBufC::NewL(reason.Length()); |
|
114 parameters->iLocation->Des().Copy(reason); |
|
115 } |
|
116 else |
|
117 { |
|
118 parameters->iLocation = HBufC::NewL(elemContent.Length()); |
|
119 parameters->iLocation->Des().Copy(elemContent); |
|
120 } |
|
121 } |
|
122 else if( elemName == KStarttime ) |
|
123 { |
|
124 if( randomAttr || elemContent.Length() == 0 ) |
|
125 { |
|
126 // Random start time used. If end time is already resolved, let's use that one for the basis. |
|
127 if( endResolved ) |
|
128 { |
|
129 parameters->iStartTime = iEngine->RandomTime(parameters->iEndTime, CCreatorEngine::EDatePast); |
|
130 } |
|
131 else |
|
132 { |
|
133 // Past or future: |
|
134 CCreatorEngine::TRandomDateType pastOrfuture = |
|
135 (CCreatorEngine::TRandomDateType) iEngine->RandomNumber((TInt) CCreatorEngine::EDatePast, |
|
136 (TInt) CCreatorEngine::EDateFuture); |
|
137 |
|
138 parameters->iStartTime = |
|
139 iEngine->RandomTime(iEngine->RandomDate(pastOrfuture), pastOrfuture); |
|
140 } |
|
141 } |
|
142 else |
|
143 { |
|
144 parameters->iStartTime = ConvertToDateTimeL(elemContent); |
|
145 } |
|
146 startResolved = ETrue; |
|
147 } |
|
148 else if( elemName == KEndtime ) |
|
149 { |
|
150 if( randomAttr || elemContent.Length() == 0 ) |
|
151 { |
|
152 // Random end time used. If start time is already resolved, let's use that one. |
|
153 if( startResolved ) |
|
154 { |
|
155 parameters->iEndTime = iEngine->RandomTime(parameters->iStartTime, CCreatorEngine::EDateFuture); |
|
156 } |
|
157 else |
|
158 { |
|
159 // Past or future: |
|
160 CCreatorEngine::TRandomDateType pastOrfuture = |
|
161 (CCreatorEngine::TRandomDateType) iEngine->RandomNumber((TInt) CCreatorEngine::EDatePast, |
|
162 (TInt) CCreatorEngine::EDateFuture); |
|
163 |
|
164 parameters->iEndTime = |
|
165 iEngine->RandomTime(iEngine->RandomDate(pastOrfuture), pastOrfuture); |
|
166 } |
|
167 } |
|
168 else |
|
169 { |
|
170 parameters->iEndTime = ConvertToDateTimeL(elemContent); |
|
171 } |
|
172 if( aType == ETodo ) |
|
173 { |
|
174 parameters->iTodoDueTime = parameters->iEndTime; |
|
175 } |
|
176 endResolved = ETrue; |
|
177 } |
|
178 else if( elemName == KRecurrentFreq ) |
|
179 { |
|
180 TInt randomFreq = 0; |
|
181 if( randomAttr || elemContent.Length() == 0 ) |
|
182 { |
|
183 randomFreq = iEngine->RandomNumber(1, 4); |
|
184 } |
|
185 if(randomFreq == 1 || CompareIgnoreCase(elemContent, KDaily) == 0 ) |
|
186 parameters->iRecurrentFrequency = TCalRRule::EDaily; |
|
187 else if( randomFreq == 2 || CompareIgnoreCase(elemContent, KWeekly) == 0 ) |
|
188 parameters->iRecurrentFrequency = TCalRRule::EWeekly; |
|
189 else if( randomFreq == 3 || CompareIgnoreCase(elemContent, KMonthly) == 0 ) |
|
190 parameters->iRecurrentFrequency = TCalRRule::EMonthly; |
|
191 else if( randomFreq == 4 || CompareIgnoreCase(elemContent, KYearly) == 0 ) |
|
192 parameters->iRecurrentFrequency = TCalRRule::EYearly; |
|
193 else |
|
194 parameters->iRecurrentFrequency = TCalRRule::EInvalid; |
|
195 } |
|
196 else if( elemName == KRecurrentInterval ) |
|
197 { |
|
198 if( randomAttr || elemContent.Length() == 0 ) |
|
199 { |
|
200 parameters->iRecurrentInterval = iEngine->RandomNumber(1,7); |
|
201 } |
|
202 else |
|
203 { |
|
204 parameters->iRecurrentInterval = ConvertStrToIntL(elemContent); |
|
205 } |
|
206 } |
|
207 else if( elemName == KRecurrentFrom ) |
|
208 { |
|
209 if( randomAttr || elemContent.Length() == 0 ) |
|
210 { |
|
211 if( startResolved ) |
|
212 { |
|
213 // Let's use the start time if it's resolved. |
|
214 parameters->iRecurrentStartTime = parameters->iStartTime; |
|
215 } |
|
216 else |
|
217 { |
|
218 parameters->iRecurrentStartTime = iEngine->RandomDate(CCreatorEngine::EDateFuture); |
|
219 } |
|
220 } |
|
221 else |
|
222 { |
|
223 parameters->iRecurrentStartTime = ConvertToDateTimeL(elemContent); |
|
224 } |
|
225 } |
|
226 else if( elemName == KRecurrentTo ) |
|
227 { |
|
228 if( randomAttr || elemContent.Length() == 0 ) |
|
229 { |
|
230 parameters->iRepeatingCount = iEngine->RandomNumber(1, 6); |
|
231 //parameters->iRecurrentEndTime = iEngine->RandomDate(CCreatorEngine::EDateFuture); |
|
232 } |
|
233 else |
|
234 { |
|
235 parameters->iRecurrentEndTime = ConvertToDateTimeL(elemContent); |
|
236 } |
|
237 } |
|
238 else if( elemName == KRepeatingCount ) |
|
239 { |
|
240 if( randomAttr || elemContent.Length() == 0 ) |
|
241 { |
|
242 parameters->iRepeatingCount = iEngine->RandomNumber(1, 52); |
|
243 } |
|
244 else |
|
245 { |
|
246 parameters->iRepeatingCount = ConvertStrToIntL(elemContent); |
|
247 } |
|
248 } |
|
249 else if( elemName == KAlarmtime ) |
|
250 { |
|
251 if( randomAttr || elemContent.Length() == 0 ) |
|
252 { |
|
253 parameters->iUseRandomAlarmTime = ETrue; |
|
254 } |
|
255 else |
|
256 { |
|
257 parameters->iAlarmTime = ConvertToDateTimeL(elemContent); |
|
258 } |
|
259 } |
|
260 else if( elemName == KOrganizername ) |
|
261 { |
|
262 delete parameters->iOrganizerName; |
|
263 parameters->iOrganizerName = 0; |
|
264 if( randomAttr || elemContent.Length() == 0 ) |
|
265 { |
|
266 TPtrC name = iEngine->RandomString (CCreatorEngine::EFirstName ); |
|
267 parameters->iOrganizerName = HBufC::NewL(name.Length()); |
|
268 parameters->iOrganizerName->Des().Copy(name); |
|
269 } |
|
270 else |
|
271 { |
|
272 parameters->iOrganizerName = HBufC::NewL(elemContent.Length()); |
|
273 parameters->iOrganizerName->Des().Copy(elemContent); |
|
274 } |
|
275 } |
|
276 else if( elemName == KOrganizeremail ) |
|
277 { |
|
278 delete parameters->iOrganizerEmail; |
|
279 parameters->iOrganizerEmail = 0; |
|
280 if( randomAttr || elemContent.Length() == 0 ) |
|
281 { |
|
282 TDesC* email = iEngine->CreateEmailAddressLC(); |
|
283 parameters->iOrganizerEmail = (HBufC*) email; |
|
284 CleanupStack::Pop(); // email |
|
285 } |
|
286 else |
|
287 { |
|
288 parameters->iOrganizerEmail = HBufC::NewL(elemContent.Length()); |
|
289 parameters->iOrganizerEmail->Des().Copy(elemContent); |
|
290 } |
|
291 } |
|
292 else if( elemName == KStatus ) |
|
293 { |
|
294 if( randomAttr || elemContent.Length() == 0 ) |
|
295 { |
|
296 if( aType == ETodo ) |
|
297 { |
|
298 parameters->iStatus = (CCalEntry::TStatus) iEngine->RandomNumber(CCalEntry::ETodoNeedsAction, CCalEntry::ETodoInProcess); |
|
299 } |
|
300 else |
|
301 { |
|
302 parameters->iStatus = (CCalEntry::TStatus) iEngine->RandomNumber(CCalEntry::ETentative, CCalEntry::ECancelled); |
|
303 } |
|
304 } |
|
305 else if( CompareIgnoreCase(elemContent, KCalStatusTentative) == 0 ) |
|
306 { |
|
307 parameters->iStatus = CCalEntry::ETentative; |
|
308 } |
|
309 else if( CompareIgnoreCase(elemContent, KCalStatusConfirmed) == 0 ) |
|
310 { |
|
311 parameters->iStatus = CCalEntry::EConfirmed; |
|
312 } |
|
313 else if( CompareIgnoreCase(elemContent, KCalStatusCancelled) == 0 ) |
|
314 { |
|
315 parameters->iStatus = CCalEntry::ECancelled; |
|
316 } |
|
317 else if( CompareIgnoreCase(elemContent, KCalStatusNeedsAction) == 0 ) |
|
318 { |
|
319 parameters->iStatus = CCalEntry::ETodoNeedsAction; |
|
320 } |
|
321 else if( CompareIgnoreCase(elemContent, KCalStatusCompleted) == 0 ) |
|
322 { |
|
323 parameters->iStatus = CCalEntry::ETodoCompleted; |
|
324 } |
|
325 else if( CompareIgnoreCase(elemContent, KCalStatusInProcess) == 0 ) |
|
326 { |
|
327 parameters->iStatus = CCalEntry::ETodoInProcess; |
|
328 } |
|
329 else |
|
330 { |
|
331 parameters->iStatus = CCalEntry::ENullStatus; |
|
332 } |
|
333 } |
|
334 else if( elemName == KPriority ) |
|
335 { |
|
336 if( randomAttr || elemContent.Length() == 0 ) |
|
337 { |
|
338 parameters->iTodoPriority = iEngine->RandomNumber(1,3); |
|
339 } |
|
340 else if( CompareIgnoreCase(elemContent, KPriorityHigh) == 0) |
|
341 { |
|
342 parameters->iTodoPriority = 1; |
|
343 } |
|
344 else if( CompareIgnoreCase(elemContent, KPriorityMedium) == 0) |
|
345 { |
|
346 parameters->iTodoPriority = 2; |
|
347 } |
|
348 else if( CompareIgnoreCase(elemContent, KPriorityLow) == 0 ) |
|
349 { |
|
350 parameters->iTodoPriority = 3; |
|
351 } |
|
352 else |
|
353 { |
|
354 parameters->iTodoPriority = ConvertStrToIntL(elemContent); |
|
355 } |
|
356 } |
|
357 else if( elemName == KAttendees ) |
|
358 { |
|
359 const RPointerArray<CCreatorScriptElement>& attendeesSubElems = fields[i]->SubElements(); |
|
360 for( TInt j = 0; j < attendeesSubElems.Count(); ++j ) |
|
361 { |
|
362 TPtrC eName = attendeesSubElems[j]->Name(); |
|
363 TPtrC eContent = attendeesSubElems[j]->Content(); |
|
364 if( eName == KContactSetRef ) |
|
365 { |
|
366 AppendContactSetReferenceL(*attendeesSubElems[j], parameters->iAttendeeLinkIds); |
|
367 } |
|
368 else if( eName == KAttendee ) |
|
369 { |
|
370 CCreatorCalenderAttendee* calAtt = CCreatorCalenderAttendee::NewL(); |
|
371 CleanupStack::PushL(calAtt); |
|
372 const RPointerArray<CCreatorScriptElement>& attendeeFields = attendeesSubElems[j]->SubElements(); |
|
373 // Make sure that at least email is given: |
|
374 if(attendeeFields.Count() == 0 ) |
|
375 { |
|
376 CCreatorScriptElement* emailField = CCreatorScriptElement::NewL(iEngine, KEmail ); |
|
377 CleanupStack::PushL(emailField); |
|
378 fields[i]->SubElements().AppendL(emailField); |
|
379 CleanupStack::Pop(); // emailField |
|
380 } |
|
381 for( TInt k = 0; k < attendeeFields.Count(); ++k ) |
|
382 { |
|
383 const CCreatorScriptAttribute* randomAttr = attendeeFields[k]->FindAttributeByName(KRandomLength); |
|
384 TPtrC attElemName = attendeeFields[k]->Name(); |
|
385 TPtrC attElemCont = attendeeFields[k]->Content(); |
|
386 if( attElemName == KCommonname ) |
|
387 { |
|
388 if( randomAttr || attElemCont.Length() == 0) |
|
389 { |
|
390 // Random data: |
|
391 calAtt->SetCommonNameL(iEngine->RandomString(CCreatorEngine::EFirstName)); |
|
392 } |
|
393 else |
|
394 { |
|
395 calAtt->SetCommonNameL(attElemCont); |
|
396 } |
|
397 } |
|
398 else if( attElemName == KEmail ) |
|
399 { |
|
400 if( randomAttr || attElemCont.Length() == 0) |
|
401 { |
|
402 // Random data: |
|
403 TDesC* email = iEngine->CreateEmailAddressLC(); |
|
404 calAtt->SetEmailAddressL(*email); |
|
405 CleanupStack::PopAndDestroy(); // email |
|
406 } |
|
407 else |
|
408 { |
|
409 calAtt->SetEmailAddressL(attElemCont); |
|
410 } |
|
411 } |
|
412 else if( attElemName == KRole ) |
|
413 { |
|
414 if( randomAttr || attElemCont.Length() == 0) |
|
415 { |
|
416 // Random role: |
|
417 CCalAttendee::TCalRole randomRole = |
|
418 (CCalAttendee::TCalRole) iEngine->RandomNumber( |
|
419 (TInt) CCalAttendee::EReqParticipant, |
|
420 (TInt) CCalAttendee::EChair); |
|
421 calAtt->SetRole(randomRole); |
|
422 } |
|
423 else if( CompareIgnoreCase(attElemCont, KRoleRequired) == 0 ) |
|
424 { |
|
425 calAtt->SetRole(CCalAttendee::EReqParticipant); |
|
426 } |
|
427 else if( CompareIgnoreCase(attElemCont, KRoleOptional) == 0 ) |
|
428 { |
|
429 calAtt->SetRole(CCalAttendee::EOptParticipant); |
|
430 } |
|
431 else if( CompareIgnoreCase(attElemCont, KRoleNonPart) == 0 ) |
|
432 { |
|
433 calAtt->SetRole(CCalAttendee::ENonParticipant); |
|
434 } |
|
435 else if( CompareIgnoreCase(attElemCont, KRoleChair) == 0 ) |
|
436 { |
|
437 calAtt->SetRole(CCalAttendee::EChair); |
|
438 } |
|
439 } |
|
440 else if( attElemName == KStatus ) |
|
441 { |
|
442 if( randomAttr || attElemCont.Length() == 0) |
|
443 { |
|
444 // Random role: |
|
445 CCalAttendee::TCalStatus randomStatus = |
|
446 (CCalAttendee::TCalStatus) iEngine->RandomNumber( |
|
447 (TInt) CCalAttendee::ENeedsAction, |
|
448 (TInt) CCalAttendee::EInProcess); |
|
449 calAtt->SetStatus(randomStatus); |
|
450 } |
|
451 else if( CompareIgnoreCase(attElemCont, KStatusNeedsAction) == 0 ) |
|
452 { |
|
453 calAtt->SetStatus(CCalAttendee::ENeedsAction); |
|
454 } |
|
455 else if( CompareIgnoreCase(attElemCont, KStatusAccepted) == 0 ) |
|
456 { |
|
457 calAtt->SetStatus(CCalAttendee::EAccepted); |
|
458 } |
|
459 else if( CompareIgnoreCase(attElemCont, KStatusTentative) == 0 ) |
|
460 { |
|
461 calAtt->SetStatus(CCalAttendee::ETentative); |
|
462 } |
|
463 else if( CompareIgnoreCase(attElemCont, KStatusConfirmed) == 0 ) |
|
464 { |
|
465 calAtt->SetStatus(CCalAttendee::EConfirmed); |
|
466 } |
|
467 else if( CompareIgnoreCase(attElemCont, KStatusDeclined) == 0 ) |
|
468 { |
|
469 calAtt->SetStatus(CCalAttendee::EDeclined); |
|
470 } |
|
471 else if( CompareIgnoreCase(attElemCont, KStatusCompleted) == 0 ) |
|
472 { |
|
473 calAtt->SetStatus(CCalAttendee::ECompleted); |
|
474 } |
|
475 else if( CompareIgnoreCase(attElemCont, KStatusDelegated) == 0 ) |
|
476 { |
|
477 calAtt->SetStatus(CCalAttendee::EDelegated); |
|
478 } |
|
479 else if( CompareIgnoreCase(attElemCont, KStatusInProcess) == 0 ) |
|
480 { |
|
481 calAtt->SetStatus(CCalAttendee::EInProcess); |
|
482 } |
|
483 } |
|
484 } |
|
485 parameters->iAttendees.AppendL(calAtt); |
|
486 CleanupStack::Pop(); // calAtt |
|
487 } |
|
488 } |
|
489 } |
|
490 } |
|
491 } |
|
492 |
|
493 void CCreatorCalendarElement::ExecuteCommandL() |
|
494 { |
|
495 LOGSTRING("Creator: CCreatorCalendarElement::ExecuteCommandL"); |
|
496 // Amount of calendar entries: |
|
497 const CCreatorScriptAttribute* calEntryAmountAttr = this->FindAttributeByName(KAmount); |
|
498 const CCreatorScriptAttribute* calEntryTypeAttr = this->FindAttributeByName(KType); |
|
499 TInt entryAmount = 1; |
|
500 if( calEntryAmountAttr ) |
|
501 { |
|
502 entryAmount = ConvertStrToIntL(calEntryAmountAttr->Value()); |
|
503 } |
|
504 if( calEntryTypeAttr == 0 ) |
|
505 { |
|
506 LOGSTRING("ERROR in CCreatorCalendarElement::ExecuteCommandL: Type attribute is missing."); |
|
507 User::Leave(KErrGeneral); // type is required attribute |
|
508 } |
|
509 |
|
510 // Find fields element: |
|
511 CCreatorScriptElement* fieldsElement = FindSubElement(KFields); |
|
512 |
|
513 for( TInt cI = 0; cI < entryAmount; ++cI ) |
|
514 { |
|
515 CCalenderInterimParameters* param = new (ELeave) CCalenderInterimParameters; |
|
516 CleanupStack::PushL(param); |
|
517 if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeAppointment) == 0 ) |
|
518 { |
|
519 if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) |
|
520 { |
|
521 FillEntryParamsL(EAppointment, fieldsElement->SubElements(), param); |
|
522 iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAppointments, param); |
|
523 } |
|
524 else |
|
525 { |
|
526 iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAppointments, 0, entryAmount); |
|
527 CleanupStack::PopAndDestroy(param); |
|
528 break; // We can step out from the for-loop, because the amount is given to engine. |
|
529 } |
|
530 } |
|
531 else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeEvent ) == 0 ) |
|
532 { |
|
533 if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) |
|
534 { |
|
535 FillEntryParamsL(EEvent, fieldsElement->SubElements(), param); |
|
536 iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryEvents, param); |
|
537 } |
|
538 else |
|
539 { |
|
540 iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryEvents, 0, entryAmount); |
|
541 CleanupStack::PopAndDestroy(param); |
|
542 break; // We can step out from the for-loop, because the amount is given to engine. |
|
543 } |
|
544 } |
|
545 else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeReminder ) == 0 ) |
|
546 { |
|
547 if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) |
|
548 { |
|
549 FillEntryParamsL(EReminder, fieldsElement->SubElements(), param); |
|
550 iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryReminders, param); |
|
551 } |
|
552 else |
|
553 { |
|
554 iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryReminders, 0, entryAmount); |
|
555 CleanupStack::PopAndDestroy(param); |
|
556 break; // We can step out from the for-loop, because the amount is given to engine. |
|
557 } |
|
558 } |
|
559 else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeAnniversary ) == 0 ) |
|
560 { |
|
561 if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) |
|
562 { |
|
563 FillEntryParamsL(EAnniversary, fieldsElement->SubElements(), param); |
|
564 iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAnniversaries, param); |
|
565 } |
|
566 else |
|
567 { |
|
568 iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAnniversaries, 0, entryAmount); |
|
569 CleanupStack::PopAndDestroy(param); |
|
570 break; // We can step out from the for-loop, because the amount is given to engine. |
|
571 } |
|
572 } |
|
573 else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeTodo ) == 0 ) |
|
574 { |
|
575 if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) |
|
576 { |
|
577 FillEntryParamsL(ETodo, fieldsElement->SubElements(), param); |
|
578 iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryToDos, param); |
|
579 } |
|
580 else |
|
581 { |
|
582 iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryToDos, 0, entryAmount); |
|
583 CleanupStack::PopAndDestroy(param); |
|
584 break; // We can step out from the for-loop, because the amount is given to engine. |
|
585 } |
|
586 } |
|
587 CleanupStack::Pop(); // param |
|
588 } |
|
589 } |
|
590 |
|
591 CCreatorCalendarElement::CCreatorCalendarElement(CCreatorEngine* aEngine) |
|
592 : |
|
593 CCreatorScriptElement(aEngine) |
|
594 { |
|
595 iIsCommandElement = ETrue; |
|
596 } |
|