19
|
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 |
// SYSTEM INCLUDE FILES
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <f32file.h> //for RFile and Rfs
|
|
24 |
|
|
25 |
#include <calentry.h>//for CCalEntry
|
|
26 |
#include <calinstanceview.h>//for CCalInstance
|
|
27 |
#include <calcommon.h>//for Filter Type Enum Constants
|
|
28 |
#include <calinstance.h>
|
|
29 |
#include <caltime.h>
|
|
30 |
|
|
31 |
// USER INCLUDE FILES
|
|
32 |
#include "cal_delete.h"
|
|
33 |
#include "calendarheader.h"
|
|
34 |
#include "calendarservice.h"
|
|
35 |
#include "entryattributes.h"
|
|
36 |
#include<ASCliClientUtils.h>
|
|
37 |
|
|
38 |
#include "teststartconsolealarmserver.h"
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
_LIT(KCalName ,"C:Calendar");
|
|
43 |
|
|
44 |
|
|
45 |
TInt AddRepeatingAptEntryL(CCalendarService* aService, const TDesC& name, TUIDSet*& uids);
|
|
46 |
|
|
47 |
CCalDelTestCases* CCalDelTestCases::NewL( TInt& aResult) //1 means VCal else ICal
|
|
48 |
{
|
|
49 |
CCalDelTestCases* self = new(ELeave)CCalDelTestCases( aResult); //1 means VCal else ICal;
|
|
50 |
|
|
51 |
self->ConstructL();
|
|
52 |
|
|
53 |
return self;
|
|
54 |
}
|
|
55 |
|
|
56 |
CCalDelTestCases::~CCalDelTestCases()
|
|
57 |
{
|
|
58 |
Cancel();
|
|
59 |
|
|
60 |
if(iWaitSchedular->IsStarted())
|
|
61 |
iWaitSchedular->AsyncStop();
|
|
62 |
|
|
63 |
if(iCalendarService)
|
|
64 |
delete iCalendarService;
|
|
65 |
|
|
66 |
if(iWaitSchedular)
|
|
67 |
delete iWaitSchedular;
|
|
68 |
|
|
69 |
if(iArruids.Count())
|
|
70 |
iArruids.ResetAndDestroy();
|
|
71 |
}
|
|
72 |
|
|
73 |
|
|
74 |
_LIT(KTestCal1File ,"c:cal1");
|
|
75 |
_LIT(KTestCal2File ,"c:cal2");
|
|
76 |
_LIT(KDelTestInvFile ,"Invalid");
|
|
77 |
|
|
78 |
|
|
79 |
_LIT(KDelTestCalNameDeleteForGuids ,"c:deleteforGuidscal");
|
|
80 |
|
|
81 |
TInt CCalDelTestCases::TestDeleteUsingGUidL()
|
|
82 |
{
|
|
83 |
//No need to set it but for the sake of semanitics set to sync value
|
|
84 |
iTestCaseType = KDeleteSync;
|
|
85 |
|
|
86 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForGuids.operator()());
|
|
87 |
|
|
88 |
TRAP( iResult , iCalendarService->AddL( KDelTestCalNameDeleteForGuids.operator()() ) );
|
|
89 |
|
|
90 |
if( iResult == KErrNone )
|
|
91 |
{
|
|
92 |
addSomeEntries( KDelTestCalNameDeleteForGuids.operator()() );//adds the entries and fills up iArruids with UIDSets
|
|
93 |
|
|
94 |
CEntryAttributes* entryObj = CEntryAttributes::NewL();
|
|
95 |
|
|
96 |
entryObj->SetEntryStatusL(KNullStatus);
|
|
97 |
|
|
98 |
entryObj->SetLocalUid( iArruids[0]->iLocalUID );
|
|
99 |
|
|
100 |
TUIDSet* entryUids = NULL;
|
|
101 |
|
|
102 |
CCalendarFilter *getListfilter1 = CCalendarFilter::NewL();
|
|
103 |
|
|
104 |
RPointerArray<CCalInstance> calInstanceArray;
|
|
105 |
|
|
106 |
getListfilter1->SetFilterTypeL( KIncludeAll );
|
|
107 |
|
|
108 |
iCalendarService->GetListL( KDelTestCalNameDeleteForGuids.operator()(), getListfilter1 , calInstanceArray );
|
|
109 |
|
|
110 |
delete getListfilter1;
|
|
111 |
|
|
112 |
TInt count = calInstanceArray.Count();
|
|
113 |
|
|
114 |
if ( calInstanceArray.Count() == 0 )
|
|
115 |
{
|
|
116 |
iResult = KErrGeneral;
|
|
117 |
|
|
118 |
calInstanceArray.ResetAndDestroy();
|
|
119 |
|
|
120 |
return iResult;
|
|
121 |
}
|
|
122 |
|
|
123 |
|
|
124 |
TRAPD( iResult, iCalendarService->AddL(KDelTestCalNameDeleteForGuids.operator()(),entryObj,entryUids) );
|
|
125 |
|
|
126 |
if(iResult != KErrNone)
|
|
127 |
{
|
|
128 |
|
|
129 |
delete entryObj;
|
|
130 |
|
|
131 |
calInstanceArray.ResetAndDestroy();
|
|
132 |
|
|
133 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForGuids.operator()());
|
|
134 |
|
|
135 |
return iResult;
|
|
136 |
}
|
|
137 |
|
|
138 |
CCalendarFilter *filter = CCalendarFilter::NewL();
|
|
139 |
|
|
140 |
filter->AddGuidL( *(iArruids[0])->iGlobalUID );
|
|
141 |
|
|
142 |
|
|
143 |
TRAP( iResult, iCalendarService->DeleteL( KDelTestCalNameDeleteForGuids.operator()() , filter , NULL) );
|
|
144 |
|
|
145 |
delete filter;
|
|
146 |
|
|
147 |
if(iResult != KErrNone)
|
|
148 |
{
|
|
149 |
|
|
150 |
delete entryObj;
|
|
151 |
|
|
152 |
calInstanceArray.ResetAndDestroy();
|
|
153 |
|
|
154 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForGuids.operator()());
|
|
155 |
|
|
156 |
delete entryUids;
|
|
157 |
|
|
158 |
entryUids = NULL;
|
|
159 |
|
|
160 |
return iResult;
|
|
161 |
}
|
|
162 |
|
|
163 |
|
|
164 |
CCalendarFilter *getListfilter2 = CCalendarFilter::NewL();
|
|
165 |
|
|
166 |
RPointerArray<CCalInstance> calInstanceArray2;
|
|
167 |
|
|
168 |
getListfilter2->SetFilterTypeL( KIncludeAll );
|
|
169 |
|
|
170 |
iCalendarService->GetListL( KDelTestCalNameDeleteForGuids.operator()(), getListfilter2 , calInstanceArray2 );
|
|
171 |
|
|
172 |
delete getListfilter2;
|
|
173 |
|
|
174 |
delete entryObj;
|
|
175 |
|
|
176 |
delete entryUids;
|
|
177 |
|
|
178 |
entryUids = NULL;
|
|
179 |
|
|
180 |
TInt new_count = calInstanceArray2.Count();
|
|
181 |
|
|
182 |
if ( calInstanceArray2.Count() != count-1 )
|
|
183 |
{
|
|
184 |
iResult = KErrGeneral;
|
|
185 |
}
|
|
186 |
calInstanceArray.ResetAndDestroy();
|
|
187 |
|
|
188 |
calInstanceArray2.ResetAndDestroy();
|
|
189 |
}
|
|
190 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForGuids.operator()());
|
|
191 |
|
|
192 |
return iResult;
|
|
193 |
}
|
|
194 |
|
|
195 |
|
|
196 |
|
|
197 |
_LIT(KDelTestCalNameDeleteForLuids ,"c:deleteforLuidscal");
|
|
198 |
|
|
199 |
//Asynchronous test cases so setting the iTestCaseType as it is to be handled in RunL
|
|
200 |
TInt CCalDelTestCases::TestDeleteUsingLocalUidL()
|
|
201 |
{
|
|
202 |
//No need to set it but for the sake of semanitics set to sync value
|
|
203 |
iTestCaseType = KDeleteSync;
|
|
204 |
|
|
205 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForLuids.operator()());
|
|
206 |
|
|
207 |
iCalendarService->AddL( KDelTestCalNameDeleteForLuids.operator()() );
|
|
208 |
|
|
209 |
CEntryAttributes* entryObj = CEntryAttributes::NewL();
|
|
210 |
|
|
211 |
TUIDSet* entryUids = NULL;
|
|
212 |
|
|
213 |
RPointerArray<CCalEntry> entryArray;
|
|
214 |
|
|
215 |
TRAPD(err_apt,AddRepeatingAppointmentEntryL(iCalendarService, KDelTestCalNameDeleteForLuids.operator()(), entryUids));
|
|
216 |
iArruids.Append(entryUids);
|
|
217 |
entryUids = NULL;
|
|
218 |
|
|
219 |
iCalendarService->GetListL( KDelTestCalNameDeleteForLuids.operator()(), *(iArruids[0]->iGlobalUID) , entryArray );
|
|
220 |
|
|
221 |
TInt count = entryArray.Count();
|
|
222 |
count =0;
|
|
223 |
entryArray.ResetAndDestroy();
|
|
224 |
|
|
225 |
TTime stTime(TDateTime(2007, ESeptember, 28, 9, 0, 0, 0));
|
|
226 |
entryObj->SetInstanceStartTimeL(stTime);
|
|
227 |
TTime startTime(TDateTime(2007, ESeptember, 28, 14, 0, 0, 0));
|
|
228 |
entryObj->SetStartTimeL(startTime);
|
|
229 |
TTime endTime(TDateTime(2007, ESeptember, 28, 17, 30, 0, 0));
|
|
230 |
entryObj->SetEndTimeL(endTime);
|
|
231 |
|
|
232 |
TCalLocalUid luid = iArruids[0]->iLocalUID;
|
|
233 |
|
|
234 |
entryObj->SetLocalUid( iArruids[0]->iLocalUID );
|
|
235 |
|
|
236 |
TRAPD(err_update,iCalendarService->AddL(KDelTestCalNameDeleteForLuids.operator()(),entryObj,entryUids));
|
|
237 |
|
|
238 |
TCalLocalUid modifiedEntryId = entryUids->iLocalUID;
|
|
239 |
|
|
240 |
|
|
241 |
CCalendarFilter *filter = CCalendarFilter::NewL();
|
|
242 |
|
|
243 |
filter->AddLocalUid( (iArruids[0])->iLocalUID );
|
|
244 |
|
|
245 |
|
|
246 |
TRAP( iResult, iCalendarService->DeleteL( KDelTestCalNameDeleteForLuids.operator()() , filter , NULL) );
|
|
247 |
|
|
248 |
delete filter;
|
|
249 |
|
|
250 |
|
|
251 |
iCalendarService->GetListL( KDelTestCalNameDeleteForLuids.operator()(), *(entryUids->iGlobalUID) , entryArray );
|
|
252 |
|
|
253 |
|
|
254 |
count = entryArray.Count();
|
|
255 |
|
|
256 |
if ( count != 0 )
|
|
257 |
{
|
|
258 |
iResult = KErrGeneral;
|
|
259 |
}
|
|
260 |
|
|
261 |
entryArray.ResetAndDestroy();
|
|
262 |
|
|
263 |
|
|
264 |
delete entryUids;
|
|
265 |
entryUids = NULL;
|
|
266 |
delete entryObj;
|
|
267 |
|
|
268 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForLuids.operator()());
|
|
269 |
|
|
270 |
return iResult;
|
|
271 |
}
|
|
272 |
|
|
273 |
_LIT(KDelTestCalNameDeleteForGuidLuidsAndTm ,"c:deleteforGuidLuidsAndTmcal");
|
|
274 |
|
|
275 |
TInt CCalDelTestCases::TestDeleteGuidTmRgLocalUidL()
|
|
276 |
{
|
|
277 |
//No need to set it but for the sake of semanitics set to sync value
|
|
278 |
iTestCaseType = KDeleteSync;
|
|
279 |
|
|
280 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForGuidLuidsAndTm.operator()());
|
|
281 |
|
|
282 |
iCalendarService->AddL( KDelTestCalNameDeleteForGuidLuidsAndTm.operator()() );
|
|
283 |
|
|
284 |
|
|
285 |
addSomeEntries( KDelTestCalNameDeleteForGuidLuidsAndTm.operator()() );//adds the entries and fills up iArruids with UIDSets
|
|
286 |
|
|
287 |
TUIDSet* entryUids = NULL;
|
|
288 |
|
|
289 |
CCalendarFilter *getListfilter2 = CCalendarFilter::NewL();
|
|
290 |
|
|
291 |
RPointerArray<CCalInstance> calInstanceArray2;
|
|
292 |
|
|
293 |
getListfilter2->SetFilterTypeL( KIncludeAll );
|
|
294 |
|
|
295 |
AddRepeatingAppointmentEntryL(iCalendarService, KDelTestCalNameDeleteForGuidLuidsAndTm.operator()(), entryUids);
|
|
296 |
iArruids.Append(entryUids);
|
|
297 |
// delete entryUids;
|
|
298 |
entryUids = NULL;
|
|
299 |
|
|
300 |
iCalendarService->GetListL( KDelTestCalNameDeleteForGuidLuidsAndTm.operator()(), getListfilter2 , calInstanceArray2 );
|
|
301 |
|
|
302 |
TInt count = calInstanceArray2.Count();
|
|
303 |
count =0;
|
|
304 |
calInstanceArray2.ResetAndDestroy();
|
|
305 |
|
|
306 |
CCalendarFilter *filter = CCalendarFilter::NewL();
|
|
307 |
|
|
308 |
filter->AddGuidL( *(iArruids[1])->iGlobalUID );
|
|
309 |
|
|
310 |
filter->AddLocalUid( (iArruids[2])->iLocalUID );
|
|
311 |
|
|
312 |
|
|
313 |
|
|
314 |
filter->SetStartTimeL( TTime(TDateTime(2007, EAugust, 5, 8, 0, 0, 0)) );
|
|
315 |
|
|
316 |
filter->SetEndTimeL( TTime(TDateTime(2007, EOctober, 2, 0, 0, 0, 0)) );
|
|
317 |
|
|
318 |
TRAPD( err_delete, iCalendarService->DeleteL( KDelTestCalNameDeleteForGuidLuidsAndTm.operator()() , filter , NULL) );
|
|
319 |
|
|
320 |
delete filter;
|
|
321 |
|
|
322 |
|
|
323 |
iCalendarService->GetListL( KDelTestCalNameDeleteForGuidLuidsAndTm.operator()(), getListfilter2 , calInstanceArray2 );
|
|
324 |
|
|
325 |
count = calInstanceArray2.Count();
|
|
326 |
|
|
327 |
if ( calInstanceArray2.Count() != 19 )
|
|
328 |
{
|
|
329 |
iResult = KErrGeneral;
|
|
330 |
}
|
|
331 |
|
|
332 |
calInstanceArray2.ResetAndDestroy();
|
|
333 |
|
|
334 |
delete getListfilter2;
|
|
335 |
|
|
336 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForGuidLuidsAndTm.operator()());
|
|
337 |
|
|
338 |
iResult = err_delete;
|
|
339 |
|
|
340 |
return iResult;
|
|
341 |
}
|
|
342 |
|
|
343 |
|
|
344 |
|
|
345 |
_LIT(KDelTestCalNameDeleteForInvalidGuidLuid ,"c:deleteforInvalidGuidLuid");
|
|
346 |
_LIT(KDelTestCalNameDelete ,"c:testcal");
|
|
347 |
|
|
348 |
TInt CCalDelTestCases::TestDeleteInvalidGUidLuidL()
|
|
349 |
{
|
|
350 |
//No need to set it but for the sake of semanitics set to sync value
|
|
351 |
iTestCaseType = KDeleteSync;
|
|
352 |
|
|
353 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForInvalidGuidLuid.operator()());
|
|
354 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDelete.operator()());
|
|
355 |
|
|
356 |
iCalendarService->AddL( KDelTestCalNameDeleteForInvalidGuidLuid.operator()() );
|
|
357 |
iCalendarService->AddL( KDelTestCalNameDelete.operator()() );
|
|
358 |
|
|
359 |
|
|
360 |
addSomeEntries( KDelTestCalNameDeleteForInvalidGuidLuid.operator()() );//adds the entries and fills up iArruids with UIDSets
|
|
361 |
|
|
362 |
|
|
363 |
CCalendarFilter *filter = CCalendarFilter::NewL();
|
|
364 |
|
|
365 |
CCalendarFilter *new_filter = CCalendarFilter::NewL();
|
|
366 |
|
|
367 |
filter->AddGuidL( *(iArruids[0])->iGlobalUID );
|
|
368 |
|
|
369 |
new_filter->AddLocalUid( 3000 );
|
|
370 |
|
|
371 |
|
|
372 |
// filter->SetStartTimeL( TTime(TDateTime(2005, EDecember, 30, 0, 0, 0, 0)) );
|
|
373 |
|
|
374 |
// filter->SetEndTimeL( TTime(TDateTime(2100, EDecember, 30, 0, 0, 0, 0)) );
|
|
375 |
|
|
376 |
TRAPD( err_guid, iCalendarService->DeleteL( KDelTestCalNameDelete.operator()() , filter , NULL) );
|
|
377 |
|
|
378 |
delete filter;
|
|
379 |
|
|
380 |
|
|
381 |
TRAPD(err_luid,iCalendarService->DeleteL( KDelTestCalNameDeleteForInvalidGuidLuid.operator()() , new_filter , NULL) );
|
|
382 |
|
|
383 |
delete new_filter;
|
|
384 |
|
|
385 |
CCalendarFilter *getListfilter2 = CCalendarFilter::NewL();
|
|
386 |
|
|
387 |
RPointerArray<CCalInstance> calInstanceArray2;
|
|
388 |
|
|
389 |
getListfilter2->SetFilterTypeL( KIncludeAll );
|
|
390 |
|
|
391 |
|
|
392 |
iCalendarService->GetListL( KDelTestCalNameDeleteForInvalidGuidLuid.operator()(), getListfilter2 , calInstanceArray2 );
|
|
393 |
|
|
394 |
TInt count = calInstanceArray2.Count();
|
|
395 |
|
|
396 |
if ( calInstanceArray2.Count() != 4 )
|
|
397 |
{
|
|
398 |
iResult = KErrGeneral;
|
|
399 |
}
|
|
400 |
|
|
401 |
calInstanceArray2.ResetAndDestroy();
|
|
402 |
|
|
403 |
delete getListfilter2;
|
|
404 |
|
|
405 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForInvalidGuidLuid.operator()());
|
|
406 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDelete.operator()());
|
|
407 |
|
|
408 |
/* if(err_guid != KErrNone)
|
|
409 |
iResult = err_guid;
|
|
410 |
else
|
|
411 |
iResult = err_luid; */
|
|
412 |
|
|
413 |
return iResult;
|
|
414 |
}
|
|
415 |
|
|
416 |
|
|
417 |
|
|
418 |
_LIT(KDelTestCalNameDeleteForTm ,"c:deleteforTmcal");
|
|
419 |
|
|
420 |
TInt CCalDelTestCases::TestDeleteTmRgL()
|
|
421 |
{
|
|
422 |
//No need to set it but for the sake of semanitics set to sync value
|
|
423 |
iTestCaseType = KDeleteSync;
|
|
424 |
|
|
425 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForTm.operator()());
|
|
426 |
|
|
427 |
iCalendarService->AddL( KDelTestCalNameDeleteForTm.operator()() );
|
|
428 |
|
|
429 |
|
|
430 |
addSomeEntries( KDelTestCalNameDeleteForTm.operator()() );//adds the entries and fills up iArruids with UIDSets
|
|
431 |
|
|
432 |
TUIDSet* entryUids = NULL;
|
|
433 |
|
|
434 |
|
|
435 |
AddRepeatingAptEntryL(iCalendarService, KDelTestCalNameDeleteForTm.operator()(), entryUids);
|
|
436 |
|
|
437 |
iArruids.Append(entryUids);
|
|
438 |
// delete entryUids;
|
|
439 |
entryUids = NULL;
|
|
440 |
|
|
441 |
|
|
442 |
CCalendarFilter *filter = CCalendarFilter::NewL();
|
|
443 |
|
|
444 |
filter->SetStartTimeL( TTime(TDateTime(2007, EAugust, 7, 8, 0, 0, 0)) );
|
|
445 |
|
|
446 |
filter->SetEndTimeL( TTime(TDateTime(2007, ESeptember, 20, 9, 0, 0, 0)) );
|
|
447 |
|
|
448 |
TRAP( iResult, iCalendarService->DeleteL( KDelTestCalNameDeleteForTm.operator()() , filter , NULL) );
|
|
449 |
|
|
450 |
|
|
451 |
delete filter;
|
|
452 |
|
|
453 |
|
|
454 |
CCalendarFilter *getListfilter2 = CCalendarFilter::NewL();
|
|
455 |
|
|
456 |
RPointerArray<CCalInstance> calInstanceArray2;
|
|
457 |
|
|
458 |
getListfilter2->SetFilterTypeL( KIncludeAll );
|
|
459 |
|
|
460 |
iCalendarService->GetListL( KDelTestCalNameDeleteForTm.operator()(), getListfilter2 , calInstanceArray2 );
|
|
461 |
|
|
462 |
TInt count = calInstanceArray2.Count();
|
|
463 |
|
|
464 |
for(TInt i=0;i<count;i++)
|
|
465 |
{
|
|
466 |
|
|
467 |
TInt day_no = calInstanceArray2[i]->Time().TimeLocalL().DateTime().Day();
|
|
468 |
|
|
469 |
}
|
|
470 |
|
|
471 |
if ( calInstanceArray2.Count() != 12 )
|
|
472 |
{
|
|
473 |
iResult = KErrGeneral;
|
|
474 |
}
|
|
475 |
|
|
476 |
|
|
477 |
calInstanceArray2.ResetAndDestroy();
|
|
478 |
delete getListfilter2;
|
|
479 |
|
|
480 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForTm.operator()());
|
|
481 |
|
|
482 |
return iResult;
|
|
483 |
}
|
|
484 |
|
|
485 |
|
|
486 |
_LIT(KDefaultCal ,"C:Calendar");
|
|
487 |
|
|
488 |
TInt CCalDelTestCases::TestDeleteByDefCalL()
|
|
489 |
{
|
|
490 |
//No need to set it but for the sake of semanitics set to sync value
|
|
491 |
iTestCaseType = KDeleteSync;
|
|
492 |
|
|
493 |
CCalendarFilter *filter = CCalendarFilter::NewL();
|
|
494 |
|
|
495 |
filter->SetStartTimeL( TTime(TDateTime(2007, EAugust, 7, 8, 0, 0, 0)) );
|
|
496 |
|
|
497 |
filter->SetEndTimeL( TTime(TDateTime(2007, ESeptember, 20, 8, 0, 0, 0)) );
|
|
498 |
|
|
499 |
// TRAPD( err_delete, iCalendarService->DeleteL( KDefaultCal.operator()() , NULL , NULL) );
|
|
500 |
|
|
501 |
TRAPD( iResult, iCalendarService->DeleteL( KDefaultCal.operator()() , filter , NULL) );
|
|
502 |
|
|
503 |
delete filter;
|
|
504 |
|
|
505 |
|
|
506 |
|
|
507 |
|
|
508 |
return iResult;
|
|
509 |
}
|
|
510 |
|
|
511 |
|
|
512 |
_LIT(KDelTestCalNameDeleteForGuidsAsync ,"c:deleteforGuidscalasync");
|
|
513 |
|
|
514 |
_LIT(KDelTestCalNameDeleteForLuidsAsync ,"c:deleteforLuidscalasync");
|
|
515 |
|
|
516 |
_LIT(KDelTestCalNameDeleteForInvalidGuidAsync ,"c:deleteforInvalidGuidLasync");
|
|
517 |
_LIT(KDelTestCalNameDeleteForInvalidLuidAsync ,"c:deleteforInvalidLuidLasync");
|
|
518 |
_LIT(KDelTestCalNameAsync ,"c:testcalasync");
|
|
519 |
|
|
520 |
|
|
521 |
_LIT(KDelTestCalNameDeleteForGuidLuidsAndTmAsync ,"c:deleteforGuidLuidsandtmcalasync");
|
|
522 |
|
|
523 |
_LIT(KDelTestCalNameDeleteAllAsync ,"c:deleteallcalasync");
|
|
524 |
|
|
525 |
_LIT(KDelTestCalNameDeleteForTmAsync ,"c:deleteforTmcalasync");
|
|
526 |
|
|
527 |
|
|
528 |
//Async things start here ***************************************************
|
|
529 |
|
|
530 |
void CCalDelTestCases::TestDeleteUsingGUidAsyncL()
|
|
531 |
{
|
|
532 |
iTestCaseType = KDeleteUsingGuidsAsync;
|
|
533 |
|
|
534 |
Start();
|
|
535 |
}
|
|
536 |
|
|
537 |
|
|
538 |
//Asynchronous test cases so setting the iTestCaseType as it is to be handled in RunL
|
|
539 |
void CCalDelTestCases::TestDeleteUsingLocalUidAsyncL()
|
|
540 |
{
|
|
541 |
iTestCaseType = KDeleteUsingLuidsAsync;
|
|
542 |
|
|
543 |
Start();
|
|
544 |
}
|
|
545 |
|
|
546 |
|
|
547 |
void CCalDelTestCases::TestDeleteGuidTmRgLocalUidAsyncL()
|
|
548 |
{
|
|
549 |
iTestCaseType = KDeleteUsingGuidLuidsAndTmRgAsync;
|
|
550 |
|
|
551 |
Start();
|
|
552 |
}
|
|
553 |
|
|
554 |
|
|
555 |
void CCalDelTestCases::TestDeleteInvalidGUidAsyncL()
|
|
556 |
{
|
|
557 |
iTestCaseType = KDeleteUsingInvalidGuidAsync;
|
|
558 |
|
|
559 |
Start();
|
|
560 |
}
|
|
561 |
|
|
562 |
|
|
563 |
void CCalDelTestCases::TestDeleteInvalidLUidAsyncL()
|
|
564 |
{
|
|
565 |
iTestCaseType = KDeleteUsingInvalidLuidAsync;
|
|
566 |
|
|
567 |
Start();
|
|
568 |
}
|
|
569 |
|
|
570 |
void CCalDelTestCases::TestDeleteTmRgAsyncL()
|
|
571 |
{
|
|
572 |
iTestCaseType = KDeleteUsingTmRgAsync;
|
|
573 |
|
|
574 |
Start();
|
|
575 |
}
|
|
576 |
|
|
577 |
TInt CCalDelTestCases::Result()
|
|
578 |
{
|
|
579 |
return iResult;
|
|
580 |
}
|
|
581 |
|
|
582 |
void CCalDelTestCases::ConstructL()
|
|
583 |
{
|
|
584 |
iCalendarService = CCalendarService::NewL();
|
|
585 |
|
|
586 |
iWaitSchedular = new(ELeave) CActiveSchedulerWait();
|
|
587 |
}
|
|
588 |
|
|
589 |
CCalDelTestCases::CCalDelTestCases( TInt& aResult) : CActive(EPriorityStandard), iResult(aResult)
|
|
590 |
{
|
|
591 |
|
|
592 |
}
|
|
593 |
|
|
594 |
//for the sake of ActiveObject
|
|
595 |
void CCalDelTestCases::DoCancel()
|
|
596 |
{
|
|
597 |
|
|
598 |
}
|
|
599 |
|
|
600 |
|
|
601 |
TInt CCalDelTestCases::RunError(TInt aError)
|
|
602 |
{
|
|
603 |
if(aError != KErrNotFound)
|
|
604 |
iResult = aError;
|
|
605 |
|
|
606 |
return iResult;
|
|
607 |
}
|
|
608 |
|
|
609 |
void CCalDelTestCases::RunL()
|
|
610 |
{
|
|
611 |
CCalendarFilter *getListfilter1 = CCalendarFilter::NewL();
|
|
612 |
|
|
613 |
RPointerArray<CCalInstance> calInstanceArray;
|
|
614 |
|
|
615 |
CCalendarFilter *filter = CCalendarFilter::NewL();
|
|
616 |
|
|
617 |
CEntryAttributes* entryObj = CEntryAttributes::NewL();
|
|
618 |
|
|
619 |
|
|
620 |
|
|
621 |
|
|
622 |
switch( iTestCaseType )
|
|
623 |
{
|
|
624 |
|
|
625 |
case KDeleteUsingGuidsAsync:
|
|
626 |
|
|
627 |
TUIDSet* entryUids = NULL;
|
|
628 |
|
|
629 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForGuidsAsync.operator()());
|
|
630 |
|
|
631 |
iCalendarService->AddL( KDelTestCalNameDeleteForGuidsAsync.operator()() );
|
|
632 |
|
|
633 |
addSomeEntries( KDelTestCalNameDeleteForGuidsAsync.operator()() );//adds the entries and fills up iArruids with UIDSets
|
|
634 |
|
|
635 |
entryObj->SetEntryStatusL(KNullStatus);
|
|
636 |
|
|
637 |
entryObj->SetLocalUid( iArruids[0]->iLocalUID );
|
|
638 |
|
|
639 |
getListfilter1->SetFilterTypeL( KIncludeAll );
|
|
640 |
|
|
641 |
iCalendarService->GetListL( KDelTestCalNameDeleteForGuidsAsync.operator()(), getListfilter1 , calInstanceArray );
|
|
642 |
|
|
643 |
|
|
644 |
iCalendarService->AddL(KDelTestCalNameDeleteForGuidsAsync.operator()(),entryObj,entryUids);
|
|
645 |
|
|
646 |
|
|
647 |
delete entryUids;
|
|
648 |
entryUids = NULL;
|
|
649 |
|
|
650 |
|
|
651 |
filter->AddGuidL( *(iArruids[0])->iGlobalUID );
|
|
652 |
|
|
653 |
TRAP( iResult, iCalendarService->DeleteL( KDelTestCalNameDeleteForGuidsAsync.operator()() , filter , this ) );
|
|
654 |
|
|
655 |
|
|
656 |
break;
|
|
657 |
|
|
658 |
case KDeleteUsingLuidsAsync:
|
|
659 |
|
|
660 |
|
|
661 |
|
|
662 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForLuidsAsync.operator()());
|
|
663 |
|
|
664 |
iCalendarService->AddL( KDelTestCalNameDeleteForLuidsAsync.operator()() );
|
|
665 |
|
|
666 |
|
|
667 |
|
|
668 |
AddRepeatingAppointmentEntryL(iCalendarService, KDelTestCalNameDeleteForLuidsAsync.operator()(), entryUids);
|
|
669 |
iArruids.Append(entryUids);
|
|
670 |
entryUids = NULL;
|
|
671 |
|
|
672 |
TTime stTime(TDateTime(2007, ESeptember, 28, 9, 0, 0, 0));
|
|
673 |
entryObj->SetInstanceStartTimeL(stTime);
|
|
674 |
TTime startTime(TDateTime(2007, ESeptember, 28, 14, 0, 0, 0));
|
|
675 |
entryObj->SetStartTimeL(startTime);
|
|
676 |
TTime endTime(TDateTime(2007, ESeptember, 28, 17, 30, 0, 0));
|
|
677 |
entryObj->SetEndTimeL(endTime);
|
|
678 |
|
|
679 |
entryObj->SetLocalUid( iArruids[0]->iLocalUID );
|
|
680 |
|
|
681 |
iCalendarService->AddL(KDelTestCalNameDeleteForLuidsAsync.operator()(),entryObj,entryUids);
|
|
682 |
|
|
683 |
delete entryUids;
|
|
684 |
entryUids = NULL;
|
|
685 |
|
|
686 |
filter->AddLocalUid( (iArruids[0])->iLocalUID );
|
|
687 |
|
|
688 |
|
|
689 |
TRAP( iResult, iCalendarService->DeleteL( KDelTestCalNameDeleteForLuidsAsync.operator()() , filter , this ) );
|
|
690 |
|
|
691 |
break;
|
|
692 |
|
|
693 |
case KDeleteUsingInvalidGuidAsync:
|
|
694 |
|
|
695 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForInvalidGuidAsync.operator()());
|
|
696 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameAsync.operator()());
|
|
697 |
|
|
698 |
iCalendarService->AddL( KDelTestCalNameDeleteForInvalidGuidAsync.operator()() );
|
|
699 |
iCalendarService->AddL( KDelTestCalNameAsync.operator()() );
|
|
700 |
|
|
701 |
addSomeEntries( KDelTestCalNameDeleteForInvalidGuidAsync.operator()() );//adds the entries and fills up iArruids with UIDSets
|
|
702 |
|
|
703 |
filter->AddGuidL( *(iArruids[0])->iGlobalUID );
|
|
704 |
|
|
705 |
|
|
706 |
TRAPD( iResult, iCalendarService->DeleteL( KDelTestCalNameAsync.operator()() , filter , this ) );
|
|
707 |
|
|
708 |
|
|
709 |
break;
|
|
710 |
|
|
711 |
case KDeleteUsingInvalidLuidAsync:
|
|
712 |
|
|
713 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForInvalidLuidAsync.operator()());
|
|
714 |
|
|
715 |
iCalendarService->AddL( KDelTestCalNameDeleteForInvalidLuidAsync.operator()() );
|
|
716 |
|
|
717 |
addSomeEntries( KDelTestCalNameDeleteForInvalidLuidAsync.operator()() );//adds the entries and fills up iArruids with UIDSets
|
|
718 |
|
|
719 |
|
|
720 |
filter->AddLocalUid( 3000 );
|
|
721 |
|
|
722 |
TRAP( iResult, iCalendarService->DeleteL( KDelTestCalNameDeleteForInvalidLuidAsync.operator()() , filter , this ) );
|
|
723 |
|
|
724 |
break;
|
|
725 |
|
|
726 |
case KDeleteUsingGuidLuidsAndTmRgAsync:
|
|
727 |
|
|
728 |
|
|
729 |
|
|
730 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForGuidLuidsAndTmAsync.operator()());
|
|
731 |
|
|
732 |
TRAP( iResult , iCalendarService->AddL( KDelTestCalNameDeleteForGuidLuidsAndTmAsync.operator()() ) );
|
|
733 |
|
|
734 |
addSomeEntries( KDelTestCalNameDeleteForGuidLuidsAndTmAsync.operator()() );//adds the entries and fills up iArruids with UIDSets
|
|
735 |
|
|
736 |
AddRepeatingAptEntryL(iCalendarService, KDelTestCalNameDeleteForGuidLuidsAndTmAsync.operator()(), entryUids);
|
|
737 |
|
|
738 |
iArruids.Append(entryUids);
|
|
739 |
// delete entryUids;
|
|
740 |
entryUids = NULL;
|
|
741 |
|
|
742 |
|
|
743 |
filter->AddGuidL( *(iArruids[1])->iGlobalUID );
|
|
744 |
|
|
745 |
filter->AddLocalUid( (iArruids[2])->iLocalUID );
|
|
746 |
|
|
747 |
|
|
748 |
|
|
749 |
filter->SetStartTimeL( TTime(TDateTime(2007, EAugust, 6, 8, 0, 0, 0)) );
|
|
750 |
|
|
751 |
filter->SetEndTimeL( TTime(TDateTime(2007, EOctober, 2, 0, 0, 0, 0)) );
|
|
752 |
|
|
753 |
|
|
754 |
TRAP( iResult, iCalendarService->DeleteL( KDelTestCalNameDeleteForGuidLuidsAndTmAsync.operator()() , filter , this ) );
|
|
755 |
|
|
756 |
break;
|
|
757 |
|
|
758 |
case KDeleteUsingTmRgAsync:
|
|
759 |
|
|
760 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForTmAsync.operator()());
|
|
761 |
|
|
762 |
TRAP( iResult , iCalendarService->AddL( KDelTestCalNameDeleteForTmAsync.operator()() ) );
|
|
763 |
|
|
764 |
addSomeEntries( KDelTestCalNameDeleteForTmAsync.operator()() );//adds the entries and fills up iArruids with UIDSets
|
|
765 |
|
|
766 |
AddRepeatingAptEntryL(iCalendarService, KDelTestCalNameDeleteForTmAsync.operator()(), entryUids);
|
|
767 |
|
|
768 |
iArruids.Append(entryUids);
|
|
769 |
// delete entryUids;
|
|
770 |
entryUids = NULL;
|
|
771 |
|
|
772 |
|
|
773 |
// filter->AddGuidL( *(iArruids[1])->iGlobalUID );
|
|
774 |
|
|
775 |
// filter->AddLocalUid( (iArruids[2])->iLocalUID );
|
|
776 |
|
|
777 |
|
|
778 |
|
|
779 |
filter->SetStartTimeL( TTime(TDateTime(2007, EAugust, 7, 8, 0, 0, 0)) );
|
|
780 |
|
|
781 |
filter->SetEndTimeL( TTime(TDateTime(2007, ESeptember, 20, 10, 0, 0, 0)) );
|
|
782 |
|
|
783 |
|
|
784 |
TRAP( iResult, iCalendarService->DeleteL( KDelTestCalNameDeleteForTmAsync.operator()() , filter , this ) );
|
|
785 |
|
|
786 |
break;
|
|
787 |
|
|
788 |
/* addSomeEntries( KDelTestCalNameDeleteForTmAsync.operator()() );//adds the entries and fills up iArruids with UIDSets
|
|
789 |
|
|
790 |
AddRepeatingAppointmentEntryL(iCalendarService, KDelTestCalNameDeleteForTmAsync.operator()(), entryUids);
|
|
791 |
|
|
792 |
iArruids.Append(entryUids);
|
|
793 |
// delete entryUids;
|
|
794 |
entryUids = NULL;
|
|
795 |
|
|
796 |
|
|
797 |
filter->SetStartTimeL( TTime(TDateTime(2007, EAugust, 7, 8, 0, 0, 0)) );
|
|
798 |
|
|
799 |
filter->SetEndTimeL( TTime(TDateTime(2007, ESeptember, 20, 8, 0, 0, 0)) );
|
|
800 |
|
|
801 |
TRAP( iResult, iCalendarService->DeleteL( KDelTestCalNameDeleteForTmAsync.operator()() , filter , this ) );
|
|
802 |
|
|
803 |
break; */
|
|
804 |
}
|
|
805 |
|
|
806 |
delete getListfilter1;
|
|
807 |
delete filter;
|
|
808 |
delete entryObj;
|
|
809 |
|
|
810 |
Final:
|
|
811 |
calInstanceArray.ResetAndDestroy();
|
|
812 |
}
|
|
813 |
|
|
814 |
void CCalDelTestCases::Start()
|
|
815 |
{
|
|
816 |
CActiveScheduler::Add(this);
|
|
817 |
|
|
818 |
SetActive();
|
|
819 |
|
|
820 |
TRequestStatus* temp = &iStatus;
|
|
821 |
|
|
822 |
User::RequestComplete(temp, KErrNone);
|
|
823 |
|
|
824 |
iWaitSchedular->Start();
|
|
825 |
}
|
|
826 |
|
|
827 |
|
|
828 |
void CCalDelTestCases::NotifyResultL(TInt aErrCode, TAny* aResult)
|
|
829 |
{
|
|
830 |
//******************* set iResult ****************************
|
|
831 |
iResult = aErrCode;
|
|
832 |
//******************* set iResult ****************************
|
|
833 |
|
|
834 |
//write the iResult to the corresponding file basing on the iTestCaseType
|
|
835 |
|
|
836 |
CCalendarFilter *getListfilter2 = CCalendarFilter::NewL();
|
|
837 |
|
|
838 |
RPointerArray<CCalInstance> calInstanceArray2;
|
|
839 |
|
|
840 |
getListfilter2->SetFilterTypeL( KIncludeAll );
|
|
841 |
|
|
842 |
switch( iTestCaseType )
|
|
843 |
{
|
|
844 |
|
|
845 |
case KDeleteUsingGuidsAsync:
|
|
846 |
iCalendarService->GetListL( KDelTestCalNameDeleteForGuidsAsync.operator()(), getListfilter2 , calInstanceArray2 );
|
|
847 |
|
|
848 |
TInt count = calInstanceArray2.Count();
|
|
849 |
|
|
850 |
calInstanceArray2.ResetAndDestroy();
|
|
851 |
|
|
852 |
delete getListfilter2;
|
|
853 |
|
|
854 |
|
|
855 |
if ( count != 3 && iResult == KErrNone)
|
|
856 |
{
|
|
857 |
iResult = KErrGeneral;
|
|
858 |
}
|
|
859 |
|
|
860 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForGuidsAsync.operator()());
|
|
861 |
|
|
862 |
break;
|
|
863 |
|
|
864 |
case KDeleteUsingLuidsAsync:
|
|
865 |
|
|
866 |
RPointerArray<CCalEntry> entryArray;
|
|
867 |
|
|
868 |
iCalendarService->GetListL( KDelTestCalNameDeleteForLuidsAsync.operator()(), *(iArruids[0]->iGlobalUID) , entryArray );
|
|
869 |
|
|
870 |
count = entryArray.Count();
|
|
871 |
|
|
872 |
if(count != 0)
|
|
873 |
iResult = KErrGeneral;
|
|
874 |
|
|
875 |
calInstanceArray2.ResetAndDestroy();
|
|
876 |
|
|
877 |
delete getListfilter2;
|
|
878 |
|
|
879 |
entryArray.ResetAndDestroy();
|
|
880 |
|
|
881 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForLuidsAsync.operator()());
|
|
882 |
|
|
883 |
break;
|
|
884 |
|
|
885 |
case KDeleteUsingGuidLuidsAndTmRgAsync:
|
|
886 |
|
|
887 |
iCalendarService->GetListL( KDelTestCalNameDeleteForGuidLuidsAndTmAsync.operator()(), getListfilter2 , calInstanceArray2 );
|
|
888 |
|
|
889 |
count = calInstanceArray2.Count();
|
|
890 |
|
|
891 |
calInstanceArray2.ResetAndDestroy();
|
|
892 |
|
|
893 |
delete getListfilter2;
|
|
894 |
|
|
895 |
if ( count != 19)
|
|
896 |
{
|
|
897 |
iResult = KErrGeneral;
|
|
898 |
}
|
|
899 |
|
|
900 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForGuidLuidsAndTmAsync.operator()());
|
|
901 |
|
|
902 |
break;
|
|
903 |
|
|
904 |
|
|
905 |
case KDeleteUsingInvalidGuidAsync:
|
|
906 |
|
|
907 |
iCalendarService->GetListL( KDelTestCalNameDeleteForInvalidGuidAsync.operator()(), getListfilter2 , calInstanceArray2 );
|
|
908 |
|
|
909 |
count = calInstanceArray2.Count();
|
|
910 |
|
|
911 |
calInstanceArray2.ResetAndDestroy();
|
|
912 |
|
|
913 |
delete getListfilter2;
|
|
914 |
|
|
915 |
if ( count != 4)
|
|
916 |
{
|
|
917 |
iResult = KErrGeneral;
|
|
918 |
}
|
|
919 |
|
|
920 |
|
|
921 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForInvalidGuidAsync.operator()());
|
|
922 |
|
|
923 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameAsync.operator()());
|
|
924 |
|
|
925 |
break;
|
|
926 |
case KDeleteUsingInvalidLuidAsync:
|
|
927 |
|
|
928 |
iCalendarService->GetListL( KDelTestCalNameDeleteForInvalidLuidAsync.operator()(), getListfilter2 , calInstanceArray2 );
|
|
929 |
|
|
930 |
count = calInstanceArray2.Count();
|
|
931 |
|
|
932 |
calInstanceArray2.ResetAndDestroy();
|
|
933 |
|
|
934 |
delete getListfilter2;
|
|
935 |
|
|
936 |
if ( count != 4)
|
|
937 |
{
|
|
938 |
iResult = KErrGeneral;
|
|
939 |
}
|
|
940 |
|
|
941 |
|
|
942 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForInvalidLuidAsync.operator()());
|
|
943 |
|
|
944 |
|
|
945 |
break;
|
|
946 |
|
|
947 |
case KDeleteUsingTmRgAsync:
|
|
948 |
iCalendarService->GetListL( KDelTestCalNameDeleteForTmAsync.operator()(), getListfilter2 , calInstanceArray2 );
|
|
949 |
|
|
950 |
count = calInstanceArray2.Count();
|
|
951 |
|
|
952 |
calInstanceArray2.ResetAndDestroy();
|
|
953 |
|
|
954 |
delete getListfilter2;
|
|
955 |
|
|
956 |
if ( count != 12)
|
|
957 |
{
|
|
958 |
iResult = KErrGeneral;
|
|
959 |
}
|
|
960 |
|
|
961 |
RemoveCalendarFile(iCalendarService, KDelTestCalNameDeleteForTmAsync.operator()());
|
|
962 |
|
|
963 |
break;
|
|
964 |
}
|
|
965 |
|
|
966 |
|
|
967 |
|
|
968 |
|
|
969 |
iWaitSchedular->AsyncStop();
|
|
970 |
}
|
|
971 |
|
|
972 |
|
|
973 |
void CCalDelTestCases::addSomeEntries( const TDesC& aName)
|
|
974 |
{
|
|
975 |
TUIDSet* uids = NULL;
|
|
976 |
|
|
977 |
if(AddAppointment(iCalendarService, aName, uids) == KErrNone && uids)
|
|
978 |
{
|
|
979 |
iArruids.Append(uids);
|
|
980 |
uids = NULL;
|
|
981 |
}
|
|
982 |
|
|
983 |
if(AddEvent(iCalendarService, aName, uids) == KErrNone && uids)
|
|
984 |
{
|
|
985 |
iArruids.Append(uids);
|
|
986 |
uids = NULL;
|
|
987 |
}
|
|
988 |
|
|
989 |
if(AddReminder(iCalendarService, aName, uids) == KErrNone && uids)
|
|
990 |
{
|
|
991 |
iArruids.Append(uids);
|
|
992 |
uids = NULL;
|
|
993 |
}
|
|
994 |
|
|
995 |
/* if(AddAnny(iCalendarService, aName, uids) == KErrNone && uids)
|
|
996 |
{
|
|
997 |
iArruids.Append(uids);
|
|
998 |
uids = NULL;
|
|
999 |
}*/
|
|
1000 |
|
|
1001 |
if(AddToDo(iCalendarService, aName, uids) == KErrNone && uids)
|
|
1002 |
{
|
|
1003 |
iArruids.Append(uids);
|
|
1004 |
uids = NULL;
|
|
1005 |
}
|
|
1006 |
}
|
|
1007 |
/*
|
|
1008 |
EAppt An appointment, which has a start time and end time.
|
|
1009 |
|
|
1010 |
ETodo A to-do, which can have a start time and end time (the end time is the due date), or can be undated.
|
|
1011 |
|
|
1012 |
EEvent An event, which has a start time and end time.
|
|
1013 |
|
|
1014 |
EReminder A reminder, which has a start time only.
|
|
1015 |
|
|
1016 |
EAnniv An anniversary, which has a start time and end time.
|
|
1017 |
*/
|
|
1018 |
|
|
1019 |
|
|
1020 |
void CCalDelTestCases::ExportAllToFileL( const TDesC16 &aCalFileName, const TDesC16 &aFileName)
|
|
1021 |
{
|
|
1022 |
|
|
1023 |
CCalendarExportParams *expParams = CCalendarExportParams::NewL();
|
|
1024 |
|
|
1025 |
HBufC8* buffer;
|
|
1026 |
|
|
1027 |
TRAPD( err ,iCalendarService->ExportL( aCalFileName , KFormatVCal.operator()() , expParams ,buffer ) );
|
|
1028 |
|
|
1029 |
delete buffer;
|
|
1030 |
}
|
|
1031 |
// Helper function to create a repeating entry
|
|
1032 |
|
|
1033 |
TInt AddRepeatingAptEntryL(CCalendarService* aService, const TDesC& name, TUIDSet*& uids)
|
|
1034 |
{
|
|
1035 |
|
|
1036 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryAppt );
|
|
1037 |
|
|
1038 |
entryObj->SetDescriptionL(_L("SAPI weekly meeting"));
|
|
1039 |
entryObj->SetLocationL(_L("Hara"));
|
|
1040 |
entryObj->SetEntryStatusL(KStatusConfirmed);
|
|
1041 |
|
|
1042 |
entryObj->SetMethodL(KMethodNone);
|
|
1043 |
CAttendeeInfo* organizer = CAttendeeInfo::NewL(_L("mcrasta@gmail.com"));
|
|
1044 |
organizer->SetCommonNameL(_L("SAPI"));
|
|
1045 |
entryObj->SetOrganizerDataL(organizer);
|
|
1046 |
delete organizer;
|
|
1047 |
|
|
1048 |
entryObj->SetPhoneOwnerDataL(_L("h2s@gmail.com"));
|
|
1049 |
|
|
1050 |
entryObj->SetPriority(5);
|
|
1051 |
entryObj->SetSummaryL(_L("Repeating entry"));
|
|
1052 |
|
|
1053 |
TTime stTime(TDateTime(2007, ESeptember, 15, 9, 0, 0, 0));
|
|
1054 |
entryObj->SetStartTimeL(stTime);
|
|
1055 |
|
|
1056 |
TTime endTime(TDateTime(2007, ESeptember, 15, 9, 30, 0, 0));
|
|
1057 |
entryObj->SetEndTimeL(endTime);
|
|
1058 |
|
|
1059 |
CCalAlarm* alarm = CCalAlarm::NewL();
|
|
1060 |
TTime alarmTime(TDateTime(2007,ESeptember, 15, 7, 30, 0, 0));
|
|
1061 |
//entryObj->SetAlarm(alarmTime);
|
|
1062 |
delete alarm;
|
|
1063 |
|
|
1064 |
CAttendeeInfo* attendee = CAttendeeInfo::NewL(_L("h2s@gmail.com"));
|
|
1065 |
attendee->SetRoleL(KAttRoleReqParticipant);
|
|
1066 |
attendee->SetStatusL(KAttStatusTentative);
|
|
1067 |
attendee->SetRsvp(EFalse);
|
|
1068 |
entryObj->AddAttendeeL(attendee);
|
|
1069 |
delete attendee;
|
|
1070 |
|
|
1071 |
attendee = CAttendeeInfo::NewL(_L("mdcosta@gmail.com"));
|
|
1072 |
attendee->SetCommonNameL(_L("SAPI"));
|
|
1073 |
attendee->SetRoleL(KAttRoleReqParticipant);
|
|
1074 |
attendee->SetStatusL(KAttStatusTentative);
|
|
1075 |
attendee->SetRsvp(EFalse);
|
|
1076 |
entryObj->AddAttendeeL(attendee);
|
|
1077 |
delete attendee;
|
|
1078 |
|
|
1079 |
CRepeatInfo* rrule = CRepeatInfo::NewL(TCalRRule::EDaily);
|
|
1080 |
//TCalRRule rrule(TCalRRule::EDaily);
|
|
1081 |
TCalTime startTime;
|
|
1082 |
startTime.SetTimeUtcL(stTime);
|
|
1083 |
rrule->SetStartTimeL(stTime);
|
|
1084 |
TCalTime uTime;
|
|
1085 |
uTime.SetTimeUtcL(TTime(TDateTime(2007, ESeptember, 29, 0, 0, 0, 0)));
|
|
1086 |
rrule->SetUntilTimeL(TTime(TDateTime(2007, ESeptember, 29, 9, 0, 0, 0)));
|
|
1087 |
rrule->SetWeekStart(EWednesday);
|
|
1088 |
entryObj->SetRepeatRule(rrule);
|
|
1089 |
delete rrule;
|
|
1090 |
|
|
1091 |
TTime exDate(TDateTime(2007, ESeptember, 20, 0, 0, 0, 0));
|
|
1092 |
TCalTime exTime;
|
|
1093 |
exTime.SetTimeUtcL(exDate);
|
|
1094 |
entryObj->AddExceptionDateL(exDate);
|
|
1095 |
|
|
1096 |
TTime rDate(TDateTime(2007, EOctober, 0, 9, 0, 0, 0));
|
|
1097 |
TCalTime rTime;
|
|
1098 |
rTime.SetTimeUtcL(rDate);
|
|
1099 |
entryObj->AddRepeatDateL(rDate);
|
|
1100 |
|
|
1101 |
TRAPD( errno, aService->AddL(name,entryObj,uids) );
|
|
1102 |
delete entryObj;
|
|
1103 |
return errno;
|
|
1104 |
|
|
1105 |
}
|