19
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include<LiwCommon.h>
|
|
20 |
#include<LiwVariant.h>
|
|
21 |
#include<LiwServiceHandler.h>
|
|
22 |
#include "tcalendardeletetest.h"
|
|
23 |
#include "delete.h"
|
|
24 |
#include "calendarheader.h"
|
|
25 |
|
|
26 |
_LIT8(KTestInterface, "IDataSource");
|
|
27 |
_LIT8(KTestContent, "Service.Calendar");
|
|
28 |
_LIT8(KCmd, "Delete");
|
|
29 |
_LIT8(KCmdCancel, "CancelNotification");
|
|
30 |
_LIT8(KMessageId, "MessageId");
|
|
31 |
_LIT8(KMap, "NotificationType");
|
|
32 |
_LIT8(KMessageList, "MessageList" );
|
|
33 |
_LIT8(KMessage, "Message" );
|
|
34 |
_LIT8(KErrorCode,"ErrorCode");
|
|
35 |
_LIT(KMsgType,"NewMessage");
|
|
36 |
_LIT8(KContentType,"Type");
|
|
37 |
_LIT8(KFilter,"Filter");
|
|
38 |
_LIT8(KData,"Data");
|
|
39 |
_LIT8(KCalendarList, "CalendarList");
|
|
40 |
|
|
41 |
_LIT8(KDeleteAll,"DeleteAll");
|
|
42 |
_LIT(KCalFileName1,"C:CalendarFileA");
|
|
43 |
_LIT8(KCalendarName,"CalendarName");
|
|
44 |
|
|
45 |
TInt AddProvCalendar(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar);
|
|
46 |
TInt RemoveProvCalendar(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar);
|
|
47 |
TInt AddProvToDo(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset);
|
|
48 |
TInt AddProvDayEvent(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset);
|
|
49 |
TInt AddProvAppointmentDailyRepeat(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset);
|
|
50 |
|
|
51 |
|
|
52 |
CCalCallback* CCalCallback::NewL(CActiveSchedulerWait* aWaitSchedular, MLiwInterface* aInterface, TInt& aRes, TInt& aFlag)
|
|
53 |
{
|
|
54 |
return new (ELeave) CCalCallback(aWaitSchedular, aInterface, aRes, aFlag);
|
|
55 |
}
|
|
56 |
|
|
57 |
TInt CCalCallback::HandleNotifyL(TInt aCmdId,
|
|
58 |
TInt aEventId,
|
|
59 |
CLiwGenericParamList& aEventParamList,
|
|
60 |
const CLiwGenericParamList& aInParamList)
|
|
61 |
{
|
|
62 |
TInt32 errCode;
|
|
63 |
TInt pos = 0;
|
|
64 |
|
|
65 |
// Traiverse the List and Fill in the Log Files
|
|
66 |
const TLiwGenericParam* p = aEventParamList.FindFirst(pos, KErrorCode); // Finding Error Code
|
|
67 |
if( p )
|
|
68 |
{
|
|
69 |
errCode = p->Value().AsTInt32();
|
|
70 |
}
|
|
71 |
|
|
72 |
if ( errCode == KErrNone )
|
|
73 |
{
|
|
74 |
|
|
75 |
CLiwGenericParamList* inParamList = CLiwGenericParamList::NewL();
|
|
76 |
CLiwGenericParamList* outParamList = CLiwGenericParamList::NewL();
|
|
77 |
|
|
78 |
TLiwVariant dsName;
|
|
79 |
dsName.Set(_L("CalendarEntry"));
|
|
80 |
TLiwGenericParam dsNameParam(KContentType, dsName);
|
|
81 |
inParamList->AppendL(dsNameParam);
|
|
82 |
dsName.Reset();
|
|
83 |
|
|
84 |
CLiwDefaultMap *filterMap = CLiwDefaultMap::NewL();
|
|
85 |
TLiwGenericParam filterParam(KFilter, TLiwVariant(filterMap));
|
|
86 |
inParamList->AppendL(filterParam);
|
|
87 |
filterMap->DecRef();
|
|
88 |
|
|
89 |
TLiwVariant calname;
|
|
90 |
calname.Set(KCalFileName1);;
|
|
91 |
filterMap->InsertL(KCalendarName,calname);
|
|
92 |
calname.Reset();
|
|
93 |
|
|
94 |
|
|
95 |
TInt err = 0;
|
|
96 |
TRAP(err,iInterface->ExecuteCmdL( _L8("GetList") ,*inParamList ,*outParamList));
|
|
97 |
|
|
98 |
pos = 0 ;
|
|
99 |
|
|
100 |
const TLiwGenericParam* finaloutput = outParamList->FindFirst( pos,_L8("ReturnValue"));
|
|
101 |
TInt count = 0;
|
|
102 |
CLiwMap* map;
|
|
103 |
|
|
104 |
if ( finaloutput )
|
|
105 |
{
|
|
106 |
CLiwIterable* iterlist = finaloutput->Value().AsIterable();
|
|
107 |
if(iterlist)
|
|
108 |
{
|
|
109 |
TLiwVariant data;
|
|
110 |
while(iterlist->NextL(data) )
|
|
111 |
{
|
|
112 |
count++;
|
|
113 |
}
|
|
114 |
data.Reset();
|
|
115 |
}
|
|
116 |
}
|
|
117 |
if(iOption==1)
|
|
118 |
{
|
|
119 |
if(count != 8)
|
|
120 |
errCode = KErrGeneral;
|
|
121 |
}
|
|
122 |
else if(iOption==2)
|
|
123 |
{
|
|
124 |
if(count != 5)
|
|
125 |
errCode = KErrGeneral;
|
|
126 |
}
|
|
127 |
else if(iOption==3)
|
|
128 |
{
|
|
129 |
if(count != 4)
|
|
130 |
errCode = KErrGeneral;
|
|
131 |
}
|
|
132 |
else if(iOption==4)
|
|
133 |
{
|
|
134 |
if(count != 0)
|
|
135 |
errCode = KErrGeneral;
|
|
136 |
}
|
|
137 |
inParamList->Reset();
|
|
138 |
outParamList->Reset();
|
|
139 |
RemoveProvCalendar(inParamList, outParamList, iInterface, KCalFileName1);
|
|
140 |
delete inParamList;
|
|
141 |
delete outParamList;
|
|
142 |
|
|
143 |
}
|
|
144 |
if ( iWaitSchedular && iWaitSchedular->IsStarted())
|
|
145 |
{
|
|
146 |
iWaitSchedular->AsyncStop();
|
|
147 |
}
|
|
148 |
iResult = errCode;
|
|
149 |
return errCode;
|
|
150 |
}
|
|
151 |
|
|
152 |
|
|
153 |
|
|
154 |
CTestAsync* CTestAsync::NewL()
|
|
155 |
{
|
|
156 |
CTestAsync* self = new (ELeave) CTestAsync();
|
|
157 |
self->ConstructL();
|
|
158 |
return self;
|
|
159 |
}
|
|
160 |
|
|
161 |
CTestAsync::~CTestAsync()
|
|
162 |
{
|
|
163 |
Cancel();
|
|
164 |
|
|
165 |
if( interface )
|
|
166 |
interface->Close();
|
|
167 |
|
|
168 |
delete iServiceHandler;
|
|
169 |
|
|
170 |
delete iCallback;
|
|
171 |
|
|
172 |
if(iWaitSchedular && iWaitSchedular->IsStarted())
|
|
173 |
iWaitSchedular->AsyncStop();
|
|
174 |
|
|
175 |
delete iWaitSchedular;
|
|
176 |
}
|
|
177 |
|
|
178 |
|
|
179 |
void CTestAsync::ConstructL()
|
|
180 |
{
|
|
181 |
CActiveScheduler::Add(this);
|
|
182 |
iWaitSchedular = new(ELeave) CActiveSchedulerWait();
|
|
183 |
}
|
|
184 |
|
|
185 |
|
|
186 |
CTestAsync::CTestAsync() :
|
|
187 |
CActive(EPriorityStandard)
|
|
188 |
{
|
|
189 |
interface = NULL ;
|
|
190 |
}
|
|
191 |
|
|
192 |
void CTestAsync::DoCancel()
|
|
193 |
{
|
|
194 |
|
|
195 |
}
|
|
196 |
|
|
197 |
void CTestAsync::RunL()
|
|
198 |
{
|
|
199 |
|
|
200 |
TestFunc();
|
|
201 |
|
|
202 |
}
|
|
203 |
|
|
204 |
|
|
205 |
TInt CTestAsync::Start(TInt aFlag, TBool aAsync)
|
|
206 |
{
|
|
207 |
iFlag = aFlag;
|
|
208 |
iAsync = aAsync;
|
|
209 |
if(aAsync)
|
|
210 |
{
|
|
211 |
SetActive();
|
|
212 |
TRequestStatus* temp = &iStatus;
|
|
213 |
User::RequestComplete(temp, KErrNone);
|
|
214 |
iWaitSchedular->Start();
|
|
215 |
}
|
|
216 |
else
|
|
217 |
TestFunc();
|
|
218 |
|
|
219 |
return iResult;
|
|
220 |
}
|
|
221 |
|
|
222 |
|
|
223 |
int CTestAsync::TestFunc()
|
|
224 |
{
|
|
225 |
iServiceHandler = CLiwServiceHandler::NewL();
|
|
226 |
|
|
227 |
CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL());
|
|
228 |
CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL());
|
|
229 |
|
|
230 |
|
|
231 |
TInt err;
|
|
232 |
|
|
233 |
RCriteriaArray interest;
|
|
234 |
CleanupClosePushL(interest);
|
|
235 |
|
|
236 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KTestInterface,KTestContent);
|
|
237 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase));
|
|
238 |
CleanupStack::PushL(crit);
|
|
239 |
interest.AppendL(crit);
|
|
240 |
iServiceHandler->AttachL(interest);
|
|
241 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam);
|
|
242 |
|
|
243 |
TInt pos = 0;
|
|
244 |
|
|
245 |
outparam->FindFirst( pos, KTestInterface );
|
|
246 |
if(pos != KErrNotFound)
|
|
247 |
{
|
|
248 |
interface = (*outparam)[pos].Value().AsInterface();
|
|
249 |
}
|
|
250 |
|
|
251 |
CleanupStack::PopAndDestroy(crit);
|
|
252 |
CleanupStack::PopAndDestroy(&interest);
|
|
253 |
|
|
254 |
outparam->Reset();
|
|
255 |
inparam->Reset();
|
|
256 |
|
|
257 |
RemoveProvCalendar(inparam, outparam, interface, KCalFileName1);
|
|
258 |
AddProvCalendar(inparam, outparam, interface, KCalFileName1);
|
|
259 |
|
|
260 |
TUIDSet* uidset;
|
|
261 |
//RPointerArray<TUIDSet> arruids(5);
|
|
262 |
|
|
263 |
AddProvToDo(inparam, outparam, interface, KCalFileName1 ,uidset);
|
|
264 |
delete uidset;
|
|
265 |
|
|
266 |
AddProvDayEvent(inparam, outparam, interface, KCalFileName1 ,uidset) ;
|
|
267 |
delete uidset;
|
|
268 |
|
|
269 |
AddProvAppointmentDailyRepeat(inparam, outparam, interface, KCalFileName1 ,uidset );
|
|
270 |
delete uidset;
|
|
271 |
|
|
272 |
TLiwVariant dsName;
|
|
273 |
dsName.Set(_L("CalendarEntry"));
|
|
274 |
TLiwGenericParam dsNameParam(KContentType, dsName);
|
|
275 |
inparam->AppendL(dsNameParam);
|
|
276 |
dsName.Reset();
|
|
277 |
|
|
278 |
CLiwDefaultMap *filterMap = CLiwDefaultMap::NewL();
|
|
279 |
TLiwGenericParam filterParam(KData, TLiwVariant(filterMap));
|
|
280 |
inparam->AppendL(filterParam);
|
|
281 |
filterMap->DecRef();
|
|
282 |
|
|
283 |
filterMap->InsertL(KCalendarName,TLiwVariant(_L("C:CalendarFileA")));
|
|
284 |
if(iFlag == 1)
|
|
285 |
{
|
|
286 |
filterMap->InsertL(_L8("StartRange"), TLiwVariant(TTime(TDateTime(2007,EAugust,19,0,0,0,0))));
|
|
287 |
filterMap->InsertL(_L8("EndRange"), TLiwVariant(TTime(TDateTime(2007,EOctober,24,0,0,0,0))));
|
|
288 |
}
|
|
289 |
|
|
290 |
else if(iFlag == 2)
|
|
291 |
{
|
|
292 |
filterMap->InsertL(_L8("EndRange"), TLiwVariant(TTime(TDateTime(2007,EOctober,25,11,0,0,0))));
|
|
293 |
}
|
|
294 |
|
|
295 |
else if(iFlag == 3)
|
|
296 |
{
|
|
297 |
filterMap->InsertL(_L8("StartRange"), TLiwVariant(TTime(TDateTime(2007,EOctober,25,10,0,0,0))));
|
|
298 |
}
|
|
299 |
|
|
300 |
else if(iFlag == 4)
|
|
301 |
{
|
|
302 |
filterMap->InsertL(_L8("DeleteAll"), TLiwVariant(TBool(ETrue)));
|
|
303 |
}
|
|
304 |
|
|
305 |
if(iAsync)
|
|
306 |
{
|
|
307 |
iCallback = CCalCallback::NewL(iWaitSchedular, interface, iResult, iFlag);
|
|
308 |
TRAPD(err1 ,interface->ExecuteCmdL(KCmd, *inparam, *outparam, KLiwOptASyncronous, iCallback));
|
|
309 |
inparam->Reset();
|
|
310 |
outparam->Reset();
|
|
311 |
}
|
|
312 |
else
|
|
313 |
{
|
|
314 |
TRAPD(err1 ,interface->ExecuteCmdL(KCmd, *inparam, *outparam));
|
|
315 |
const TLiwGenericParam* p = outparam->FindFirst(pos, KErrorCode); // Finding Error Code
|
|
316 |
TInt errCode;
|
|
317 |
if( p )
|
|
318 |
{
|
|
319 |
errCode = p->Value().AsTInt32();
|
|
320 |
}
|
|
321 |
inparam->Reset();
|
|
322 |
outparam->Reset();
|
|
323 |
|
|
324 |
if ( errCode == KErrNone )
|
|
325 |
{
|
|
326 |
TLiwGenericParam dsNameParam(KContentType, TLiwVariant(_L("CalendarEntry")));
|
|
327 |
inparam->AppendL(dsNameParam);
|
|
328 |
|
|
329 |
CLiwDefaultMap *filterMap = CLiwDefaultMap::NewL();
|
|
330 |
TLiwGenericParam filterParam(KFilter, TLiwVariant(filterMap));
|
|
331 |
inparam->AppendL(filterParam);
|
|
332 |
filterMap->DecRef();
|
|
333 |
|
|
334 |
filterMap->InsertL(KCalendarName,TLiwVariant(_L("C:CalendarFileA")));
|
|
335 |
|
|
336 |
|
|
337 |
TInt err = 0;
|
|
338 |
TRAP(err,interface->ExecuteCmdL( _L8("GetList") ,*inparam ,*outparam));
|
|
339 |
|
|
340 |
pos = 0 ;
|
|
341 |
|
|
342 |
const TLiwGenericParam* finaloutput = outparam->FindFirst( pos,_L8("ReturnValue"));
|
|
343 |
TInt count = 0;
|
|
344 |
CLiwMap* map;
|
|
345 |
|
|
346 |
if ( finaloutput )
|
|
347 |
{
|
|
348 |
CLiwIterable* iterlist = finaloutput->Value().AsIterable();
|
|
349 |
if(iterlist)
|
|
350 |
{
|
|
351 |
TLiwVariant data;
|
|
352 |
while(iterlist->NextL(data) )
|
|
353 |
{
|
|
354 |
count++;
|
|
355 |
}
|
|
356 |
data.Reset();
|
|
357 |
}
|
|
358 |
}
|
|
359 |
if(iFlag==1)
|
|
360 |
{
|
|
361 |
if(count != 8)
|
|
362 |
errCode = KErrGeneral;
|
|
363 |
}
|
|
364 |
else if(iFlag==2)
|
|
365 |
{
|
|
366 |
if(count != 5)
|
|
367 |
errCode = KErrGeneral;
|
|
368 |
}
|
|
369 |
else if(iFlag==3)
|
|
370 |
{
|
|
371 |
if(count != 4)
|
|
372 |
errCode = KErrGeneral;
|
|
373 |
}
|
|
374 |
else if(iFlag==4)
|
|
375 |
{
|
|
376 |
if(count != 0)
|
|
377 |
errCode = KErrGeneral;
|
|
378 |
}
|
|
379 |
inparam->Reset();
|
|
380 |
outparam->Reset();
|
|
381 |
RemoveProvCalendar(inparam, outparam, interface, KCalFileName1);
|
|
382 |
}
|
|
383 |
if ( iWaitSchedular && iWaitSchedular->IsStarted())
|
|
384 |
{
|
|
385 |
iWaitSchedular->AsyncStop();
|
|
386 |
}
|
|
387 |
iResult = errCode;
|
|
388 |
return errCode;
|
|
389 |
}
|
|
390 |
}
|
|
391 |
|
|
392 |
|
|
393 |
|
|
394 |
int DeleteAllAsync(int flag, TBool async)
|
|
395 |
{
|
|
396 |
__UHEAP_MARK;
|
|
397 |
CTestAsync* test = CTestAsync::NewL();
|
|
398 |
int res = test->Start(flag, async);
|
|
399 |
delete test;
|
|
400 |
__UHEAP_MARKEND;
|
|
401 |
return res;
|
|
402 |
|
|
403 |
}
|
|
404 |
|
|
405 |
|
|
406 |
CTestSync* CTestSync::NewL()
|
|
407 |
{
|
|
408 |
CTestSync* self = new (ELeave) CTestSync();
|
|
409 |
self->ConstructL();
|
|
410 |
return self;
|
|
411 |
}
|
|
412 |
|
|
413 |
CTestSync::~CTestSync()
|
|
414 |
{
|
|
415 |
if( interface )
|
|
416 |
interface->Close();
|
|
417 |
|
|
418 |
delete iServiceHandler;
|
|
419 |
}
|
|
420 |
|
|
421 |
|
|
422 |
void CTestSync::ConstructL()
|
|
423 |
{
|
|
424 |
}
|
|
425 |
|
|
426 |
|
|
427 |
CTestSync::CTestSync()
|
|
428 |
{
|
|
429 |
interface = NULL ;
|
|
430 |
}
|
|
431 |
|
|
432 |
int CTestSync::TestFunc()
|
|
433 |
{
|
|
434 |
iServiceHandler = CLiwServiceHandler::NewL();
|
|
435 |
|
|
436 |
CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL());
|
|
437 |
CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL());
|
|
438 |
|
|
439 |
|
|
440 |
TInt err;
|
|
441 |
RCriteriaArray interest;
|
|
442 |
CleanupClosePushL(interest);
|
|
443 |
|
|
444 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KTestInterface,KTestContent);
|
|
445 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase));
|
|
446 |
CleanupStack::PushL(crit);
|
|
447 |
interest.AppendL(crit);
|
|
448 |
|
|
449 |
iServiceHandler->AttachL(interest);
|
|
450 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam);
|
|
451 |
|
|
452 |
TInt pos = 0;
|
|
453 |
|
|
454 |
outparam->FindFirst( pos, KTestInterface );
|
|
455 |
if(pos != KErrNotFound)
|
|
456 |
{
|
|
457 |
interface = (*outparam)[pos].Value().AsInterface();
|
|
458 |
}
|
|
459 |
CleanupStack::PopAndDestroy(crit);
|
|
460 |
CleanupStack::PopAndDestroy(&interest);
|
|
461 |
|
|
462 |
outparam->Reset();
|
|
463 |
inparam->Reset();
|
|
464 |
TLiwVariant dsName;
|
|
465 |
dsName.Set(_L("CalendarEntry"));
|
|
466 |
TLiwGenericParam dsNameParam(KContentType, dsName);
|
|
467 |
inparam->AppendL(dsNameParam);
|
|
468 |
dsName.Reset();
|
|
469 |
|
|
470 |
CLiwDefaultMap *filterMap = CLiwDefaultMap::NewL();
|
|
471 |
TLiwGenericParam filterParam(KData, TLiwVariant(filterMap));
|
|
472 |
inparam->AppendL(filterParam);
|
|
473 |
filterMap->DecRef();
|
|
474 |
|
|
475 |
TLiwVariant calname;
|
|
476 |
calname.Set(KCalFileName1);;
|
|
477 |
filterMap->InsertL(_L8("CalendarName"),calname);
|
|
478 |
calname.Reset();
|
|
479 |
|
|
480 |
TLiwVariant flag;
|
|
481 |
flag.Set(ETrue);;
|
|
482 |
filterMap->InsertL(KDeleteAll,flag);
|
|
483 |
flag.Reset();
|
|
484 |
|
|
485 |
TRAPD(err1 ,interface->ExecuteCmdL(KCmd, *inparam, *outparam/*, KLiwOptASyncronous, iCallback*/));
|
|
486 |
inparam->Reset();
|
|
487 |
outparam->Reset();
|
|
488 |
return err1;
|
|
489 |
}
|
|
490 |
|
|
491 |
|
|
492 |
int DeleteAllSync()
|
|
493 |
{
|
|
494 |
__UHEAP_MARK;
|
|
495 |
CTestSync* test = CTestSync::NewL();
|
|
496 |
int res = test->TestFunc();
|
|
497 |
delete test;
|
|
498 |
__UHEAP_MARKEND;
|
|
499 |
return 0;
|
|
500 |
|
|
501 |
}
|
|
502 |
|
|
503 |
int DeleteDefaultSync()
|
|
504 |
{
|
|
505 |
__UHEAP_MARK;
|
|
506 |
CTestSync* test = CTestSync::NewL();
|
|
507 |
int res = test->DeleteDefaultCalendar();
|
|
508 |
delete test;
|
|
509 |
__UHEAP_MARKEND;
|
|
510 |
return res;
|
|
511 |
|
|
512 |
}
|
|
513 |
int DeleteWrongSync()
|
|
514 |
{
|
|
515 |
__UHEAP_MARK;
|
|
516 |
CTestSync* test = CTestSync::NewL();
|
|
517 |
int res = test->DeleteWrongCal();
|
|
518 |
delete test;
|
|
519 |
__UHEAP_MARKEND;
|
|
520 |
return res;
|
|
521 |
|
|
522 |
}
|
|
523 |
|
|
524 |
int CTestSync::DeleteDefaultCalendar()
|
|
525 |
{
|
|
526 |
iServiceHandler = CLiwServiceHandler::NewL();
|
|
527 |
|
|
528 |
CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL());
|
|
529 |
CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL());
|
|
530 |
|
|
531 |
|
|
532 |
TInt err;
|
|
533 |
RCriteriaArray interest;
|
|
534 |
CleanupClosePushL(interest);
|
|
535 |
|
|
536 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KTestInterface,KTestContent);
|
|
537 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase));
|
|
538 |
CleanupStack::PushL(crit);
|
|
539 |
interest.AppendL(crit);
|
|
540 |
|
|
541 |
iServiceHandler->AttachL(interest);
|
|
542 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam);
|
|
543 |
|
|
544 |
TInt pos = 0;
|
|
545 |
|
|
546 |
outparam->FindFirst( pos, KTestInterface );
|
|
547 |
if(pos != KErrNotFound)
|
|
548 |
{
|
|
549 |
interface = (*outparam)[pos].Value().AsInterface();
|
|
550 |
}
|
|
551 |
CleanupStack::PopAndDestroy(crit);
|
|
552 |
CleanupStack::PopAndDestroy(&interest);
|
|
553 |
|
|
554 |
outparam->Reset();
|
|
555 |
inparam->Reset();
|
|
556 |
TLiwVariant dsName;
|
|
557 |
dsName.Set(_L("Calendar"));
|
|
558 |
TLiwGenericParam dsNameParam(KContentType, dsName);
|
|
559 |
inparam->AppendL(dsNameParam);
|
|
560 |
dsName.Reset();
|
|
561 |
|
|
562 |
CLiwDefaultMap *filterMap = CLiwDefaultMap::NewL();
|
|
563 |
TLiwGenericParam filterParam(KData, TLiwVariant(filterMap));
|
|
564 |
inparam->AppendL(filterParam);
|
|
565 |
filterMap->DecRef();
|
|
566 |
|
|
567 |
filterMap->InsertL(KCalendarName,TLiwVariant(_L("C:Calendar")));
|
|
568 |
|
|
569 |
TRAPD(err1 ,interface->ExecuteCmdL(KCmd, *inparam, *outparam/*, KLiwOptASyncronous, iCallback*/));
|
|
570 |
TInt errCode;
|
|
571 |
const TLiwGenericParam* p = outparam->FindFirst(pos, KErrorCode); // Finding Error Code
|
|
572 |
if( p )
|
|
573 |
{
|
|
574 |
errCode = p->Value().AsTInt32();
|
|
575 |
}
|
|
576 |
inparam->Reset();
|
|
577 |
outparam->Reset();
|
|
578 |
return errCode;
|
|
579 |
}
|
|
580 |
|
|
581 |
int CTestSync::DeleteWrongCal()
|
|
582 |
{
|
|
583 |
iServiceHandler = CLiwServiceHandler::NewL();
|
|
584 |
|
|
585 |
CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL());
|
|
586 |
CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL());
|
|
587 |
|
|
588 |
|
|
589 |
TInt err;
|
|
590 |
RCriteriaArray interest;
|
|
591 |
CleanupClosePushL(interest);
|
|
592 |
|
|
593 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KTestInterface,KTestContent);
|
|
594 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase));
|
|
595 |
CleanupStack::PushL(crit);
|
|
596 |
interest.AppendL(crit);
|
|
597 |
|
|
598 |
iServiceHandler->AttachL(interest);
|
|
599 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam);
|
|
600 |
|
|
601 |
TInt pos = 0;
|
|
602 |
|
|
603 |
outparam->FindFirst( pos, KTestInterface );
|
|
604 |
if(pos != KErrNotFound)
|
|
605 |
{
|
|
606 |
interface = (*outparam)[pos].Value().AsInterface();
|
|
607 |
}
|
|
608 |
CleanupStack::PopAndDestroy(crit);
|
|
609 |
CleanupStack::PopAndDestroy(&interest);
|
|
610 |
|
|
611 |
outparam->Reset();
|
|
612 |
inparam->Reset();
|
|
613 |
TLiwVariant dsName;
|
|
614 |
dsName.Set(_L("Calendar"));
|
|
615 |
TLiwGenericParam dsNameParam(KContentType, dsName);
|
|
616 |
inparam->AppendL(dsNameParam);
|
|
617 |
dsName.Reset();
|
|
618 |
|
|
619 |
CLiwDefaultMap *filterMap = CLiwDefaultMap::NewL();
|
|
620 |
TLiwGenericParam filterParam(KData, TLiwVariant(filterMap));
|
|
621 |
inparam->AppendL(filterParam);
|
|
622 |
filterMap->DecRef();
|
|
623 |
|
|
624 |
filterMap->InsertL(KCalendarName,TLiwVariant(_L("C:CalendarFileZ")));
|
|
625 |
|
|
626 |
TRAPD(err1 ,interface->ExecuteCmdL(KCmd, *inparam, *outparam/*, KLiwOptASyncronous, iCallback*/));
|
|
627 |
TInt errCode;
|
|
628 |
const TLiwGenericParam* p = outparam->FindFirst(pos, KErrorCode); // Finding Error Code
|
|
629 |
if( p )
|
|
630 |
{
|
|
631 |
errCode = p->Value().AsTInt32();
|
|
632 |
}
|
|
633 |
inparam->Reset();
|
|
634 |
outparam->Reset();
|
|
635 |
return errCode;
|
|
636 |
} |