|
1 /* |
|
2 * Copyright (c) 2002 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 the License "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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <e32svr.h> |
|
23 #include <StifParser.h> |
|
24 #include <Stiftestinterface.h> |
|
25 |
|
26 #include "calendarheader.h" |
|
27 #include "calendarservice.h" |
|
28 #include "entryattributes.h" |
|
29 #include <caluser.h> |
|
30 #include <calalarm.h> |
|
31 |
|
32 #include "tcalendarupdatetest.h" |
|
33 #include "teststartconsolealarmserver.h" |
|
34 //#include "calendarconstants.h" |
|
35 // ============================ MEMBER FUNCTIONS =============================== |
|
36 |
|
37 // ----------------------------------------------------------------------------- |
|
38 // CTChangeStatusTest::Delete |
|
39 // Delete here all resources allocated and opened from test methods. |
|
40 // Called from destructor. |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 void CTCalendarUpdateTest::Delete() |
|
44 { |
|
45 |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CTChangeStatusTest::RunMethodL |
|
50 // Run specified method. Contains also table of test mothods and their names. |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 TInt CTCalendarUpdateTest::RunMethodL( |
|
54 CStifItemParser& aItem ) |
|
55 { |
|
56 |
|
57 static TStifFunctionInfo const KFunctions[] = |
|
58 { |
|
59 // Copy this line for every implemented function. |
|
60 // First string is the function name used in TestScripter script file. |
|
61 // Second is the actual implementation member function. |
|
62 |
|
63 ENTRY( "UpdateAppointmentEntry", CTCalendarUpdateTest::UpdateAppointmentEntryL), |
|
64 ENTRY( "UpdateTodoEntry", CTCalendarUpdateTest::UpdateTodoEntryL), |
|
65 ENTRY( "UpdateAnniversary", CTCalendarUpdateTest::UpdateAnniversaryL), |
|
66 ENTRY( "UpdateDayEvent", CTCalendarUpdateTest::UpdateDayEventL), |
|
67 ENTRY( "UpdateReminder", CTCalendarUpdateTest::UpdateReminderL), |
|
68 ENTRY( "UpdateAppointmentEntryWithNewTime", CTCalendarUpdateTest::UpdateAppointmentEntryWithNewTimeL), |
|
69 ENTRY( "UpdateAppointmentEntryWithNewAttendees", CTCalendarUpdateTest::UpdateAppointmentEntryWithNewAttendeesL), |
|
70 ENTRY( "UpdateAppointmentEntryWithNewRepeat", CTCalendarUpdateTest::UpdateAppointmentEntryWithNewRepeatL), |
|
71 //ENTRY( "UpdateAppointmentEntryWithNewTimeAndAttendees", CTCalendarUpdateTest::UpdateAppointmentEntryWithNewTimeAndAttendeesL), |
|
72 }; |
|
73 |
|
74 const TInt count = sizeof( KFunctions ) / |
|
75 sizeof( TStifFunctionInfo ); |
|
76 |
|
77 return RunInternalL( KFunctions, count, aItem ); |
|
78 |
|
79 } |
|
80 |
|
81 /* |
|
82 1. Change location, attendees, phone owner |
|
83 2. Change start time of meeting - have to update alarm accordingly |
|
84 3. Create a repeating entry |
|
85 4. Create a repeating modifying entry |
|
86 5. Modify the entire repeat sequence |
|
87 6. Change alarm for parent and child |
|
88 7. Set repeat and exeption dates |
|
89 */ |
|
90 _LIT(KTestCal1File ,"C:updatecalfile1"); |
|
91 _LIT(KTestCal2File ,"C:updatecalfile2"); |
|
92 _LIT(KString1 ,"New reminder"); |
|
93 |
|
94 |
|
95 TInt CTCalendarUpdateTest::UpdateAppointmentEntryL(CStifItemParser &aItem ) |
|
96 { |
|
97 |
|
98 |
|
99 TInt result = KErrNone; |
|
100 |
|
101 __UHEAP_MARK; |
|
102 |
|
103 CCalendarService* service = CCalendarService::NewL(); |
|
104 |
|
105 RemoveCalendarFile( service, KTestCal1File ); |
|
106 AddCalendarFile( service, KTestCal1File ); |
|
107 |
|
108 RPointerArray<TUIDSet> arruids(5); |
|
109 |
|
110 TUIDSet* uids = NULL; |
|
111 |
|
112 if(AddAppointmentWithAttendees(service, KTestCal1File, uids) == KErrNone && uids) |
|
113 { |
|
114 arruids.Append(uids); |
|
115 uids = NULL; |
|
116 } |
|
117 |
|
118 if ( arruids.Count() > 0 ) |
|
119 { |
|
120 RPointerArray<CCalEntry> entryArray; |
|
121 |
|
122 CEntryAttributes* entryObj = CEntryAttributes::NewL(); |
|
123 |
|
124 TTime stTime(TDateTime(2007, EAugust, 8, 11, 0, 0, 0)); |
|
125 entryObj->SetStartTimeL(stTime); |
|
126 |
|
127 TTime endTime(TDateTime(2007, EAugust, 8, 12, 0, 0, 0)); |
|
128 entryObj->SetEndTimeL(endTime); |
|
129 |
|
130 |
|
131 CCalAlarm* alarm = CCalAlarm::NewL(); |
|
132 TTime alarmTime(TDateTime(2007,EAugust, 8, 10, 30, 0, 0)); |
|
133 entryObj->SetAlarm(alarmTime); |
|
134 delete alarm; |
|
135 |
|
136 service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
137 |
|
138 if( entryArray.Count() == 1 ) |
|
139 { |
|
140 entryObj->SetLocalUid( arruids[0]->iLocalUID ); |
|
141 } |
|
142 |
|
143 TUIDSet* newuids = NULL; |
|
144 entryArray.ResetAndDestroy(); |
|
145 TRAPD( err, service->AddL(KTestCal1File,entryObj,newuids) ); |
|
146 delete newuids; |
|
147 if ( err == KErrNone ) |
|
148 { |
|
149 service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
150 if( entryArray.Count() == 1 ) |
|
151 { |
|
152 CCalAlarm* entryalarm = entryArray[0]->AlarmL(); |
|
153 if( !(entryArray[0]->StartTimeL().TimeUtcL() == stTime && |
|
154 entryArray[0]->EndTimeL().TimeUtcL() == endTime && |
|
155 entryalarm->TimeOffset() == TTimeIntervalMinutes(30) )) |
|
156 { |
|
157 result = KErrGeneral; |
|
158 delete entryalarm; |
|
159 } |
|
160 else |
|
161 delete entryalarm; |
|
162 } |
|
163 } |
|
164 else |
|
165 { |
|
166 result = KErrGeneral; |
|
167 } |
|
168 entryArray.ResetAndDestroy(); |
|
169 arruids.ResetAndDestroy(); |
|
170 delete entryObj; |
|
171 } |
|
172 else |
|
173 result = KErrGeneral; |
|
174 |
|
175 RemoveCalendarFile( service, KTestCal1File ); |
|
176 |
|
177 delete service; |
|
178 |
|
179 __UHEAP_MARKEND; |
|
180 |
|
181 return result; |
|
182 |
|
183 } |
|
184 |
|
185 TInt CTCalendarUpdateTest::UpdateTodoEntryL(CStifItemParser &aItem ) |
|
186 { |
|
187 |
|
188 TInt result = KErrNone; |
|
189 |
|
190 __UHEAP_MARK; |
|
191 |
|
192 CCalendarService* service = CCalendarService::NewL(); |
|
193 |
|
194 RemoveCalendarFile( service, KTestCal1File ); |
|
195 AddCalendarFile( service, KTestCal1File ); |
|
196 |
|
197 RPointerArray<TUIDSet> arruids(5); |
|
198 |
|
199 TUIDSet* uids = NULL; |
|
200 |
|
201 if(AddToDo(service, KTestCal1File, uids) == KErrNone && uids) |
|
202 { |
|
203 arruids.Append(uids); |
|
204 uids = NULL; |
|
205 } |
|
206 |
|
207 if ( arruids.Count() > 0 ) |
|
208 { |
|
209 RPointerArray<CCalEntry> entryArray; |
|
210 |
|
211 CEntryAttributes* entryObj = CEntryAttributes::NewL(); |
|
212 |
|
213 TTime endTime(TDateTime(2007, EAugust, 22, 0, 0, 0, 0)); |
|
214 entryObj->SetEndTimeL(endTime); |
|
215 |
|
216 service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
217 |
|
218 if( entryArray.Count() == 1 ) |
|
219 { |
|
220 entryObj->SetLocalUid( arruids[0]->iLocalUID ); |
|
221 } |
|
222 |
|
223 TCalLocalUid modifiedEntryId; |
|
224 TUIDSet* entryUids = NULL; |
|
225 TRAPD( err, service->AddL(KTestCal1File,entryObj,entryUids) ); |
|
226 delete entryUids; |
|
227 entryArray.ResetAndDestroy(); |
|
228 if ( err == KErrNone ) |
|
229 { |
|
230 service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
231 if( entryArray.Count() == 1 ) |
|
232 { |
|
233 if( !(entryArray[0]->EndTimeL().TimeUtcL() == endTime )) |
|
234 { |
|
235 result = KErrGeneral; |
|
236 } |
|
237 } |
|
238 } |
|
239 else |
|
240 { |
|
241 result = KErrGeneral; |
|
242 } |
|
243 entryArray.ResetAndDestroy(); |
|
244 arruids.ResetAndDestroy(); |
|
245 delete entryObj; |
|
246 } |
|
247 else |
|
248 result = KErrGeneral; |
|
249 |
|
250 RemoveCalendarFile( service, KTestCal1File ); |
|
251 |
|
252 delete service; |
|
253 |
|
254 __UHEAP_MARKEND; |
|
255 |
|
256 return result; |
|
257 |
|
258 |
|
259 } |
|
260 |
|
261 TInt CTCalendarUpdateTest::UpdateAnniversaryL(CStifItemParser &aItem )//try |
|
262 { |
|
263 |
|
264 TInt result = KErrNone; |
|
265 |
|
266 __UHEAP_MARK; |
|
267 |
|
268 CCalendarService* service = CCalendarService::NewL(); |
|
269 |
|
270 RemoveCalendarFile( service, KTestCal1File ); |
|
271 AddCalendarFile( service, KTestCal1File ); |
|
272 |
|
273 RPointerArray<TUIDSet> arruids(5); |
|
274 |
|
275 TUIDSet* uids = NULL; |
|
276 |
|
277 if(AddAnny(service, KTestCal1File, uids) == KErrNone && uids) |
|
278 { |
|
279 arruids.Append(uids); |
|
280 uids = NULL; |
|
281 } |
|
282 |
|
283 if ( arruids.Count() > 0 ) |
|
284 { |
|
285 RPointerArray<CCalEntry> entryArray; |
|
286 |
|
287 CEntryAttributes* entryObj = CEntryAttributes::NewL(); |
|
288 TCalTime stTime; |
|
289 stTime.SetTimeLocalFloatingL(TTime(TDateTime(2007, EDecember, 28, 0, 0, 0, 0))); |
|
290 TTime startTime(TDateTime(2007, EDecember, 28, 0, 0, 0, 0)); |
|
291 entryObj->SetStartTimeL(startTime); |
|
292 |
|
293 /*TCalRRule rrule(TCalRRule::EYearly); |
|
294 rrule.SetDtStart(stTime); |
|
295 rrule.SetInterval(1); |
|
296 |
|
297 TCalTime uTime; |
|
298 uTime.SetTimeLocalFloatingL(TCalTime::MaxTime()); |
|
299 rrule.SetUntil(uTime); |
|
300 |
|
301 entryObj->SetRepeatRule(rrule); */ |
|
302 |
|
303 service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
304 |
|
305 if( entryArray.Count() == 1 ) |
|
306 { |
|
307 entryObj->SetLocalUid( arruids[0]->iLocalUID ); |
|
308 } |
|
309 |
|
310 TUIDSet* uids = NULL; |
|
311 entryArray.ResetAndDestroy(); |
|
312 TRAPD( err, service->AddL(KTestCal1File,entryObj,uids) ); |
|
313 delete uids; |
|
314 if ( err == KErrNone ) |
|
315 { |
|
316 service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
317 if( entryArray.Count() == 1 ) |
|
318 { |
|
319 TCalRRule rRule; |
|
320 entryArray[0]->GetRRuleL( rRule ); |
|
321 TCalTime utTime; |
|
322 utTime.SetTimeLocalFloatingL(TTime(TDateTime(2100, EDecember, 28, 0, 0, 0, 0))); |
|
323 if( !( entryArray[0]->StartTimeL().TimeLocalL() == stTime.TimeLocalL() ) && rRule.Until().TimeLocalL() == utTime.TimeLocalL()) |
|
324 { |
|
325 result = KErrGeneral; |
|
326 } |
|
327 } |
|
328 } |
|
329 else |
|
330 { |
|
331 result = KErrGeneral; |
|
332 } |
|
333 entryArray.ResetAndDestroy(); |
|
334 arruids.ResetAndDestroy(); |
|
335 delete entryObj; |
|
336 } |
|
337 else |
|
338 result = KErrGeneral; |
|
339 |
|
340 RemoveCalendarFile( service, KTestCal1File ); |
|
341 |
|
342 delete service; |
|
343 |
|
344 __UHEAP_MARKEND; |
|
345 |
|
346 return result; |
|
347 |
|
348 } |
|
349 |
|
350 TInt CTCalendarUpdateTest::UpdateDayEventL(CStifItemParser &aItem )//try |
|
351 { |
|
352 TInt result = KErrNone; |
|
353 |
|
354 __UHEAP_MARK; |
|
355 |
|
356 CCalendarService* service = CCalendarService::NewL(); |
|
357 |
|
358 RemoveCalendarFile( service, KTestCal1File ); |
|
359 AddCalendarFile( service, KTestCal1File ); |
|
360 |
|
361 RPointerArray<TUIDSet> arruids(5); |
|
362 |
|
363 TUIDSet* uids = NULL; |
|
364 |
|
365 if(AddEvent(service, KTestCal1File, uids) == KErrNone && uids) |
|
366 { |
|
367 arruids.Append(uids); |
|
368 uids = NULL; |
|
369 } |
|
370 |
|
371 if ( arruids.Count() > 0 ) |
|
372 { |
|
373 RPointerArray<CCalEntry> entryArray; |
|
374 |
|
375 CEntryAttributes* entryObj = CEntryAttributes::NewL(); |
|
376 |
|
377 entryObj->SetDescriptionL(_L("Day event modified")); |
|
378 entryObj->SetPriority(2); |
|
379 service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
380 |
|
381 if( entryArray.Count() == 1 ) |
|
382 { |
|
383 entryObj->SetLocalUid( arruids[0]->iLocalUID ); |
|
384 } |
|
385 |
|
386 TUIDSet* uids = NULL; |
|
387 TRAPD( err, service->AddL(KTestCal1File,entryObj,uids) ); |
|
388 delete uids; |
|
389 entryArray.ResetAndDestroy(); |
|
390 if ( err == KErrNone ) |
|
391 { |
|
392 service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
393 if( entryArray.Count() == 1 ) |
|
394 { |
|
395 if( !( entryArray[0]->DescriptionL().CompareF(_L("Day event modified")) == 0 && entryArray[0]->PriorityL() == 2 ) ) |
|
396 { |
|
397 result = KErrGeneral; |
|
398 } |
|
399 } |
|
400 } |
|
401 else |
|
402 { |
|
403 result = KErrGeneral; |
|
404 } |
|
405 entryArray.ResetAndDestroy(); |
|
406 arruids.ResetAndDestroy(); |
|
407 delete entryObj; |
|
408 } |
|
409 else |
|
410 result = KErrGeneral; |
|
411 |
|
412 RemoveCalendarFile( service, KTestCal1File ); |
|
413 |
|
414 delete service; |
|
415 |
|
416 __UHEAP_MARKEND; |
|
417 |
|
418 return result; |
|
419 |
|
420 } |
|
421 |
|
422 TInt CTCalendarUpdateTest::UpdateReminderL(CStifItemParser &aItem ) |
|
423 { |
|
424 TInt result = KErrNone; |
|
425 |
|
426 __UHEAP_MARK; |
|
427 |
|
428 CCalendarService* service = CCalendarService::NewL(); |
|
429 |
|
430 RemoveCalendarFile( service, KTestCal1File ); |
|
431 AddCalendarFile( service, KTestCal1File ); |
|
432 |
|
433 RPointerArray<TUIDSet> arruids(5); |
|
434 |
|
435 TUIDSet* uids = NULL; |
|
436 |
|
437 if(AddReminder(service, KTestCal1File, uids) == KErrNone && uids) |
|
438 { |
|
439 arruids.Append(uids); |
|
440 uids = NULL; |
|
441 } |
|
442 |
|
443 if ( arruids.Count() > 0 ) |
|
444 { |
|
445 RPointerArray<CCalEntry> entryArray; |
|
446 |
|
447 CEntryAttributes* entryObj = CEntryAttributes::NewL(); |
|
448 entryObj->SetSummaryL(KString1); |
|
449 TTime stTime(TDateTime(2007, EJuly, 23, 11, 30, 0, 0)); |
|
450 entryObj->SetStartTimeL(stTime); |
|
451 |
|
452 service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
453 |
|
454 if( entryArray.Count() == 1 ) |
|
455 { |
|
456 entryObj->SetLocalUid( arruids[0]->iLocalUID ); |
|
457 } |
|
458 |
|
459 TUIDSet* uids = NULL; |
|
460 TRAPD( err, service->AddL(KTestCal1File,entryObj,uids) ); |
|
461 delete uids; |
|
462 entryArray.ResetAndDestroy(); |
|
463 if ( err == KErrNone ) |
|
464 { |
|
465 service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
466 if( entryArray.Count() == 1 ) |
|
467 { |
|
468 if( !( entryArray[0]->SummaryL().CompareF( KString1 ) == 0 && entryArray[0]->StartTimeL().TimeUtcL() == stTime)) |
|
469 { |
|
470 result = KErrGeneral; |
|
471 } |
|
472 } |
|
473 } |
|
474 else |
|
475 { |
|
476 result = KErrGeneral; |
|
477 } |
|
478 entryArray.ResetAndDestroy(); |
|
479 arruids.ResetAndDestroy(); |
|
480 delete entryObj; |
|
481 } |
|
482 else |
|
483 result = KErrGeneral; |
|
484 |
|
485 RemoveCalendarFile( service, KTestCal1File ); |
|
486 |
|
487 delete service; |
|
488 |
|
489 __UHEAP_MARKEND; |
|
490 |
|
491 return result; |
|
492 |
|
493 } |
|
494 |
|
495 |
|
496 |
|
497 TInt CTCalendarUpdateTest::UpdateAppointmentEntryWithNewTimeL(CStifItemParser &aItem ) |
|
498 { |
|
499 TInt result = KErrNone; |
|
500 |
|
501 __UHEAP_MARK; |
|
502 |
|
503 CCalendarService* service = CCalendarService::NewL(); |
|
504 |
|
505 RemoveCalendarFile( service, KTestCal1File ); |
|
506 AddCalendarFile( service, KTestCal1File ); |
|
507 |
|
508 RPointerArray<TUIDSet> arruids(5); |
|
509 |
|
510 TUIDSet* uids = NULL; |
|
511 |
|
512 if(AddRepeatingAppointmentEntryL(service, KTestCal1File, uids) == KErrNone && uids) |
|
513 { |
|
514 arruids.Append(uids); |
|
515 uids = NULL; |
|
516 } |
|
517 |
|
518 if ( arruids.Count() > 0 ) |
|
519 { |
|
520 RPointerArray<CCalEntry> entryArray; |
|
521 |
|
522 CEntryAttributes* entryObj = CEntryAttributes::NewL(); |
|
523 |
|
524 |
|
525 TTime stTime(TDateTime(2007, ESeptember, 17, 9, 0, 0, 0)); |
|
526 entryObj->SetInstanceStartTimeL(stTime); |
|
527 TTime startTime(TDateTime(2007, ESeptember, 17, 14, 0, 0, 0)); |
|
528 entryObj->SetStartTimeL(startTime); |
|
529 TTime endTime(TDateTime(2007, ESeptember, 17, 17, 30, 0, 0)); |
|
530 entryObj->SetEndTimeL(endTime); |
|
531 |
|
532 service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
533 |
|
534 if( entryArray.Count() == 1 ) |
|
535 { |
|
536 entryObj->SetLocalUid( arruids[0]->iLocalUID ); |
|
537 } |
|
538 |
|
539 TUIDSet* uids = NULL; |
|
540 TCalLocalUid modifiedEntryId; |
|
541 TRAPD( err, service->AddL(KTestCal1File,entryObj,uids) ); |
|
542 modifiedEntryId = uids->iLocalUID; |
|
543 delete uids; |
|
544 entryArray.ResetAndDestroy(); |
|
545 if ( err == KErrNone ) |
|
546 { |
|
547 service->GetListL( KTestCal1File, modifiedEntryId , entryArray ); |
|
548 if( entryArray.Count() == 1 ) |
|
549 { |
|
550 if( !( entryArray[0]->StartTimeL().TimeUtcL() == startTime && |
|
551 entryArray[0]->EndTimeL().TimeUtcL() == endTime )) |
|
552 { |
|
553 result = KErrGeneral; |
|
554 } |
|
555 } |
|
556 |
|
557 } |
|
558 else |
|
559 { |
|
560 result = KErrGeneral; |
|
561 } |
|
562 entryArray.ResetAndDestroy(); |
|
563 arruids.ResetAndDestroy(); |
|
564 delete entryObj; |
|
565 } |
|
566 else |
|
567 result = KErrGeneral; |
|
568 |
|
569 RemoveCalendarFile( service, KTestCal1File ); |
|
570 |
|
571 delete service; |
|
572 |
|
573 __UHEAP_MARKEND; |
|
574 |
|
575 return result; |
|
576 |
|
577 } |
|
578 |
|
579 |
|
580 TInt CTCalendarUpdateTest::UpdateAppointmentEntryWithNewAttendeesL(CStifItemParser &aItem ) |
|
581 { |
|
582 TInt result = KErrNone; |
|
583 |
|
584 __UHEAP_MARK; |
|
585 |
|
586 CCalendarService* service = CCalendarService::NewL(); |
|
587 |
|
588 RemoveCalendarFile( service, KTestCal1File ); |
|
589 AddCalendarFile( service, KTestCal1File ); |
|
590 |
|
591 RPointerArray<TUIDSet> arruids(5); |
|
592 |
|
593 TUIDSet* uids = NULL; |
|
594 |
|
595 if(AddRepeatingAppointmentEntryL(service, KTestCal1File, uids) == KErrNone && uids) |
|
596 { |
|
597 arruids.Append(uids); |
|
598 uids = NULL; |
|
599 } |
|
600 |
|
601 if ( arruids.Count() > 0 ) |
|
602 { |
|
603 RPointerArray<CCalEntry> entryArray; |
|
604 |
|
605 CEntryAttributes* entryObj = CEntryAttributes::NewL(); |
|
606 |
|
607 TTime stTime(TDateTime(2007, ESeptember, 17, 9, 0, 0, 0)); |
|
608 entryObj->SetInstanceStartTimeL(stTime); |
|
609 TTime startTime(TDateTime(2007, ESeptember, 17, 14, 0, 0, 0)); |
|
610 entryObj->SetStartTimeL(startTime); |
|
611 TTime endTime(TDateTime(2007, ESeptember, 17, 17, 30, 0, 0)); |
|
612 entryObj->SetEndTimeL(endTime); |
|
613 |
|
614 CAttendeeInfo* attendee = CAttendeeInfo::NewL(_L("carendar@yahoo.com")); |
|
615 CleanupStack::PushL(attendee); |
|
616 attendee->SetRoleL(KAttRoleReqParticipant); |
|
617 attendee->SetStatusL(KAttStatusTentative); |
|
618 attendee->SetRsvp(EFalse); |
|
619 |
|
620 entryObj->AddAttendeeL(attendee); |
|
621 CleanupStack::PopAndDestroy(attendee); |
|
622 |
|
623 attendee = CAttendeeInfo::NewL(_L("bettinapinto@gmail.com")); |
|
624 CleanupStack::PushL(attendee); |
|
625 attendee->SetCommonNameL(_L("SAPI")); |
|
626 attendee->SetRoleL(KAttRoleReqParticipant); |
|
627 attendee->SetStatusL(KAttStatusTentative); |
|
628 attendee->SetRsvp(EFalse); |
|
629 |
|
630 entryObj->AddAttendeeL(attendee); |
|
631 CleanupStack::PopAndDestroy(attendee); |
|
632 |
|
633 service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
634 |
|
635 if( entryArray.Count() == 1 ) |
|
636 { |
|
637 entryObj->SetLocalUid( arruids[0]->iLocalUID ); |
|
638 } |
|
639 |
|
640 TUIDSet* uids = NULL; |
|
641 TCalLocalUid modifiedEntryId; |
|
642 TRAPD( err, service->AddL(KTestCal1File,entryObj,uids) ); |
|
643 modifiedEntryId = uids->iLocalUID; |
|
644 delete uids; |
|
645 entryArray.ResetAndDestroy(); |
|
646 if ( err == KErrNone ) |
|
647 { |
|
648 service->GetListL( KTestCal1File, modifiedEntryId , entryArray ); |
|
649 if( entryArray.Count() == 1 ) |
|
650 { |
|
651 RPointerArray<CCalAttendee> attendeeList; |
|
652 attendeeList = entryArray[0]->AttendeesL(); |
|
653 if( attendeeList.Count() != 2 ) |
|
654 { |
|
655 result = KErrGeneral; |
|
656 } |
|
657 } |
|
658 |
|
659 } |
|
660 else |
|
661 { |
|
662 result = KErrGeneral; |
|
663 } |
|
664 entryArray.ResetAndDestroy(); |
|
665 arruids.ResetAndDestroy(); |
|
666 delete entryObj; |
|
667 } |
|
668 else |
|
669 result = KErrGeneral; |
|
670 |
|
671 RemoveCalendarFile( service, KTestCal1File ); |
|
672 |
|
673 delete service; |
|
674 |
|
675 |
|
676 __UHEAP_MARKEND; |
|
677 |
|
678 return result; |
|
679 |
|
680 } |
|
681 //update entry's location, repeat rule check local uid returned |
|
682 |
|
683 TInt CTCalendarUpdateTest::UpdateAppointmentEntryWithNewRepeatL(CStifItemParser &aItem ) |
|
684 { |
|
685 TInt result = KErrNone; |
|
686 |
|
687 __UHEAP_MARK; |
|
688 |
|
689 CCalendarService* service = CCalendarService::NewL(); |
|
690 |
|
691 RemoveCalendarFile( service, KTestCal1File ); |
|
692 AddCalendarFile( service, KTestCal1File ); |
|
693 |
|
694 RPointerArray<TUIDSet> arruids(5); |
|
695 |
|
696 TUIDSet* uids = NULL; |
|
697 |
|
698 if(AddRepeatingAppointmentEntryL(service, KTestCal1File, uids) == KErrNone && uids) |
|
699 { |
|
700 arruids.Append(uids); |
|
701 uids = NULL; |
|
702 } |
|
703 |
|
704 if ( arruids.Count() > 0 ) |
|
705 { |
|
706 RPointerArray<CCalEntry> entryArray; |
|
707 |
|
708 CEntryAttributes* entryObj = CEntryAttributes::NewL(); |
|
709 |
|
710 entryObj->SetDescriptionL(_L("Updated SAPI weekly meeting")); |
|
711 |
|
712 TTime stTime(TDateTime(2007, ESeptember, 15, 9, 0, 0, 0)); |
|
713 |
|
714 CRepeatInfo* rrule = CRepeatInfo::NewL(3); |
|
715 rrule->SetStartTimeL(stTime); |
|
716 TTime uTime(TDateTime(2007, EDecember, 30, 0, 0, 0, 0)); |
|
717 rrule->SetUntilTimeL(uTime); |
|
718 TCalRRule::TDayOfMonth day1(EMonday,1); |
|
719 TCalRRule::TDayOfMonth day2(EWednesday,3); |
|
720 RArray<TCalRRule::TDayOfMonth> monthDays; |
|
721 monthDays.Append(day1); |
|
722 monthDays.Append(day2); |
|
723 rrule->SetMonthDays(monthDays); |
|
724 monthDays.Close(); |
|
725 |
|
726 entryObj->SetRepeatRule(rrule); |
|
727 delete rrule; |
|
728 |
|
729 service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
730 |
|
731 if( entryArray.Count() == 1 ) |
|
732 { |
|
733 entryObj->SetLocalUid( arruids[0]->iLocalUID ); |
|
734 } |
|
735 entryArray.ResetAndDestroy(); |
|
736 TUIDSet* uids = NULL; |
|
737 TCalLocalUid modifiedEntryId; |
|
738 TRAPD( err, service->AddL(KTestCal1File,entryObj,uids) ); |
|
739 modifiedEntryId = uids->iLocalUID; |
|
740 delete uids; |
|
741 |
|
742 if ( err == KErrNone ) |
|
743 { |
|
744 service->GetListL( KTestCal1File, modifiedEntryId , entryArray ); |
|
745 if( entryArray.Count() == 1 ) |
|
746 { |
|
747 TCalRRule rRule; |
|
748 entryArray[0]->GetRRuleL( rRule ); |
|
749 TCalTime utTime; |
|
750 utTime.SetTimeLocalL(TTime(TDateTime(2007, EDecember, 18, 9, 0, 0, 0))); |
|
751 if( !( rRule.Type() == TCalRRule::EMonthly )) |
|
752 { |
|
753 result = KErrGeneral; |
|
754 } |
|
755 } |
|
756 } |
|
757 else |
|
758 { |
|
759 result = KErrGeneral; |
|
760 } |
|
761 entryArray.ResetAndDestroy(); |
|
762 arruids.ResetAndDestroy(); |
|
763 delete entryObj; |
|
764 } |
|
765 else |
|
766 result = KErrGeneral; |
|
767 |
|
768 RemoveCalendarFile( service, KTestCal1File ); |
|
769 |
|
770 delete service; |
|
771 |
|
772 __UHEAP_MARKEND; |
|
773 |
|
774 return result; |
|
775 |
|
776 } |
|
777 #if 0 |
|
778 |
|
779 TInt CTCalendarUpdateTest::UpdateAppointmentEntryWithNewTimeAndAttendeesL(CStifItemParser &aItem ) |
|
780 { |
|
781 |
|
782 TInt result = KErrNone; |
|
783 |
|
784 __UHEAP_MARK; |
|
785 |
|
786 CCalendarService* service = CCalendarService::NewL(); |
|
787 |
|
788 RemoveCalendarFile( service, KTestCal1File ); |
|
789 AddCalendarFile( service, KTestCal1File ); |
|
790 |
|
791 RPointerArray<TUIDSet> arruids(5); |
|
792 |
|
793 TUIDSet* uids = NULL; |
|
794 |
|
795 if(AddAppointmentWithAttendees(service, KTestCal1File, uids) == KErrNone && uids) |
|
796 { |
|
797 arruids.Append(uids); |
|
798 uids = NULL; |
|
799 } |
|
800 |
|
801 if ( arruids.Count() > 0 ) |
|
802 { |
|
803 RPointerArray<CCalEntry> entryArray; |
|
804 |
|
805 CEntryAttributes* entryObj = CEntryAttributes::NewL(); |
|
806 |
|
807 TTime stTime(TDateTime(2007, ESeptember, 17, 8, 0, 0, 0)); |
|
808 entryObj->SetInstanceStartTime(stTime); |
|
809 TTime startTime(TDateTime(2007, ESeptember, 17, 14, 0, 0, 0)); |
|
810 entryObj->SetStartTime(startTime); |
|
811 TTime endTime(TDateTime(2007, ESeptember, 17, 17, 30, 0, 0)); |
|
812 entryObj->SetEndTime(endTime); |
|
813 |
|
814 CCalAttendee* attendee = CCalAttendee::NewL(_L("carencar@yahoo.com")); |
|
815 attendee->SetRoleL(CCalAttendee::EReqParticipant); |
|
816 attendee->SetStatusL(CCalAttendee::ETentative); |
|
817 attendee->SetResponseRequested(EFalse); |
|
818 |
|
819 entryObj->AddAttendeeL(attendee); |
|
820 |
|
821 CCalUser* organizer = CCalUser::NewL(_L("mcrasta@gmail.com")); |
|
822 organizer->SetCommonNameL(_L("SAPI")); |
|
823 entryObj->SetOrganizerDataL(organizer); |
|
824 |
|
825 entryObj->SetPhoneOwnerDataL(_L("carencar@yahoo.com")); |
|
826 |
|
827 service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
828 |
|
829 if( entryArray.Count() == 1 ) |
|
830 { |
|
831 entryObj->SetLocalUid( arruids[0]->iLocalUID ); |
|
832 } |
|
833 |
|
834 TUIDSet* uids = NULL; |
|
835 entryArray.ResetAndDestroy(); |
|
836 TRAPD( err, service->UpdateL(KTestCal1File,entryObj,uids) ); |
|
837 TCalLocalUid modifiedEntryId = uids->iLocalUID; |
|
838 delete uids; |
|
839 |
|
840 if ( err == KErrNone ) |
|
841 { |
|
842 service->GetListL( KTestCal1File, modifiedEntryId , entryArray ); |
|
843 if( entryArray.Count() == 1 ) |
|
844 { |
|
845 if( !( entryArray[0]->StartTimeL().TimeUtcL() == stTime && |
|
846 entryArray[0]->EndTimeL().TimeUtcL() == endTime && |
|
847 entryArray[0]->PhoneOwnerL()->Address().CompareF()) == 0 && |
|
848 entryArray[0]->PhoneOwnerL()->Address().CompareF(_L("mcrasta@gmail.com")) == 0)) |
|
849 { |
|
850 result = KErrGeneral; |
|
851 TDateTime tdStTime = entryArray[0]->StartTimeL().TimeLocalL().DateTime(); |
|
852 TInt yr = tdStTime.Year(); |
|
853 TMonth mon = tdStTime.Month() ; |
|
854 TInt day = tdStTime.Day() ; |
|
855 TInt hr = tdStTime.Hour() ; |
|
856 TInt min = tdStTime.Minute() ; |
|
857 |
|
858 TDateTime tdStTime1 = stTime.TimeLocalL().DateTime(); |
|
859 TInt yr1 = tdStTime1.Year(); |
|
860 TMonth mon1 = tdStTime1.Month() ; |
|
861 TInt day1 = tdStTime1.Day() ; |
|
862 TInt hr1 = tdStTime1.Hour() ; |
|
863 TInt min1 = tdStTime1.Minute() ; |
|
864 // } |
|
865 } |
|
866 } |
|
867 else |
|
868 { |
|
869 result = KErrGeneral; |
|
870 } |
|
871 entryArray.ResetAndDestroy(); |
|
872 arruids.ResetAndDestroy(); |
|
873 } |
|
874 else |
|
875 result = KErrGeneral; |
|
876 |
|
877 RemoveCalendarFile( service, KTestCal1File ); |
|
878 |
|
879 delete service; |
|
880 |
|
881 __UHEAP_MARKEND; |
|
882 |
|
883 return result; |
|
884 |
|
885 } |
|
886 #endif |