|
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 } |
|
177 else if( elemName == KRecurrentFreq ) |
|
178 { |
|
179 TInt randomFreq = 0; |
|
180 if( randomAttr || elemContent.Length() == 0 ) |
|
181 { |
|
182 randomFreq = iEngine->RandomNumber(1, 4); |
|
183 } |
|
184 if(randomFreq == 1 || CompareIgnoreCase(elemContent, KDaily) == 0 ) |
|
185 parameters->iRecurrentFrequency = TCalRRule::EDaily; |
|
186 else if( randomFreq == 2 || CompareIgnoreCase(elemContent, KWeekly) == 0 ) |
|
187 parameters->iRecurrentFrequency = TCalRRule::EWeekly; |
|
188 else if( randomFreq == 3 || CompareIgnoreCase(elemContent, KMonthly) == 0 ) |
|
189 parameters->iRecurrentFrequency = TCalRRule::EMonthly; |
|
190 else if( randomFreq == 4 || CompareIgnoreCase(elemContent, KYearly) == 0 ) |
|
191 parameters->iRecurrentFrequency = TCalRRule::EYearly; |
|
192 else |
|
193 parameters->iRecurrentFrequency = TCalRRule::EInvalid; |
|
194 } |
|
195 else if( elemName == KRecurrentInterval ) |
|
196 { |
|
197 if( randomAttr || elemContent.Length() == 0 ) |
|
198 { |
|
199 parameters->iRecurrentInterval = iEngine->RandomNumber(1,7); |
|
200 } |
|
201 else |
|
202 { |
|
203 parameters->iRecurrentInterval = ConvertStrToIntL(elemContent); |
|
204 } |
|
205 } |
|
206 else if( elemName == KRecurrentFrom ) |
|
207 { |
|
208 if( randomAttr || elemContent.Length() == 0 ) |
|
209 { |
|
210 if( startResolved ) |
|
211 { |
|
212 // Let's use the start time if it's resolved. |
|
213 parameters->iRecurrentStartTime = parameters->iStartTime; |
|
214 } |
|
215 else |
|
216 { |
|
217 parameters->iRecurrentStartTime = iEngine->RandomDate(CCreatorEngine::EDateFuture); |
|
218 } |
|
219 } |
|
220 else |
|
221 { |
|
222 parameters->iRecurrentStartTime = ConvertToDateTimeL(elemContent); |
|
223 } |
|
224 } |
|
225 else if( elemName == KRecurrentTo ) |
|
226 { |
|
227 if( randomAttr || elemContent.Length() == 0 ) |
|
228 { |
|
229 parameters->iRepeatingCount = iEngine->RandomNumber(1, 6); |
|
230 //parameters->iRecurrentEndTime = iEngine->RandomDate(CCreatorEngine::EDateFuture); |
|
231 } |
|
232 else |
|
233 { |
|
234 parameters->iRecurrentEndTime = ConvertToDateTimeL(elemContent); |
|
235 } |
|
236 } |
|
237 else if( elemName == KRepeatingCount ) |
|
238 { |
|
239 if( randomAttr || elemContent.Length() == 0 ) |
|
240 { |
|
241 parameters->iRepeatingCount = iEngine->RandomNumber(1, 52); |
|
242 } |
|
243 else |
|
244 { |
|
245 parameters->iRepeatingCount = ConvertStrToIntL(elemContent); |
|
246 } |
|
247 } |
|
248 else if( elemName == KAlarmtime ) |
|
249 { |
|
250 if( randomAttr || elemContent.Length() == 0 ) |
|
251 { |
|
252 parameters->iUseRandomAlarmTime = ETrue; |
|
253 } |
|
254 else |
|
255 { |
|
256 parameters->iAlarmTime = ConvertToDateTimeL(elemContent); |
|
257 } |
|
258 } |
|
259 else if( elemName == KOrganizername ) |
|
260 { |
|
261 delete parameters->iOrganizerName; |
|
262 parameters->iOrganizerName = 0; |
|
263 if( randomAttr || elemContent.Length() == 0 ) |
|
264 { |
|
265 TPtrC name = iEngine->RandomString (CCreatorEngine::EFirstName ); |
|
266 parameters->iOrganizerName = HBufC::NewL(name.Length()); |
|
267 parameters->iOrganizerName->Des().Copy(name); |
|
268 } |
|
269 else |
|
270 { |
|
271 parameters->iOrganizerName = HBufC::NewL(elemContent.Length()); |
|
272 parameters->iOrganizerName->Des().Copy(elemContent); |
|
273 } |
|
274 } |
|
275 else if( elemName == KOrganizeremail ) |
|
276 { |
|
277 delete parameters->iOrganizerEmail; |
|
278 parameters->iOrganizerEmail = 0; |
|
279 if( randomAttr || elemContent.Length() == 0 ) |
|
280 { |
|
281 TDesC* email = iEngine->CreateEmailAddressLC(); |
|
282 parameters->iOrganizerEmail = (HBufC*) email; |
|
283 CleanupStack::Pop(); // email |
|
284 } |
|
285 else |
|
286 { |
|
287 parameters->iOrganizerEmail = HBufC::NewL(elemContent.Length()); |
|
288 parameters->iOrganizerEmail->Des().Copy(elemContent); |
|
289 } |
|
290 } |
|
291 else if( elemName == KStatus ) |
|
292 { |
|
293 if( randomAttr || elemContent.Length() == 0 ) |
|
294 { |
|
295 if( aType == ETodo ) |
|
296 { |
|
297 parameters->iStatus = (CCalEntry::TStatus) iEngine->RandomNumber(CCalEntry::ETodoNeedsAction, CCalEntry::ETodoInProcess); |
|
298 } |
|
299 else |
|
300 { |
|
301 parameters->iStatus = (CCalEntry::TStatus) iEngine->RandomNumber(CCalEntry::ETentative, CCalEntry::ECancelled); |
|
302 } |
|
303 } |
|
304 else if( CompareIgnoreCase(elemContent, KCalStatusTentative) == 0 ) |
|
305 { |
|
306 parameters->iStatus = CCalEntry::ETentative; |
|
307 } |
|
308 else if( CompareIgnoreCase(elemContent, KCalStatusConfirmed) == 0 ) |
|
309 { |
|
310 parameters->iStatus = CCalEntry::EConfirmed; |
|
311 } |
|
312 else if( CompareIgnoreCase(elemContent, KCalStatusCancelled) == 0 ) |
|
313 { |
|
314 parameters->iStatus = CCalEntry::ECancelled; |
|
315 } |
|
316 else if( CompareIgnoreCase(elemContent, KCalStatusNeedsAction) == 0 ) |
|
317 { |
|
318 parameters->iStatus = CCalEntry::ETodoNeedsAction; |
|
319 } |
|
320 else if( CompareIgnoreCase(elemContent, KCalStatusCompleted) == 0 ) |
|
321 { |
|
322 parameters->iStatus = CCalEntry::ETodoCompleted; |
|
323 } |
|
324 else if( CompareIgnoreCase(elemContent, KCalStatusInProcess) == 0 ) |
|
325 { |
|
326 parameters->iStatus = CCalEntry::ETodoInProcess; |
|
327 } |
|
328 else |
|
329 { |
|
330 parameters->iStatus = CCalEntry::ENullStatus; |
|
331 } |
|
332 } |
|
333 else if( elemName == KPriority ) |
|
334 { |
|
335 if( randomAttr || elemContent.Length() == 0 ) |
|
336 { |
|
337 parameters->iTodoPriority = iEngine->RandomNumber(1,3); |
|
338 } |
|
339 else if( CompareIgnoreCase(elemContent, KPriorityHigh) == 0) |
|
340 { |
|
341 parameters->iTodoPriority = 1; |
|
342 } |
|
343 else if( CompareIgnoreCase(elemContent, KPriorityMedium) == 0) |
|
344 { |
|
345 parameters->iTodoPriority = 2; |
|
346 } |
|
347 else if( CompareIgnoreCase(elemContent, KPriorityLow) == 0 ) |
|
348 { |
|
349 parameters->iTodoPriority = 3; |
|
350 } |
|
351 else |
|
352 { |
|
353 parameters->iTodoPriority = ConvertStrToIntL(elemContent); |
|
354 } |
|
355 } |
|
356 else if( elemName == KAttendees ) |
|
357 { |
|
358 const RPointerArray<CCreatorScriptElement>& attendeesSubElems = fields[i]->SubElements(); |
|
359 for( TInt j = 0; j < attendeesSubElems.Count(); ++j ) |
|
360 { |
|
361 TPtrC eName = attendeesSubElems[j]->Name(); |
|
362 TPtrC eContent = attendeesSubElems[j]->Content(); |
|
363 if( eName == KContactSetRef ) |
|
364 { |
|
365 AppendContactSetReferenceL(*attendeesSubElems[j], parameters->iAttendeeLinkIds); |
|
366 } |
|
367 else if( eName == KAttendee ) |
|
368 { |
|
369 CCreatorCalenderAttendee* calAtt = CCreatorCalenderAttendee::NewL(); |
|
370 CleanupStack::PushL(calAtt); |
|
371 const RPointerArray<CCreatorScriptElement>& attendeeFields = attendeesSubElems[j]->SubElements(); |
|
372 // Make sure that at least email is given: |
|
373 if(attendeeFields.Count() == 0 ) |
|
374 { |
|
375 CCreatorScriptElement* emailField = CCreatorScriptElement::NewL(iEngine, KEmail ); |
|
376 CleanupStack::PushL(emailField); |
|
377 fields[i]->SubElements().AppendL(emailField); |
|
378 CleanupStack::Pop(); // emailField |
|
379 } |
|
380 for( TInt k = 0; k < attendeeFields.Count(); ++k ) |
|
381 { |
|
382 const CCreatorScriptAttribute* randomAttr = attendeeFields[k]->FindAttributeByName(KRandomLength); |
|
383 TPtrC attElemName = attendeeFields[k]->Name(); |
|
384 TPtrC attElemCont = attendeeFields[k]->Content(); |
|
385 if( attElemName == KCommonname ) |
|
386 { |
|
387 if( randomAttr || attElemCont.Length() == 0) |
|
388 { |
|
389 // Random data: |
|
390 calAtt->SetCommonNameL(iEngine->RandomString(CCreatorEngine::EFirstName)); |
|
391 } |
|
392 else |
|
393 { |
|
394 calAtt->SetCommonNameL(attElemCont); |
|
395 } |
|
396 } |
|
397 else if( attElemName == KEmail ) |
|
398 { |
|
399 if( randomAttr || attElemCont.Length() == 0) |
|
400 { |
|
401 // Random data: |
|
402 TDesC* email = iEngine->CreateEmailAddressLC(); |
|
403 calAtt->SetEmailAddressL(*email); |
|
404 CleanupStack::PopAndDestroy(); // email |
|
405 } |
|
406 else |
|
407 { |
|
408 calAtt->SetEmailAddressL(attElemCont); |
|
409 } |
|
410 } |
|
411 else if( attElemName == KRole ) |
|
412 { |
|
413 if( randomAttr || attElemCont.Length() == 0) |
|
414 { |
|
415 // Random role: |
|
416 CCalAttendee::TCalRole randomRole = |
|
417 (CCalAttendee::TCalRole) iEngine->RandomNumber( |
|
418 (TInt) CCalAttendee::EReqParticipant, |
|
419 (TInt) CCalAttendee::EChair); |
|
420 calAtt->SetRole(randomRole); |
|
421 } |
|
422 else if( CompareIgnoreCase(attElemCont, KRoleRequired) == 0 ) |
|
423 { |
|
424 calAtt->SetRole(CCalAttendee::EReqParticipant); |
|
425 } |
|
426 else if( CompareIgnoreCase(attElemCont, KRoleOptional) == 0 ) |
|
427 { |
|
428 calAtt->SetRole(CCalAttendee::EOptParticipant); |
|
429 } |
|
430 else if( CompareIgnoreCase(attElemCont, KRoleNonPart) == 0 ) |
|
431 { |
|
432 calAtt->SetRole(CCalAttendee::ENonParticipant); |
|
433 } |
|
434 else if( CompareIgnoreCase(attElemCont, KRoleChair) == 0 ) |
|
435 { |
|
436 calAtt->SetRole(CCalAttendee::EChair); |
|
437 } |
|
438 } |
|
439 else if( attElemName == KStatus ) |
|
440 { |
|
441 if( randomAttr || attElemCont.Length() == 0) |
|
442 { |
|
443 // Random role: |
|
444 CCalAttendee::TCalStatus randomStatus = |
|
445 (CCalAttendee::TCalStatus) iEngine->RandomNumber( |
|
446 (TInt) CCalAttendee::ENeedsAction, |
|
447 (TInt) CCalAttendee::EInProcess); |
|
448 calAtt->SetStatus(randomStatus); |
|
449 } |
|
450 else if( CompareIgnoreCase(attElemCont, KStatusNeedsAction) == 0 ) |
|
451 { |
|
452 calAtt->SetStatus(CCalAttendee::ENeedsAction); |
|
453 } |
|
454 else if( CompareIgnoreCase(attElemCont, KStatusAccepted) == 0 ) |
|
455 { |
|
456 calAtt->SetStatus(CCalAttendee::EAccepted); |
|
457 } |
|
458 else if( CompareIgnoreCase(attElemCont, KStatusTentative) == 0 ) |
|
459 { |
|
460 calAtt->SetStatus(CCalAttendee::ETentative); |
|
461 } |
|
462 else if( CompareIgnoreCase(attElemCont, KStatusConfirmed) == 0 ) |
|
463 { |
|
464 calAtt->SetStatus(CCalAttendee::EConfirmed); |
|
465 } |
|
466 else if( CompareIgnoreCase(attElemCont, KStatusDeclined) == 0 ) |
|
467 { |
|
468 calAtt->SetStatus(CCalAttendee::EDeclined); |
|
469 } |
|
470 else if( CompareIgnoreCase(attElemCont, KStatusCompleted) == 0 ) |
|
471 { |
|
472 calAtt->SetStatus(CCalAttendee::ECompleted); |
|
473 } |
|
474 else if( CompareIgnoreCase(attElemCont, KStatusDelegated) == 0 ) |
|
475 { |
|
476 calAtt->SetStatus(CCalAttendee::EDelegated); |
|
477 } |
|
478 else if( CompareIgnoreCase(attElemCont, KStatusInProcess) == 0 ) |
|
479 { |
|
480 calAtt->SetStatus(CCalAttendee::EInProcess); |
|
481 } |
|
482 } |
|
483 } |
|
484 parameters->iAttendees.AppendL(calAtt); |
|
485 CleanupStack::Pop(); // calAtt |
|
486 } |
|
487 } |
|
488 } |
|
489 } |
|
490 } |
|
491 |
|
492 void CCreatorCalendarElement::ExecuteCommandL() |
|
493 { |
|
494 LOGSTRING("Creator: CCreatorCalendarElement::ExecuteCommandL"); |
|
495 // Amount of calendar entries: |
|
496 const CCreatorScriptAttribute* calEntryAmountAttr = this->FindAttributeByName(KAmount); |
|
497 const CCreatorScriptAttribute* calEntryTypeAttr = this->FindAttributeByName(KType); |
|
498 TInt entryAmount = 1; |
|
499 if( calEntryAmountAttr ) |
|
500 { |
|
501 entryAmount = ConvertStrToIntL(calEntryAmountAttr->Value()); |
|
502 } |
|
503 if( calEntryTypeAttr == 0 ) |
|
504 { |
|
505 LOGSTRING("ERROR in CCreatorCalendarElement::ExecuteCommandL: Type attribute is missing."); |
|
506 User::Leave(KErrGeneral); // type is required attribute |
|
507 } |
|
508 |
|
509 // Find fields element: |
|
510 CCreatorScriptElement* fieldsElement = FindSubElement(KFields); |
|
511 |
|
512 for( TInt cI = 0; cI < entryAmount; ++cI ) |
|
513 { |
|
514 CCalenderInterimParameters* param = new (ELeave) CCalenderInterimParameters; |
|
515 CleanupStack::PushL(param); |
|
516 if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeAppointment) == 0 ) |
|
517 { |
|
518 if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) |
|
519 { |
|
520 FillEntryParamsL(EAppointment, fieldsElement->SubElements(), param); |
|
521 iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAppointments, param); |
|
522 } |
|
523 else |
|
524 { |
|
525 iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAppointments, 0, entryAmount); |
|
526 CleanupStack::PopAndDestroy(param); |
|
527 break; // We can step out from the for-loop, because the amount is given to engine. |
|
528 } |
|
529 } |
|
530 else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeEvent ) == 0 ) |
|
531 { |
|
532 if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) |
|
533 { |
|
534 FillEntryParamsL(EEvent, fieldsElement->SubElements(), param); |
|
535 iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryEvents, param); |
|
536 } |
|
537 else |
|
538 { |
|
539 iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryEvents, 0, entryAmount); |
|
540 CleanupStack::PopAndDestroy(param); |
|
541 break; // We can step out from the for-loop, because the amount is given to engine. |
|
542 } |
|
543 } |
|
544 else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeReminder ) == 0 ) |
|
545 { |
|
546 if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) |
|
547 { |
|
548 FillEntryParamsL(EReminder, fieldsElement->SubElements(), param); |
|
549 iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryReminders, param); |
|
550 } |
|
551 else |
|
552 { |
|
553 iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryReminders, 0, entryAmount); |
|
554 CleanupStack::PopAndDestroy(param); |
|
555 break; // We can step out from the for-loop, because the amount is given to engine. |
|
556 } |
|
557 } |
|
558 else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeAnniversary ) == 0 ) |
|
559 { |
|
560 if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) |
|
561 { |
|
562 FillEntryParamsL(EAnniversary, fieldsElement->SubElements(), param); |
|
563 iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAnniversaries, param); |
|
564 } |
|
565 else |
|
566 { |
|
567 iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAnniversaries, 0, entryAmount); |
|
568 CleanupStack::PopAndDestroy(param); |
|
569 break; // We can step out from the for-loop, because the amount is given to engine. |
|
570 } |
|
571 } |
|
572 else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeTodo ) == 0 ) |
|
573 { |
|
574 if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) |
|
575 { |
|
576 FillEntryParamsL(ETodo, fieldsElement->SubElements(), param); |
|
577 iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryToDos, param); |
|
578 } |
|
579 else |
|
580 { |
|
581 iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryToDos, 0, entryAmount); |
|
582 CleanupStack::PopAndDestroy(param); |
|
583 break; // We can step out from the for-loop, because the amount is given to engine. |
|
584 } |
|
585 } |
|
586 CleanupStack::Pop(); // param |
|
587 } |
|
588 } |
|
589 |
|
590 CCreatorCalendarElement::CCreatorCalendarElement(CCreatorEngine* aEngine) |
|
591 : |
|
592 CCreatorScriptElement(aEngine) |
|
593 { |
|
594 iIsCommandElement = ETrue; |
|
595 } |