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 |
// INCLUDE FILES
|
|
22 |
#include <e32svr.h>
|
|
23 |
#include <StifParser.h>
|
|
24 |
//#include <SAPI_TEST\testprg.h>
|
|
25 |
#include <Stiftestinterface.h>
|
|
26 |
|
|
27 |
|
|
28 |
#include <BADESCA.H>
|
|
29 |
#include<LiwServiceHandler.h>
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
#include "tcalendargetlisttest.h"
|
|
34 |
#include "calendarheader.h"
|
|
35 |
//#include "calendarconstants.h"
|
|
36 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
37 |
|
|
38 |
TInt RemoveProvCalendar(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar);
|
|
39 |
TInt AddProvCalendar(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar);
|
|
40 |
TInt AddProvAppointmentDailyRepeat(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset);
|
|
41 |
TInt AddProvEvent(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset);
|
|
42 |
TInt AddAppointmentProvLocal(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset);
|
|
43 |
|
|
44 |
void GetLocalUid( const TDesC& aLocalUid, TCalLocalUid& aOutLocalUid );
|
|
45 |
void GetGlobalUid( const TDesC& aGlobalUid, TDes8& aOutGlobalUid );
|
|
46 |
TDesC& GetEntry(MLiwInterface* interface, CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, TPtrC globaluid, const TDesC& calname);
|
|
47 |
|
|
48 |
_LIT8(KIDataSource, "IDataSource");
|
|
49 |
_LIT8(KService, "Service.Calendar");
|
|
50 |
|
|
51 |
_LIT8(KCmdGetList,"GetList");
|
|
52 |
_LIT8(KCmdDelete,"Delete");
|
|
53 |
_LIT8(KCmdAdd,"Add");
|
|
54 |
_LIT8(KContentType, "Type");
|
|
55 |
_LIT8(KCalendarName, "CalendarName");
|
|
56 |
_LIT8(KFilter, "Filter");
|
|
57 |
const TChar KUidSeparator = ':';
|
|
58 |
|
|
59 |
// -----------------------------------------------------------------------------
|
|
60 |
// CTChangeStatusTest::Delete
|
|
61 |
// Delete here all resources allocated and opened from test methods.
|
|
62 |
// Called from destructor.
|
|
63 |
// -----------------------------------------------------------------------------
|
|
64 |
//
|
|
65 |
void CTCalendarGetListTest::Delete()
|
|
66 |
{
|
|
67 |
|
|
68 |
}
|
|
69 |
|
|
70 |
// -----------------------------------------------------------------------------
|
|
71 |
// CTChangeStatusTest::RunMethodL
|
|
72 |
// Run specified method. Contains also table of test mothods and their names.
|
|
73 |
// -----------------------------------------------------------------------------
|
|
74 |
//
|
|
75 |
TInt CTCalendarGetListTest::RunMethodL(
|
|
76 |
CStifItemParser& aItem )
|
|
77 |
{
|
|
78 |
|
|
79 |
static TStifFunctionInfo const KFunctions[] =
|
|
80 |
{
|
|
81 |
// Copy this line for every implemented function.
|
|
82 |
// First string is the function name used in TestScripter script file.
|
|
83 |
// Second is the actual implementation member function.
|
|
84 |
//TRY( "SendMessage", CTDeleteMessageTest::SendMessage ),
|
|
85 |
|
|
86 |
ENTRY( "GetListCalendar", CTCalendarGetListTest::GetListCalendar ),
|
|
87 |
ENTRY( "GetDefaultCalendar", CTCalendarGetListTest::GetDefaultCalendar ),
|
|
88 |
ENTRY( "GetListGUidFilter", CTCalendarGetListTest::GetListGUidFilter ),
|
|
89 |
ENTRY( "GetListLocalUidFilter", CTCalendarGetListTest::GetListLocalUidFilter ),
|
|
90 |
ENTRY( "GetListTimeRangeFilter",CTCalendarGetListTest::GetListTimeRangeFilter ),
|
|
91 |
ENTRY( "GetListTextFilter", CTCalendarGetListTest::GetListTextFilter ),
|
|
92 |
ENTRY( "GetListTypeFilter", CTCalendarGetListTest::GetListTypeFilter ),
|
|
93 |
ENTRY( "GetListInvalidCalName", CTCalendarGetListTest::GetListInvalidCalName ),
|
|
94 |
ENTRY( "GetListInvalidGUID" , CTCalendarGetListTest::GetListInvalidGUID ),
|
|
95 |
ENTRY( "GetListInvalidLUID" , CTCalendarGetListTest::GetListInvalidLUID ),
|
|
96 |
};
|
|
97 |
|
|
98 |
const TInt count = sizeof( KFunctions ) /
|
|
99 |
sizeof( TStifFunctionInfo );
|
|
100 |
|
|
101 |
return RunInternalL( KFunctions, count, aItem );
|
|
102 |
|
|
103 |
}
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
_LIT(KSearchTexttest ,"Meeting");
|
|
108 |
|
|
109 |
_LIT(KDefaultCalendar ,"C:Calendar");
|
|
110 |
|
|
111 |
_LIT(KTestCal1File, "C:getlistcal1");
|
|
112 |
_LIT(KTestCal2File, "C:getlistcal2");
|
|
113 |
|
|
114 |
|
|
115 |
//
|
|
116 |
//Whats done here?
|
|
117 |
// Get all the Calendars in the system using GetList of CCalendarService and output that to GetListallCalendars.txt
|
|
118 |
//
|
|
119 |
TInt CTCalendarGetListTest::GetListCalendar(CStifItemParser& /*aItem*/ )
|
|
120 |
{
|
|
121 |
TInt result=KErrNone;
|
|
122 |
|
|
123 |
__UHEAP_MARK;
|
|
124 |
// Iter-3 test work
|
|
125 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL();
|
|
126 |
|
|
127 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL());
|
|
128 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL());
|
|
129 |
|
|
130 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService);
|
|
131 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase));
|
|
132 |
|
|
133 |
RCriteriaArray a;
|
|
134 |
|
|
135 |
a.AppendL(crit);
|
|
136 |
|
|
137 |
iServiceHandler->AttachL(a);
|
|
138 |
|
|
139 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList);
|
|
140 |
|
|
141 |
delete crit;
|
|
142 |
crit = NULL;
|
|
143 |
a.Reset();
|
|
144 |
|
|
145 |
TInt pos = 0;
|
|
146 |
MLiwInterface* interface = NULL;
|
|
147 |
outParamList->FindFirst(pos,KIDataSource );
|
|
148 |
if(pos != KErrNotFound)
|
|
149 |
{
|
|
150 |
interface = (*outParamList)[pos].Value().AsInterface();
|
|
151 |
}
|
|
152 |
|
|
153 |
inParamList->Reset();
|
|
154 |
outParamList->Reset();
|
|
155 |
// Iter-2 same
|
|
156 |
|
|
157 |
TInt added = 0;
|
|
158 |
|
|
159 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
160 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File);
|
|
161 |
|
|
162 |
|
|
163 |
if( AddProvCalendar(inParamList, outParamList, interface, KTestCal1File) == KErrNone)
|
|
164 |
{
|
|
165 |
added++;
|
|
166 |
};
|
|
167 |
|
|
168 |
if( AddProvCalendar(inParamList, outParamList, interface, KTestCal2File) == KErrNone)
|
|
169 |
{
|
|
170 |
added++;
|
|
171 |
};
|
|
172 |
|
|
173 |
TLiwVariant content(_L("Calendar"));
|
|
174 |
TLiwGenericParam element1;
|
|
175 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
176 |
inParamList->AppendL(element1);
|
|
177 |
content.Reset();
|
|
178 |
element1.Reset();
|
|
179 |
|
|
180 |
|
|
181 |
TInt err = 0;
|
|
182 |
TRAP(err,interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList));
|
|
183 |
pos = 0 ;
|
|
184 |
|
|
185 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue"));
|
|
186 |
|
|
187 |
if(output)
|
|
188 |
{
|
|
189 |
CLiwIterable* iterlist = output->Value().AsIterable();
|
|
190 |
|
|
191 |
TLiwVariant data;
|
|
192 |
TInt itemfound = 0;
|
|
193 |
|
|
194 |
while( iterlist->NextL(data))
|
|
195 |
{
|
|
196 |
itemfound++;
|
|
197 |
}
|
|
198 |
|
|
199 |
data.Reset();
|
|
200 |
|
|
201 |
if(itemfound < added)
|
|
202 |
result = KErrGeneral;
|
|
203 |
}
|
|
204 |
|
|
205 |
inParamList->Reset();
|
|
206 |
outParamList->Reset();
|
|
207 |
|
|
208 |
interface->Close();
|
|
209 |
iServiceHandler->Reset();
|
|
210 |
delete iServiceHandler;
|
|
211 |
|
|
212 |
__UHEAP_MARKEND;
|
|
213 |
|
|
214 |
return result;
|
|
215 |
|
|
216 |
}
|
|
217 |
|
|
218 |
TInt CTCalendarGetListTest::GetDefaultCalendar(CStifItemParser& /*aItem*/ )
|
|
219 |
{
|
|
220 |
TInt result=KErrNone;
|
|
221 |
|
|
222 |
__UHEAP_MARK;
|
|
223 |
// Iter-3 test work
|
|
224 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL();
|
|
225 |
|
|
226 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL());
|
|
227 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL());
|
|
228 |
|
|
229 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService);
|
|
230 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase));
|
|
231 |
|
|
232 |
RCriteriaArray a;
|
|
233 |
|
|
234 |
a.AppendL(crit);
|
|
235 |
|
|
236 |
iServiceHandler->AttachL(a);
|
|
237 |
|
|
238 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList);
|
|
239 |
|
|
240 |
delete crit;
|
|
241 |
crit = NULL;
|
|
242 |
a.Reset();
|
|
243 |
|
|
244 |
TInt pos = 0;
|
|
245 |
MLiwInterface* interface = NULL;
|
|
246 |
outParamList->FindFirst(pos,KIDataSource );
|
|
247 |
if(pos != KErrNotFound)
|
|
248 |
{
|
|
249 |
interface = (*outParamList)[pos].Value().AsInterface();
|
|
250 |
}
|
|
251 |
|
|
252 |
inParamList->Reset();
|
|
253 |
outParamList->Reset();
|
|
254 |
// Iter-2 same
|
|
255 |
|
|
256 |
TLiwVariant content(_L("Calendar"));
|
|
257 |
TLiwGenericParam element1;
|
|
258 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
259 |
inParamList->AppendL(element1);
|
|
260 |
content.Reset();
|
|
261 |
element1.Reset();
|
|
262 |
|
|
263 |
|
|
264 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
265 |
CleanupStack::PushL(map);
|
|
266 |
|
|
267 |
map->InsertL(_L8("DefaultCalendar"), TLiwVariant(ETrue) );
|
|
268 |
|
|
269 |
TLiwVariant filterparam(map);
|
|
270 |
TLiwGenericParam element ;
|
|
271 |
element.SetNameAndValueL(_L8("Filter"),filterparam);
|
|
272 |
filterparam.Reset();
|
|
273 |
|
|
274 |
inParamList->AppendL(element);
|
|
275 |
element.Reset();
|
|
276 |
map->DecRef();
|
|
277 |
CleanupStack::Pop(map);
|
|
278 |
|
|
279 |
TInt err = 0;
|
|
280 |
TRAP(err,interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList));
|
|
281 |
pos = 0 ;
|
|
282 |
|
|
283 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue"));
|
|
284 |
|
|
285 |
if(output)
|
|
286 |
{
|
|
287 |
CLiwIterable* iterlist = output->Value().AsIterable();
|
|
288 |
|
|
289 |
TLiwVariant data;
|
|
290 |
TInt itemfound = 0;
|
|
291 |
|
|
292 |
while( iterlist->NextL(data))
|
|
293 |
{
|
|
294 |
itemfound++;
|
|
295 |
}
|
|
296 |
|
|
297 |
data.Reset();
|
|
298 |
|
|
299 |
if(itemfound != 1)
|
|
300 |
result = KErrGeneral;
|
|
301 |
}
|
|
302 |
|
|
303 |
inParamList->Reset();
|
|
304 |
outParamList->Reset();
|
|
305 |
|
|
306 |
interface->Close();
|
|
307 |
iServiceHandler->Reset();
|
|
308 |
delete iServiceHandler;
|
|
309 |
|
|
310 |
__UHEAP_MARKEND;
|
|
311 |
|
|
312 |
return result;
|
|
313 |
|
|
314 |
}
|
|
315 |
|
|
316 |
|
|
317 |
TInt CTCalendarGetListTest::GetListGUidFilter(CStifItemParser& /*aItem*/ )
|
|
318 |
{
|
|
319 |
TInt result=KErrNone;
|
|
320 |
|
|
321 |
__UHEAP_MARK;
|
|
322 |
// Iter-3 test work
|
|
323 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL();
|
|
324 |
|
|
325 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL());
|
|
326 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL());
|
|
327 |
|
|
328 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService);
|
|
329 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase));
|
|
330 |
|
|
331 |
RCriteriaArray a;
|
|
332 |
|
|
333 |
a.AppendL(crit);
|
|
334 |
|
|
335 |
iServiceHandler->AttachL(a);
|
|
336 |
|
|
337 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList);
|
|
338 |
|
|
339 |
delete crit;
|
|
340 |
crit = NULL;
|
|
341 |
a.Reset();
|
|
342 |
|
|
343 |
TInt pos = 0;
|
|
344 |
MLiwInterface* interface = NULL;
|
|
345 |
outParamList->FindFirst(pos,KIDataSource );
|
|
346 |
if(pos != KErrNotFound)
|
|
347 |
{
|
|
348 |
interface = (*outParamList)[pos].Value().AsInterface();
|
|
349 |
}
|
|
350 |
|
|
351 |
inParamList->Reset();
|
|
352 |
outParamList->Reset();
|
|
353 |
|
|
354 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
355 |
|
|
356 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
357 |
|
|
358 |
RPointerArray<TUIDSet> arruids(5);
|
|
359 |
|
|
360 |
TUIDSet* uids = NULL;
|
|
361 |
|
|
362 |
if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids)
|
|
363 |
{
|
|
364 |
arruids.Append(uids);
|
|
365 |
uids = NULL;
|
|
366 |
}
|
|
367 |
|
|
368 |
if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids)
|
|
369 |
{
|
|
370 |
arruids.Append(uids);
|
|
371 |
uids = NULL;
|
|
372 |
}
|
|
373 |
|
|
374 |
if ( arruids.Count() > 0 )
|
|
375 |
{
|
|
376 |
TLiwVariant content(_L("CalendarEntry"));
|
|
377 |
TLiwGenericParam element1;
|
|
378 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
379 |
inParamList->AppendL(element1);
|
|
380 |
content.Reset();
|
|
381 |
element1.Reset();
|
|
382 |
|
|
383 |
|
|
384 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
385 |
CleanupStack::PushL(map);
|
|
386 |
|
|
387 |
map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) );
|
|
388 |
|
|
389 |
TBuf<100> gid;
|
|
390 |
gid.Copy( arruids[0]->iGlobalUID->Des() );
|
|
391 |
map->InsertL(_L8("id"), TLiwVariant(gid) );
|
|
392 |
|
|
393 |
TLiwVariant filterparam(map);
|
|
394 |
TLiwGenericParam element ;
|
|
395 |
element.SetNameAndValueL(_L8("Filter"),filterparam);
|
|
396 |
filterparam.Reset();
|
|
397 |
|
|
398 |
inParamList->AppendL(element);
|
|
399 |
element.Reset();
|
|
400 |
map->DecRef();
|
|
401 |
CleanupStack::Pop(map);
|
|
402 |
|
|
403 |
TInt err = 0;
|
|
404 |
TRAP(err,interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList));
|
|
405 |
pos = 0 ;
|
|
406 |
|
|
407 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue"));
|
|
408 |
|
|
409 |
if(output)
|
|
410 |
{
|
|
411 |
CLiwIterable* iterlist = output->Value().AsIterable();
|
|
412 |
|
|
413 |
TLiwVariant data;
|
|
414 |
TInt itemfound = 0;
|
|
415 |
TBool uidmatched = EFalse;
|
|
416 |
|
|
417 |
while( iterlist->NextL(data))
|
|
418 |
{
|
|
419 |
const CLiwMap* res = data.AsMap();
|
|
420 |
if ( res )
|
|
421 |
{
|
|
422 |
itemfound++;
|
|
423 |
TLiwVariant guid;
|
|
424 |
if(res->FindL(_L8("id"), guid))
|
|
425 |
{
|
|
426 |
HBufC8* globaluid = HBufC8::NewL(guid.AsDes().Length()) ;
|
|
427 |
globaluid->Des().Copy(guid.AsDes());
|
|
428 |
|
|
429 |
if(globaluid->Des().CompareF(arruids[0]->iGlobalUID->Des()) == 0)
|
|
430 |
uidmatched = ETrue;
|
|
431 |
|
|
432 |
delete globaluid;
|
|
433 |
}
|
|
434 |
|
|
435 |
guid.Reset();
|
|
436 |
}
|
|
437 |
}
|
|
438 |
|
|
439 |
data.Reset();
|
|
440 |
|
|
441 |
if(itemfound != 1 || !uidmatched)
|
|
442 |
result = KErrGeneral;
|
|
443 |
}
|
|
444 |
|
|
445 |
inParamList->Reset();
|
|
446 |
outParamList->Reset();
|
|
447 |
|
|
448 |
arruids.ResetAndDestroy();
|
|
449 |
}
|
|
450 |
else
|
|
451 |
result = KErrGeneral;
|
|
452 |
|
|
453 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
454 |
|
|
455 |
|
|
456 |
interface->Close();
|
|
457 |
iServiceHandler->Reset();
|
|
458 |
delete iServiceHandler;
|
|
459 |
|
|
460 |
__UHEAP_MARKEND;
|
|
461 |
|
|
462 |
return result;
|
|
463 |
|
|
464 |
}
|
|
465 |
|
|
466 |
|
|
467 |
TInt CTCalendarGetListTest::GetListLocalUidFilter(CStifItemParser& /*aItem*/ )
|
|
468 |
{
|
|
469 |
TInt result=KErrNone;
|
|
470 |
|
|
471 |
__UHEAP_MARK;
|
|
472 |
// Iter-3 test work
|
|
473 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL();
|
|
474 |
|
|
475 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL());
|
|
476 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL());
|
|
477 |
|
|
478 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService);
|
|
479 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase));
|
|
480 |
|
|
481 |
RCriteriaArray a;
|
|
482 |
|
|
483 |
a.AppendL(crit);
|
|
484 |
|
|
485 |
iServiceHandler->AttachL(a);
|
|
486 |
|
|
487 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList);
|
|
488 |
|
|
489 |
delete crit;
|
|
490 |
crit = NULL;
|
|
491 |
a.Reset();
|
|
492 |
|
|
493 |
TInt pos = 0;
|
|
494 |
MLiwInterface* interface = NULL;
|
|
495 |
outParamList->FindFirst(pos,KIDataSource );
|
|
496 |
if(pos != KErrNotFound)
|
|
497 |
{
|
|
498 |
interface = (*outParamList)[pos].Value().AsInterface();
|
|
499 |
}
|
|
500 |
|
|
501 |
inParamList->Reset();
|
|
502 |
outParamList->Reset();
|
|
503 |
|
|
504 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
505 |
|
|
506 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
507 |
|
|
508 |
RPointerArray<TUIDSet> arruids(5);
|
|
509 |
|
|
510 |
TUIDSet* uids = NULL;
|
|
511 |
|
|
512 |
if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids)
|
|
513 |
{
|
|
514 |
arruids.Append(uids);
|
|
515 |
uids = NULL;
|
|
516 |
}
|
|
517 |
|
|
518 |
if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids)
|
|
519 |
{
|
|
520 |
arruids.Append(uids);
|
|
521 |
uids = NULL;
|
|
522 |
}
|
|
523 |
|
|
524 |
if ( arruids.Count() > 0 )
|
|
525 |
{
|
|
526 |
TLiwVariant content(_L("CalendarEntry"));
|
|
527 |
TLiwGenericParam element1;
|
|
528 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
529 |
inParamList->AppendL(element1);
|
|
530 |
content.Reset();
|
|
531 |
element1.Reset();
|
|
532 |
|
|
533 |
|
|
534 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
535 |
CleanupStack::PushL(map);
|
|
536 |
|
|
537 |
map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) );
|
|
538 |
TBuf<50> globaluid;
|
|
539 |
TBuf<10> luid;
|
|
540 |
//luid.Num(TInt64(arruids[0]->iLocalUID));
|
|
541 |
globaluid.Copy(arruids[0]->iGlobalUID->Des());
|
|
542 |
luid = GetEntry(interface, inParamList, outParamList, globaluid, KTestCal1File);
|
|
543 |
map->InsertL(_L8("LocalId"), TLiwVariant(luid));
|
|
544 |
|
|
545 |
TLiwVariant filterparam(map);
|
|
546 |
TLiwGenericParam element ;
|
|
547 |
element.SetNameAndValueL(_L8("Filter"),filterparam);
|
|
548 |
filterparam.Reset();
|
|
549 |
|
|
550 |
inParamList->AppendL(element);
|
|
551 |
element.Reset();
|
|
552 |
map->DecRef();
|
|
553 |
CleanupStack::Pop(map);
|
|
554 |
|
|
555 |
TInt err = 0;
|
|
556 |
TRAP(err,interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList));
|
|
557 |
pos = 0 ;
|
|
558 |
|
|
559 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue"));
|
|
560 |
|
|
561 |
if(output)
|
|
562 |
{
|
|
563 |
CLiwIterable* iterlist = output->Value().AsIterable();
|
|
564 |
|
|
565 |
TLiwVariant data;
|
|
566 |
TInt itemfound = 0;
|
|
567 |
TBool uidmatched = EFalse;
|
|
568 |
|
|
569 |
while( iterlist->NextL(data))
|
|
570 |
{
|
|
571 |
const CLiwMap* res = data.AsMap();
|
|
572 |
if ( res )
|
|
573 |
{
|
|
574 |
itemfound++;
|
|
575 |
TLiwVariant luid;
|
|
576 |
if(res->FindL(_L8("id"), luid))
|
|
577 |
{
|
|
578 |
/*TLex lex(luid.AsDes());
|
|
579 |
TInt32 num;
|
|
580 |
lex.Val(num);
|
|
581 |
|
|
582 |
TUint localuid = 0;
|
|
583 |
localuid = TUint(num);
|
|
584 |
|
|
585 |
if(localuid == arruids[0]->iLocalUID)
|
|
586 |
uidmatched = ETrue;*/
|
|
587 |
|
|
588 |
|
|
589 |
|
|
590 |
HBufC8* globaluid = HBufC8::NewL(luid.AsDes().Length()) ;
|
|
591 |
globaluid->Des().Copy(luid.AsDes());
|
|
592 |
|
|
593 |
if(globaluid->Des().CompareF(arruids[0]->iGlobalUID->Des()) == 0)
|
|
594 |
uidmatched = ETrue;
|
|
595 |
|
|
596 |
delete globaluid;
|
|
597 |
}
|
|
598 |
luid.Reset();
|
|
599 |
}
|
|
600 |
}
|
|
601 |
|
|
602 |
data.Reset();
|
|
603 |
|
|
604 |
if(itemfound != 1 || !uidmatched)
|
|
605 |
result = KErrGeneral;
|
|
606 |
}
|
|
607 |
|
|
608 |
inParamList->Reset();
|
|
609 |
outParamList->Reset();
|
|
610 |
|
|
611 |
arruids.ResetAndDestroy();
|
|
612 |
}
|
|
613 |
else
|
|
614 |
result = KErrGeneral;
|
|
615 |
|
|
616 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
617 |
|
|
618 |
|
|
619 |
interface->Close();
|
|
620 |
iServiceHandler->Reset();
|
|
621 |
delete iServiceHandler;
|
|
622 |
|
|
623 |
__UHEAP_MARKEND;
|
|
624 |
|
|
625 |
return result;
|
|
626 |
}
|
|
627 |
|
|
628 |
|
|
629 |
//
|
|
630 |
//Whats done here?
|
|
631 |
// Get the default system Calendar using GetList of CCalendarService and output that to GetListdefaultCalendar.txt
|
|
632 |
//
|
|
633 |
TInt CTCalendarGetListTest::GetListTimeRangeFilter(CStifItemParser& /*aItem*/ )
|
|
634 |
{
|
|
635 |
TInt result=KErrNone;
|
|
636 |
|
|
637 |
__UHEAP_MARK;
|
|
638 |
// Iter-3 test work
|
|
639 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL();
|
|
640 |
|
|
641 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL());
|
|
642 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL());
|
|
643 |
|
|
644 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService);
|
|
645 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase));
|
|
646 |
|
|
647 |
RCriteriaArray a;
|
|
648 |
|
|
649 |
a.AppendL(crit);
|
|
650 |
|
|
651 |
iServiceHandler->AttachL(a);
|
|
652 |
|
|
653 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList);
|
|
654 |
|
|
655 |
delete crit;
|
|
656 |
crit = NULL;
|
|
657 |
a.Reset();
|
|
658 |
|
|
659 |
TInt pos = 0;
|
|
660 |
MLiwInterface* interface = NULL;
|
|
661 |
outParamList->FindFirst(pos,KIDataSource );
|
|
662 |
if(pos != KErrNotFound)
|
|
663 |
{
|
|
664 |
interface = (*outParamList)[pos].Value().AsInterface();
|
|
665 |
}
|
|
666 |
|
|
667 |
inParamList->Reset();
|
|
668 |
outParamList->Reset();
|
|
669 |
|
|
670 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
671 |
|
|
672 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
673 |
|
|
674 |
TUIDSet* uids = NULL;
|
|
675 |
|
|
676 |
if(AddAppointmentProvLocal(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids)
|
|
677 |
{
|
|
678 |
}
|
|
679 |
|
|
680 |
|
|
681 |
if ( uids )
|
|
682 |
{
|
|
683 |
TLiwVariant content(_L("CalendarEntry"));
|
|
684 |
TLiwGenericParam element1;
|
|
685 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
686 |
inParamList->AppendL(element1);
|
|
687 |
content.Reset();
|
|
688 |
element1.Reset();
|
|
689 |
|
|
690 |
|
|
691 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
692 |
CleanupStack::PushL(map);
|
|
693 |
|
|
694 |
map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) );
|
|
695 |
map->InsertL(_L8("StartRange"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,0,0,0))) );
|
|
696 |
map->InsertL(_L8("EndRange"), TLiwVariant(TTime(TDateTime(2007,EOctober,30,10,30,0,0))) );
|
|
697 |
|
|
698 |
TLiwVariant filterparam(map);
|
|
699 |
TLiwGenericParam element ;
|
|
700 |
element.SetNameAndValueL(_L8("Filter"),filterparam);
|
|
701 |
filterparam.Reset();
|
|
702 |
|
|
703 |
inParamList->AppendL(element);
|
|
704 |
element.Reset();
|
|
705 |
map->DecRef();
|
|
706 |
CleanupStack::Pop(map);
|
|
707 |
|
|
708 |
TInt err = 0;
|
|
709 |
TRAP(err,interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList));
|
|
710 |
pos = 0 ;
|
|
711 |
|
|
712 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue"));
|
|
713 |
|
|
714 |
if(output)
|
|
715 |
{
|
|
716 |
CLiwIterable* iterlist = output->Value().AsIterable();
|
|
717 |
|
|
718 |
TLiwVariant data;
|
|
719 |
TInt itemfound = 0;
|
|
720 |
|
|
721 |
while( iterlist->NextL(data))
|
|
722 |
{
|
|
723 |
const CLiwMap* res = data.AsMap();
|
|
724 |
if ( res )
|
|
725 |
{
|
|
726 |
itemfound++;
|
|
727 |
}
|
|
728 |
}
|
|
729 |
|
|
730 |
data.Reset();
|
|
731 |
|
|
732 |
if(itemfound != 8 )
|
|
733 |
result = KErrGeneral;
|
|
734 |
}
|
|
735 |
|
|
736 |
inParamList->Reset();
|
|
737 |
outParamList->Reset();
|
|
738 |
|
|
739 |
}
|
|
740 |
else
|
|
741 |
result = KErrGeneral;
|
|
742 |
|
|
743 |
delete uids;
|
|
744 |
|
|
745 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
746 |
|
|
747 |
|
|
748 |
interface->Close();
|
|
749 |
iServiceHandler->Reset();
|
|
750 |
delete iServiceHandler;
|
|
751 |
|
|
752 |
__UHEAP_MARKEND;
|
|
753 |
|
|
754 |
return result;
|
|
755 |
|
|
756 |
}
|
|
757 |
|
|
758 |
|
|
759 |
//
|
|
760 |
//Whats done here?
|
|
761 |
// Get the default system Calendar using GetList of CCalendarService and output that to GetListdefaultCalendar.txt
|
|
762 |
//
|
|
763 |
TInt CTCalendarGetListTest::GetListTextFilter(CStifItemParser& /*aItem*/ )
|
|
764 |
{
|
|
765 |
TInt result=KErrNone;
|
|
766 |
|
|
767 |
__UHEAP_MARK;
|
|
768 |
// Iter-3 test work
|
|
769 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL();
|
|
770 |
|
|
771 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL());
|
|
772 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL());
|
|
773 |
|
|
774 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService);
|
|
775 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase));
|
|
776 |
|
|
777 |
RCriteriaArray a;
|
|
778 |
|
|
779 |
a.AppendL(crit);
|
|
780 |
|
|
781 |
iServiceHandler->AttachL(a);
|
|
782 |
|
|
783 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList);
|
|
784 |
|
|
785 |
delete crit;
|
|
786 |
crit = NULL;
|
|
787 |
a.Reset();
|
|
788 |
|
|
789 |
TInt pos = 0;
|
|
790 |
MLiwInterface* interface = NULL;
|
|
791 |
outParamList->FindFirst(pos,KIDataSource );
|
|
792 |
if(pos != KErrNotFound)
|
|
793 |
{
|
|
794 |
interface = (*outParamList)[pos].Value().AsInterface();
|
|
795 |
}
|
|
796 |
|
|
797 |
inParamList->Reset();
|
|
798 |
outParamList->Reset();
|
|
799 |
|
|
800 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
801 |
|
|
802 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
803 |
|
|
804 |
TUIDSet* uids = NULL;
|
|
805 |
|
|
806 |
if(AddAppointmentProvLocal(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids)
|
|
807 |
{
|
|
808 |
}
|
|
809 |
|
|
810 |
|
|
811 |
if ( uids )
|
|
812 |
{
|
|
813 |
TLiwVariant content(_L("CalendarEntry"));
|
|
814 |
TLiwGenericParam element1;
|
|
815 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
816 |
inParamList->AppendL(element1);
|
|
817 |
content.Reset();
|
|
818 |
element1.Reset();
|
|
819 |
|
|
820 |
|
|
821 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
822 |
CleanupStack::PushL(map);
|
|
823 |
|
|
824 |
map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) );
|
|
825 |
map->InsertL(_L8("SearchText"), TLiwVariant(_L("Meeting")) );
|
|
826 |
|
|
827 |
TLiwVariant filterparam(map);
|
|
828 |
TLiwGenericParam element ;
|
|
829 |
element.SetNameAndValueL(_L8("Filter"),filterparam);
|
|
830 |
filterparam.Reset();
|
|
831 |
|
|
832 |
inParamList->AppendL(element);
|
|
833 |
element.Reset();
|
|
834 |
map->DecRef();
|
|
835 |
CleanupStack::Pop(map);
|
|
836 |
|
|
837 |
TInt err = 0;
|
|
838 |
TRAP(err,interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList));
|
|
839 |
pos = 0 ;
|
|
840 |
|
|
841 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue"));
|
|
842 |
|
|
843 |
if(output)
|
|
844 |
{
|
|
845 |
CLiwIterable* iterlist = output->Value().AsIterable();
|
|
846 |
|
|
847 |
TLiwVariant data;
|
|
848 |
TInt itemfound = 0;
|
|
849 |
|
|
850 |
while( iterlist->NextL(data))
|
|
851 |
{
|
|
852 |
const CLiwMap* res = data.AsMap();
|
|
853 |
if ( res )
|
|
854 |
{
|
|
855 |
TLiwVariant luid;
|
|
856 |
if(res->FindL(_L8("Summary"), luid))
|
|
857 |
{
|
|
858 |
TPtrC localuid = luid.AsDes();
|
|
859 |
if(localuid.FindF(_L("Meeting")) != KErrNotFound )
|
|
860 |
itemfound++;
|
|
861 |
}
|
|
862 |
|
|
863 |
luid.Reset();
|
|
864 |
}
|
|
865 |
}
|
|
866 |
|
|
867 |
data.Reset();
|
|
868 |
|
|
869 |
if(itemfound != 8 )
|
|
870 |
result = KErrGeneral;
|
|
871 |
}
|
|
872 |
|
|
873 |
inParamList->Reset();
|
|
874 |
outParamList->Reset();
|
|
875 |
|
|
876 |
}
|
|
877 |
else
|
|
878 |
result = KErrGeneral;
|
|
879 |
|
|
880 |
delete uids;
|
|
881 |
|
|
882 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
883 |
|
|
884 |
|
|
885 |
interface->Close();
|
|
886 |
iServiceHandler->Reset();
|
|
887 |
delete iServiceHandler;
|
|
888 |
|
|
889 |
__UHEAP_MARKEND;
|
|
890 |
|
|
891 |
return result;
|
|
892 |
|
|
893 |
|
|
894 |
}
|
|
895 |
|
|
896 |
|
|
897 |
//
|
|
898 |
//Whats done here?
|
|
899 |
// Get the default system Calendar using GetList of CCalendarService and output that to GetListdefaultCalendar.txt
|
|
900 |
//
|
|
901 |
TInt CTCalendarGetListTest::GetListTypeFilter(CStifItemParser& /*aItem*/ )
|
|
902 |
{
|
|
903 |
|
|
904 |
TInt result=KErrNone;
|
|
905 |
|
|
906 |
__UHEAP_MARK;
|
|
907 |
// Iter-3 test work
|
|
908 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL();
|
|
909 |
|
|
910 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL());
|
|
911 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL());
|
|
912 |
|
|
913 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService);
|
|
914 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase));
|
|
915 |
|
|
916 |
RCriteriaArray a;
|
|
917 |
|
|
918 |
a.AppendL(crit);
|
|
919 |
|
|
920 |
iServiceHandler->AttachL(a);
|
|
921 |
|
|
922 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList);
|
|
923 |
|
|
924 |
delete crit;
|
|
925 |
crit = NULL;
|
|
926 |
a.Reset();
|
|
927 |
|
|
928 |
TInt pos = 0;
|
|
929 |
MLiwInterface* interface = NULL;
|
|
930 |
outParamList->FindFirst(pos,KIDataSource );
|
|
931 |
if(pos != KErrNotFound)
|
|
932 |
{
|
|
933 |
interface = (*outParamList)[pos].Value().AsInterface();
|
|
934 |
}
|
|
935 |
|
|
936 |
inParamList->Reset();
|
|
937 |
outParamList->Reset();
|
|
938 |
|
|
939 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
940 |
|
|
941 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
942 |
|
|
943 |
TUIDSet* uids = NULL;
|
|
944 |
|
|
945 |
if(AddAppointmentProvLocal(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids)
|
|
946 |
{
|
|
947 |
}
|
|
948 |
|
|
949 |
TUIDSet* tmpuids = NULL;
|
|
950 |
|
|
951 |
if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, tmpuids) == KErrNone && tmpuids)
|
|
952 |
{
|
|
953 |
delete tmpuids;
|
|
954 |
}
|
|
955 |
|
|
956 |
|
|
957 |
if ( uids )
|
|
958 |
{
|
|
959 |
TLiwVariant content(_L("CalendarEntry"));
|
|
960 |
TLiwGenericParam element1;
|
|
961 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
962 |
inParamList->AppendL(element1);
|
|
963 |
content.Reset();
|
|
964 |
element1.Reset();
|
|
965 |
|
|
966 |
|
|
967 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
968 |
CleanupStack::PushL(map);
|
|
969 |
|
|
970 |
map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) );
|
|
971 |
map->InsertL(_L8("Type"), TLiwVariant(_L("Meeting")) );
|
|
972 |
|
|
973 |
TLiwVariant filterparam(map);
|
|
974 |
TLiwGenericParam element ;
|
|
975 |
element.SetNameAndValueL(_L8("Filter"),filterparam);
|
|
976 |
filterparam.Reset();
|
|
977 |
|
|
978 |
inParamList->AppendL(element);
|
|
979 |
element.Reset();
|
|
980 |
map->DecRef();
|
|
981 |
CleanupStack::Pop(map);
|
|
982 |
|
|
983 |
TInt err = 0;
|
|
984 |
TRAP(err,interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList));
|
|
985 |
pos = 0 ;
|
|
986 |
|
|
987 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue"));
|
|
988 |
|
|
989 |
if(output)
|
|
990 |
{
|
|
991 |
CLiwIterable* iterlist = output->Value().AsIterable();
|
|
992 |
|
|
993 |
TLiwVariant data;
|
|
994 |
TInt itemfound = 0;
|
|
995 |
|
|
996 |
while( iterlist->NextL(data))
|
|
997 |
{
|
|
998 |
const CLiwMap* res = data.AsMap();
|
|
999 |
if ( res )
|
|
1000 |
{
|
|
1001 |
TLiwVariant luid;
|
|
1002 |
if(res->FindL(_L8("Type"), luid))
|
|
1003 |
{
|
|
1004 |
TPtrC localuid = luid.AsDes();
|
|
1005 |
if(localuid.CompareF(_L("Meeting")) == 0 )
|
|
1006 |
itemfound++;
|
|
1007 |
}
|
|
1008 |
|
|
1009 |
luid.Reset();
|
|
1010 |
}
|
|
1011 |
}
|
|
1012 |
|
|
1013 |
data.Reset();
|
|
1014 |
|
|
1015 |
if(itemfound != 8 )
|
|
1016 |
result = KErrGeneral;
|
|
1017 |
}
|
|
1018 |
|
|
1019 |
inParamList->Reset();
|
|
1020 |
outParamList->Reset();
|
|
1021 |
|
|
1022 |
}
|
|
1023 |
else
|
|
1024 |
result = KErrGeneral;
|
|
1025 |
|
|
1026 |
delete uids;
|
|
1027 |
|
|
1028 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
1029 |
|
|
1030 |
|
|
1031 |
interface->Close();
|
|
1032 |
iServiceHandler->Reset();
|
|
1033 |
delete iServiceHandler;
|
|
1034 |
|
|
1035 |
__UHEAP_MARKEND;
|
|
1036 |
|
|
1037 |
return result;
|
|
1038 |
|
|
1039 |
}
|
|
1040 |
|
|
1041 |
|
|
1042 |
//
|
|
1043 |
//Whats done here?
|
|
1044 |
// Get the default system Calendar using GetList of CCalendarService and output that to GetListdefaultCalendar.txt
|
|
1045 |
//
|
|
1046 |
TInt CTCalendarGetListTest::GetListInvalidCalName(CStifItemParser& /*aItem*/ )
|
|
1047 |
{
|
|
1048 |
TInt result=KErrNone;
|
|
1049 |
|
|
1050 |
__UHEAP_MARK;
|
|
1051 |
// Iter-3 test work
|
|
1052 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL();
|
|
1053 |
|
|
1054 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL());
|
|
1055 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL());
|
|
1056 |
|
|
1057 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService);
|
|
1058 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase));
|
|
1059 |
|
|
1060 |
RCriteriaArray a;
|
|
1061 |
|
|
1062 |
a.AppendL(crit);
|
|
1063 |
|
|
1064 |
iServiceHandler->AttachL(a);
|
|
1065 |
|
|
1066 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList);
|
|
1067 |
|
|
1068 |
delete crit;
|
|
1069 |
crit = NULL;
|
|
1070 |
a.Reset();
|
|
1071 |
|
|
1072 |
TInt pos = 0;
|
|
1073 |
MLiwInterface* interface = NULL;
|
|
1074 |
outParamList->FindFirst(pos,KIDataSource );
|
|
1075 |
if(pos != KErrNotFound)
|
|
1076 |
{
|
|
1077 |
interface = (*outParamList)[pos].Value().AsInterface();
|
|
1078 |
}
|
|
1079 |
|
|
1080 |
inParamList->Reset();
|
|
1081 |
outParamList->Reset();
|
|
1082 |
// Iter-2 same
|
|
1083 |
|
|
1084 |
TInt added = 0;
|
|
1085 |
|
|
1086 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
1087 |
|
|
1088 |
TLiwVariant content(_L("CalendarEntry"));
|
|
1089 |
TLiwGenericParam element1;
|
|
1090 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
1091 |
inParamList->AppendL(element1);
|
|
1092 |
content.Reset();
|
|
1093 |
element1.Reset();
|
|
1094 |
|
|
1095 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
1096 |
CleanupStack::PushL(map);
|
|
1097 |
|
|
1098 |
map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) );
|
|
1099 |
|
|
1100 |
TLiwVariant filterparam(map);
|
|
1101 |
TLiwGenericParam element ;
|
|
1102 |
element.SetNameAndValueL(_L8("Filter"),filterparam);
|
|
1103 |
filterparam.Reset();
|
|
1104 |
|
|
1105 |
inParamList->AppendL(element);
|
|
1106 |
element.Reset();
|
|
1107 |
map->DecRef();
|
|
1108 |
CleanupStack::Pop(map);
|
|
1109 |
|
|
1110 |
|
|
1111 |
TInt err = 0;
|
|
1112 |
TRAP(err,interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList));
|
|
1113 |
pos = 0 ;
|
|
1114 |
|
|
1115 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ErrorCode"));
|
|
1116 |
|
|
1117 |
if(output)
|
|
1118 |
{
|
|
1119 |
TInt32 reterror = output->Value().AsTInt32();
|
|
1120 |
|
|
1121 |
if ( reterror != 1012 )// Sapi error code ErrNotFound
|
|
1122 |
{
|
|
1123 |
result = KErrGeneral;
|
|
1124 |
}
|
|
1125 |
}
|
|
1126 |
|
|
1127 |
inParamList->Reset();
|
|
1128 |
outParamList->Reset();
|
|
1129 |
|
|
1130 |
interface->Close();
|
|
1131 |
iServiceHandler->Reset();
|
|
1132 |
delete iServiceHandler;
|
|
1133 |
|
|
1134 |
__UHEAP_MARKEND;
|
|
1135 |
|
|
1136 |
return result;
|
|
1137 |
|
|
1138 |
}
|
|
1139 |
|
|
1140 |
|
|
1141 |
//
|
|
1142 |
//Whats done here?
|
|
1143 |
// Get the default system Calendar using GetList of CCalendarService and output that to GetListdefaultCalendar.txt
|
|
1144 |
//
|
|
1145 |
TInt CTCalendarGetListTest::GetListInvalidGUID(CStifItemParser& /*aItem*/ )
|
|
1146 |
{
|
|
1147 |
TInt result=KErrNone;
|
|
1148 |
|
|
1149 |
__UHEAP_MARK;
|
|
1150 |
// Iter-3 test work
|
|
1151 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL();
|
|
1152 |
|
|
1153 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL());
|
|
1154 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL());
|
|
1155 |
|
|
1156 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService);
|
|
1157 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase));
|
|
1158 |
|
|
1159 |
RCriteriaArray a;
|
|
1160 |
|
|
1161 |
a.AppendL(crit);
|
|
1162 |
|
|
1163 |
iServiceHandler->AttachL(a);
|
|
1164 |
|
|
1165 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList);
|
|
1166 |
|
|
1167 |
delete crit;
|
|
1168 |
crit = NULL;
|
|
1169 |
a.Reset();
|
|
1170 |
|
|
1171 |
TInt pos = 0;
|
|
1172 |
MLiwInterface* interface = NULL;
|
|
1173 |
outParamList->FindFirst(pos,KIDataSource );
|
|
1174 |
if(pos != KErrNotFound)
|
|
1175 |
{
|
|
1176 |
interface = (*outParamList)[pos].Value().AsInterface();
|
|
1177 |
}
|
|
1178 |
|
|
1179 |
inParamList->Reset();
|
|
1180 |
outParamList->Reset();
|
|
1181 |
|
|
1182 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
1183 |
|
|
1184 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
1185 |
|
|
1186 |
RPointerArray<TUIDSet> arruids(5);
|
|
1187 |
|
|
1188 |
TUIDSet* uids = NULL;
|
|
1189 |
|
|
1190 |
if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids)
|
|
1191 |
{
|
|
1192 |
arruids.Append(uids);
|
|
1193 |
uids = NULL;
|
|
1194 |
}
|
|
1195 |
|
|
1196 |
if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids)
|
|
1197 |
{
|
|
1198 |
arruids.Append(uids);
|
|
1199 |
uids = NULL;
|
|
1200 |
}
|
|
1201 |
|
|
1202 |
if ( arruids.Count() > 0 )
|
|
1203 |
{
|
|
1204 |
TLiwVariant content(_L("CalendarEntry"));
|
|
1205 |
TLiwGenericParam element1;
|
|
1206 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
1207 |
inParamList->AppendL(element1);
|
|
1208 |
content.Reset();
|
|
1209 |
element1.Reset();
|
|
1210 |
|
|
1211 |
|
|
1212 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
1213 |
CleanupStack::PushL(map);
|
|
1214 |
|
|
1215 |
map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) );
|
|
1216 |
map->InsertL(_L8("id"), TLiwVariant(_L("abc")) );
|
|
1217 |
|
|
1218 |
TLiwVariant filterparam(map);
|
|
1219 |
TLiwGenericParam element ;
|
|
1220 |
element.SetNameAndValueL(_L8("Filter"),filterparam);
|
|
1221 |
filterparam.Reset();
|
|
1222 |
|
|
1223 |
inParamList->AppendL(element);
|
|
1224 |
element.Reset();
|
|
1225 |
map->DecRef();
|
|
1226 |
CleanupStack::Pop(map);
|
|
1227 |
|
|
1228 |
TInt err = 0;
|
|
1229 |
TRAP(err,interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList));
|
|
1230 |
pos = 0 ;
|
|
1231 |
|
|
1232 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue"));
|
|
1233 |
|
|
1234 |
if(output)
|
|
1235 |
{
|
|
1236 |
CLiwIterable* iterlist = output->Value().AsIterable();
|
|
1237 |
|
|
1238 |
TLiwVariant data;
|
|
1239 |
TInt itemfound = 0;
|
|
1240 |
TBool uidmatched = EFalse;
|
|
1241 |
|
|
1242 |
while( iterlist->NextL(data))
|
|
1243 |
{
|
|
1244 |
itemfound++;
|
|
1245 |
}
|
|
1246 |
|
|
1247 |
data.Reset();
|
|
1248 |
|
|
1249 |
if(itemfound != 0)
|
|
1250 |
result = KErrGeneral;
|
|
1251 |
}
|
|
1252 |
|
|
1253 |
inParamList->Reset();
|
|
1254 |
outParamList->Reset();
|
|
1255 |
|
|
1256 |
arruids.ResetAndDestroy();
|
|
1257 |
}
|
|
1258 |
else
|
|
1259 |
result = KErrGeneral;
|
|
1260 |
|
|
1261 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
1262 |
|
|
1263 |
|
|
1264 |
interface->Close();
|
|
1265 |
iServiceHandler->Reset();
|
|
1266 |
delete iServiceHandler;
|
|
1267 |
|
|
1268 |
__UHEAP_MARKEND;
|
|
1269 |
|
|
1270 |
return result;
|
|
1271 |
|
|
1272 |
}
|
|
1273 |
|
|
1274 |
|
|
1275 |
//
|
|
1276 |
//Whats done here?
|
|
1277 |
// Get the default system Calendar using GetList of CCalendarService and output that to GetListdefaultCalendar.txt
|
|
1278 |
//
|
|
1279 |
TInt CTCalendarGetListTest::GetListInvalidLUID(CStifItemParser& /*aItem*/ )
|
|
1280 |
{
|
|
1281 |
TInt result=KErrNone;
|
|
1282 |
|
|
1283 |
__UHEAP_MARK;
|
|
1284 |
// Iter-3 test work
|
|
1285 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL();
|
|
1286 |
|
|
1287 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL());
|
|
1288 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL());
|
|
1289 |
|
|
1290 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService);
|
|
1291 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase));
|
|
1292 |
|
|
1293 |
RCriteriaArray a;
|
|
1294 |
|
|
1295 |
a.AppendL(crit);
|
|
1296 |
|
|
1297 |
iServiceHandler->AttachL(a);
|
|
1298 |
|
|
1299 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList);
|
|
1300 |
|
|
1301 |
delete crit;
|
|
1302 |
crit = NULL;
|
|
1303 |
a.Reset();
|
|
1304 |
|
|
1305 |
TInt pos = 0;
|
|
1306 |
MLiwInterface* interface = NULL;
|
|
1307 |
outParamList->FindFirst(pos,KIDataSource );
|
|
1308 |
if(pos != KErrNotFound)
|
|
1309 |
{
|
|
1310 |
interface = (*outParamList)[pos].Value().AsInterface();
|
|
1311 |
}
|
|
1312 |
|
|
1313 |
inParamList->Reset();
|
|
1314 |
outParamList->Reset();
|
|
1315 |
|
|
1316 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
1317 |
|
|
1318 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
1319 |
|
|
1320 |
RPointerArray<TUIDSet> arruids(5);
|
|
1321 |
|
|
1322 |
TUIDSet* uids = NULL;
|
|
1323 |
|
|
1324 |
if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids)
|
|
1325 |
{
|
|
1326 |
arruids.Append(uids);
|
|
1327 |
uids = NULL;
|
|
1328 |
}
|
|
1329 |
|
|
1330 |
if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids)
|
|
1331 |
{
|
|
1332 |
arruids.Append(uids);
|
|
1333 |
uids = NULL;
|
|
1334 |
}
|
|
1335 |
|
|
1336 |
if ( arruids.Count() > 0 )
|
|
1337 |
{
|
|
1338 |
TLiwVariant content(_L("CalendarEntry"));
|
|
1339 |
TLiwGenericParam element1;
|
|
1340 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
1341 |
inParamList->AppendL(element1);
|
|
1342 |
content.Reset();
|
|
1343 |
element1.Reset();
|
|
1344 |
|
|
1345 |
|
|
1346 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
1347 |
CleanupStack::PushL(map);
|
|
1348 |
|
|
1349 |
map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) );
|
|
1350 |
map->InsertL(_L8("LocalId"), TLiwVariant(_L("0")) );
|
|
1351 |
|
|
1352 |
TLiwVariant filterparam(map);
|
|
1353 |
TLiwGenericParam element ;
|
|
1354 |
element.SetNameAndValueL(_L8("Filter"),filterparam);
|
|
1355 |
filterparam.Reset();
|
|
1356 |
|
|
1357 |
inParamList->AppendL(element);
|
|
1358 |
element.Reset();
|
|
1359 |
map->DecRef();
|
|
1360 |
CleanupStack::Pop(map);
|
|
1361 |
|
|
1362 |
TInt err = 0;
|
|
1363 |
TRAP(err,interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList));
|
|
1364 |
pos = 0 ;
|
|
1365 |
|
|
1366 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue"));
|
|
1367 |
|
|
1368 |
if(output)
|
|
1369 |
{
|
|
1370 |
CLiwIterable* iterlist = output->Value().AsIterable();
|
|
1371 |
|
|
1372 |
TLiwVariant data;
|
|
1373 |
TInt itemfound = 0;
|
|
1374 |
TBool uidmatched = EFalse;
|
|
1375 |
|
|
1376 |
while( iterlist->NextL(data))
|
|
1377 |
{
|
|
1378 |
itemfound++;
|
|
1379 |
}
|
|
1380 |
|
|
1381 |
data.Reset();
|
|
1382 |
|
|
1383 |
if(itemfound != 0)
|
|
1384 |
result = KErrGeneral;
|
|
1385 |
}
|
|
1386 |
|
|
1387 |
inParamList->Reset();
|
|
1388 |
outParamList->Reset();
|
|
1389 |
|
|
1390 |
arruids.ResetAndDestroy();
|
|
1391 |
}
|
|
1392 |
else
|
|
1393 |
result = KErrGeneral;
|
|
1394 |
|
|
1395 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File);
|
|
1396 |
|
|
1397 |
|
|
1398 |
interface->Close();
|
|
1399 |
iServiceHandler->Reset();
|
|
1400 |
delete iServiceHandler;
|
|
1401 |
|
|
1402 |
__UHEAP_MARKEND;
|
|
1403 |
|
|
1404 |
return result;
|
|
1405 |
|
|
1406 |
}
|
|
1407 |
|
|
1408 |
|
|
1409 |
TInt RemoveProvCalendar(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar)
|
|
1410 |
{
|
|
1411 |
inparam->Reset();
|
|
1412 |
outparam->Reset();
|
|
1413 |
__UHEAP_MARK;
|
|
1414 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
1415 |
CleanupStack::PushL(map);
|
|
1416 |
|
|
1417 |
TLiwVariant content(_L("Calendar"));
|
|
1418 |
TLiwGenericParam element1;
|
|
1419 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
1420 |
inparam->AppendL(element1);
|
|
1421 |
content.Reset();
|
|
1422 |
element1.Reset();
|
|
1423 |
|
|
1424 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar));
|
|
1425 |
|
|
1426 |
TLiwVariant filterparam(map);
|
|
1427 |
TLiwGenericParam element ;
|
|
1428 |
element.SetNameAndValueL(_L8("Data"),filterparam);
|
|
1429 |
filterparam.Reset();
|
|
1430 |
|
|
1431 |
inparam->AppendL(element);
|
|
1432 |
element.Reset();
|
|
1433 |
map->DecRef();
|
|
1434 |
CleanupStack::Pop(map);
|
|
1435 |
|
|
1436 |
TRAPD(err, interface->ExecuteCmdL( KCmdDelete ,*inparam,*outparam ));
|
|
1437 |
TInt pos = 0 ;
|
|
1438 |
|
|
1439 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode"));
|
|
1440 |
|
|
1441 |
if(output)
|
|
1442 |
{
|
|
1443 |
err = output->Value().AsTInt32();
|
|
1444 |
}
|
|
1445 |
|
|
1446 |
inparam->Reset();
|
|
1447 |
outparam->Reset();
|
|
1448 |
__UHEAP_MARKEND;
|
|
1449 |
|
|
1450 |
return err;
|
|
1451 |
}
|
|
1452 |
|
|
1453 |
TInt AddProvCalendar(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar)
|
|
1454 |
{
|
|
1455 |
inparam->Reset();
|
|
1456 |
outparam->Reset();
|
|
1457 |
|
|
1458 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
1459 |
CleanupStack::PushL(map);
|
|
1460 |
|
|
1461 |
TLiwVariant content(_L("Calendar"));
|
|
1462 |
TLiwGenericParam element1;
|
|
1463 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
1464 |
inparam->AppendL(element1);
|
|
1465 |
content.Reset();
|
|
1466 |
element1.Reset();
|
|
1467 |
|
|
1468 |
|
|
1469 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar) );
|
|
1470 |
|
|
1471 |
TLiwGenericParam element;
|
|
1472 |
element.SetNameAndValueL(_L8("Item"),TLiwVariant(map));
|
|
1473 |
|
|
1474 |
inparam->AppendL(element);
|
|
1475 |
element.Reset();
|
|
1476 |
map->DecRef();
|
|
1477 |
CleanupStack::Pop(map);
|
|
1478 |
|
|
1479 |
TRAPD(err, interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam ));
|
|
1480 |
TInt pos = 0 ;
|
|
1481 |
|
|
1482 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode"));
|
|
1483 |
|
|
1484 |
if(output)
|
|
1485 |
{
|
|
1486 |
err = output->Value().AsTInt32();
|
|
1487 |
}
|
|
1488 |
|
|
1489 |
inparam->Reset();
|
|
1490 |
outparam->Reset();
|
|
1491 |
|
|
1492 |
return err;
|
|
1493 |
};
|
|
1494 |
|
|
1495 |
|
|
1496 |
TInt AddProvAppointmentDailyRepeat(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset)
|
|
1497 |
{
|
|
1498 |
inparam->Reset();
|
|
1499 |
outparam->Reset();
|
|
1500 |
TInt cells = User::CountAllocCells();
|
|
1501 |
// __UHEAP_MARK;
|
|
1502 |
|
|
1503 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
1504 |
CleanupStack::PushL(map);
|
|
1505 |
|
|
1506 |
TLiwVariant content(_L("CalendarEntry"));
|
|
1507 |
TLiwGenericParam element1;
|
|
1508 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
1509 |
inparam->AppendL(element1);
|
|
1510 |
content.Reset();
|
|
1511 |
element1.Reset();
|
|
1512 |
|
|
1513 |
|
|
1514 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar) );
|
|
1515 |
map->InsertL(_L8("Type"), TLiwVariant( _L("Meeting") ));
|
|
1516 |
map->InsertL(_L8("StartTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,0,0,0))));
|
|
1517 |
map->InsertL(_L8("EndTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,30,0,0))));
|
|
1518 |
map->InsertL(_L8("Replication"), TLiwVariant(_L("Open")));
|
|
1519 |
map->InsertL(_L8("Description"), TLiwVariant(_L("Meeting")));
|
|
1520 |
map->InsertL(_L8("Status"), TLiwVariant(_L("Confirmed")));
|
|
1521 |
map->InsertL(_L8("Method"), TLiwVariant(_L("None")));
|
|
1522 |
|
|
1523 |
CLiwDefaultMap* repeatmap = CLiwDefaultMap::NewL();
|
|
1524 |
CleanupStack::PushL(repeatmap);
|
|
1525 |
repeatmap->InsertL(_L8("Type"), TLiwVariant(TInt32(1)));
|
|
1526 |
repeatmap->InsertL(_L8("StartDate"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,0,0,0))));
|
|
1527 |
repeatmap->InsertL(_L8("UntilDate"), TLiwVariant(TTime(TDateTime(2007,EOctober,30,10,0,0,0))));
|
|
1528 |
map->InsertL(_L8("RepeatRule"), TLiwVariant(repeatmap));
|
|
1529 |
CleanupStack::Pop(repeatmap);
|
|
1530 |
repeatmap->DecRef();
|
|
1531 |
|
|
1532 |
|
|
1533 |
TLiwGenericParam element;
|
|
1534 |
element.SetNameAndValueL(_L8("Item"),TLiwVariant(map));
|
|
1535 |
|
|
1536 |
inparam->AppendL(element);
|
|
1537 |
element.Reset();
|
|
1538 |
map->DecRef();
|
|
1539 |
CleanupStack::Pop(map);
|
|
1540 |
|
|
1541 |
cells = User::CountAllocCells();
|
|
1542 |
|
|
1543 |
//TInt err;
|
|
1544 |
TRAPD(err, interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam ));
|
|
1545 |
TInt pos = 0 ;
|
|
1546 |
|
|
1547 |
cells = User::CountAllocCells();
|
|
1548 |
|
|
1549 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode"));
|
|
1550 |
|
|
1551 |
cells = User::CountAllocCells();
|
|
1552 |
|
|
1553 |
if(output)
|
|
1554 |
{
|
|
1555 |
err = output->Value().AsTInt32();
|
|
1556 |
if ( err == KErrNone )
|
|
1557 |
{
|
|
1558 |
output = outparam->FindFirst( pos,_L8("ReturnValue"));
|
|
1559 |
if(output)
|
|
1560 |
{
|
|
1561 |
uidset = new (ELeave) TUIDSet;
|
|
1562 |
TPtrC uidval = (TPtrC)(output->Value().AsDes());
|
|
1563 |
//GetLocalUid( uidval, uidset->iLocalUID );
|
|
1564 |
|
|
1565 |
uidset->iGlobalUID = HBufC8::NewL(uidval.Length());
|
|
1566 |
TPtr8 tmp = uidset->iGlobalUID->Des();
|
|
1567 |
GetGlobalUid( uidval, tmp );
|
|
1568 |
/*const CLiwMap* res = output->Value().AsMap();
|
|
1569 |
if ( res )
|
|
1570 |
{
|
|
1571 |
uidset = new (ELeave) TUIDSet;
|
|
1572 |
TLiwVariant luid;
|
|
1573 |
if(res->FindL(_L8("LocalUid"), luid))
|
|
1574 |
{
|
|
1575 |
uidset->iLocalUID = luid.AsTUint();
|
|
1576 |
}
|
|
1577 |
else
|
|
1578 |
err = -1;
|
|
1579 |
|
|
1580 |
if(res->FindL(_L8("GlobalUid"), luid))
|
|
1581 |
{
|
|
1582 |
uidset->iGlobalUID = HBufC8::NewL(luid.AsDes().Length()) ;
|
|
1583 |
uidset->iGlobalUID->Des().Copy( luid.AsDes() );
|
|
1584 |
}
|
|
1585 |
else
|
|
1586 |
err = -1;
|
|
1587 |
|
|
1588 |
luid.Reset();
|
|
1589 |
}
|
|
1590 |
else
|
|
1591 |
err = -1;*/
|
|
1592 |
}
|
|
1593 |
else
|
|
1594 |
err = -1;
|
|
1595 |
}
|
|
1596 |
}
|
|
1597 |
cells = User::CountAllocCells();
|
|
1598 |
inparam->Reset();
|
|
1599 |
outparam->Reset();
|
|
1600 |
cells = User::CountAllocCells();
|
|
1601 |
// __UHEAP_MARKEND;
|
|
1602 |
|
|
1603 |
return err;
|
|
1604 |
};
|
|
1605 |
|
|
1606 |
void GetLocalUid( const TDesC& aLocalUid, TCalLocalUid& aOutLocalUid )
|
|
1607 |
{
|
|
1608 |
aOutLocalUid = 0;
|
|
1609 |
if( aLocalUid.Length() )
|
|
1610 |
{
|
|
1611 |
TInt sepPos = aLocalUid.Locate( KUidSeparator );
|
|
1612 |
TPtrC temp;
|
|
1613 |
if( sepPos == KErrNotFound )
|
|
1614 |
{
|
|
1615 |
temp.Set(aLocalUid.Mid(0));
|
|
1616 |
}
|
|
1617 |
else
|
|
1618 |
{
|
|
1619 |
temp.Set(aLocalUid.Mid(0, sepPos));
|
|
1620 |
}
|
|
1621 |
|
|
1622 |
TLex lex(temp);
|
|
1623 |
TInt32 num;
|
|
1624 |
|
|
1625 |
if(lex.Val(num) == KErrNone)
|
|
1626 |
aOutLocalUid = TCalLocalUid(num);
|
|
1627 |
}
|
|
1628 |
}
|
|
1629 |
|
|
1630 |
void GetGlobalUid( const TDesC& aGlobalUid, TDes8& aOutGlobalUid )
|
|
1631 |
{
|
|
1632 |
/*if( aGlobalUid.Length() )
|
|
1633 |
{
|
|
1634 |
TInt sepPos = aGlobalUid.Locate( KUidSeparator );
|
|
1635 |
|
|
1636 |
if( sepPos == KErrNotFound )
|
|
1637 |
{
|
|
1638 |
aOutGlobalUid.Copy( aGlobalUid.Mid(0) );
|
|
1639 |
}
|
|
1640 |
else
|
|
1641 |
{
|
|
1642 |
aOutGlobalUid.Copy( aGlobalUid.Mid( sepPos + 1 ) );
|
|
1643 |
}
|
|
1644 |
}*/
|
|
1645 |
aOutGlobalUid.Copy( aGlobalUid );
|
|
1646 |
}
|
|
1647 |
|
|
1648 |
TDesC& GetEntry(MLiwInterface* interface, CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, TPtrC globaluid, const TDesC& calname)
|
|
1649 |
{
|
|
1650 |
inparam->Reset();
|
|
1651 |
outparam->Reset();
|
|
1652 |
|
|
1653 |
TLiwGenericParam dsNameParam(KContentType, TLiwVariant(_L("CalendarEntry")));
|
|
1654 |
inparam->AppendL(dsNameParam);
|
|
1655 |
|
|
1656 |
CLiwDefaultMap *filterMap = CLiwDefaultMap::NewL();
|
|
1657 |
TLiwGenericParam filterParam(KFilter, TLiwVariant(filterMap));
|
|
1658 |
inparam->AppendL(filterParam);
|
|
1659 |
filterMap->DecRef();
|
|
1660 |
|
|
1661 |
if(calname.Length())
|
|
1662 |
filterMap->InsertL(KCalendarName,TLiwVariant(calname));
|
|
1663 |
filterMap->InsertL(_L8("id"),TLiwVariant(globaluid));
|
|
1664 |
|
|
1665 |
TRAPD(err,interface->ExecuteCmdL( _L8("GetList") ,*inparam ,*outparam));
|
|
1666 |
TInt pos = 0 ;
|
|
1667 |
TBuf<10> result;
|
|
1668 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode"));
|
|
1669 |
|
|
1670 |
if(output)
|
|
1671 |
{
|
|
1672 |
err = output->Value().AsTInt32();
|
|
1673 |
if( err == KErrNone )
|
|
1674 |
{
|
|
1675 |
pos = 0;
|
|
1676 |
output = outparam->FindFirst( pos,_L8("ReturnValue"));
|
|
1677 |
CLiwMap* map;
|
|
1678 |
TInt retvalue = KErrNone;
|
|
1679 |
|
|
1680 |
if ( output )
|
|
1681 |
{
|
|
1682 |
CLiwIterable* iterlist = output->Value().AsIterable();
|
|
1683 |
if(iterlist)
|
|
1684 |
{
|
|
1685 |
TLiwVariant data1;
|
|
1686 |
while(iterlist->NextL(data1) )
|
|
1687 |
{
|
|
1688 |
const CLiwMap* res = data1.AsMap();
|
|
1689 |
if ( res )
|
|
1690 |
{
|
|
1691 |
TLiwVariant data;
|
|
1692 |
if(res->FindL(_L8("LocalId"), data))
|
|
1693 |
result = data.AsDes();
|
|
1694 |
data.Reset();
|
|
1695 |
}
|
|
1696 |
}
|
|
1697 |
data1.Reset();
|
|
1698 |
}
|
|
1699 |
}
|
|
1700 |
}
|
|
1701 |
}
|
|
1702 |
|
|
1703 |
inparam->Reset();
|
|
1704 |
outparam->Reset();
|
|
1705 |
|
|
1706 |
return result;
|
|
1707 |
}
|
|
1708 |
|
|
1709 |
|
|
1710 |
TInt AddAppointmentProvLocal(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset)
|
|
1711 |
{
|
|
1712 |
|
|
1713 |
inparam->Reset();
|
|
1714 |
outparam->Reset();
|
|
1715 |
TInt cells = User::CountAllocCells();
|
|
1716 |
// __UHEAP_MARK;
|
|
1717 |
|
|
1718 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
1719 |
CleanupStack::PushL(map);
|
|
1720 |
|
|
1721 |
TLiwVariant content(_L("CalendarEntry"));
|
|
1722 |
TLiwGenericParam element1;
|
|
1723 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
1724 |
inparam->AppendL(element1);
|
|
1725 |
content.Reset();
|
|
1726 |
element1.Reset();
|
|
1727 |
|
|
1728 |
|
|
1729 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar) );
|
|
1730 |
map->InsertL(_L8("Type"), TLiwVariant( _L("Meeting") ));
|
|
1731 |
map->InsertL(_L8("StartTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,0,0,0))));
|
|
1732 |
map->InsertL(_L8("EndTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,30,0,0))));
|
|
1733 |
map->InsertL(_L8("SeqNum"), TLiwVariant(TInt32(1)));
|
|
1734 |
map->InsertL(_L8("Replication"), TLiwVariant(_L("Open")));
|
|
1735 |
map->InsertL(_L8("Location"), TLiwVariant(_L("Hara Room")));
|
|
1736 |
map->InsertL(_L8("Summary"), TLiwVariant(_L("Meeting happen at 10")));
|
|
1737 |
map->InsertL(_L8("Description"), TLiwVariant(_L("Meeting")));
|
|
1738 |
map->InsertL(_L8("Status"), TLiwVariant(_L("Confirmed")));
|
|
1739 |
map->InsertL(_L8("Method"), TLiwVariant(_L("None")));
|
|
1740 |
|
|
1741 |
CLiwDefaultMap* repeatmap = CLiwDefaultMap::NewL();
|
|
1742 |
CleanupStack::PushL(repeatmap);
|
|
1743 |
repeatmap->InsertL(_L8("Type"), TLiwVariant(TInt32(1)));
|
|
1744 |
repeatmap->InsertL(_L8("StartDate"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,0,0,0))));
|
|
1745 |
repeatmap->InsertL(_L8("UntilDate"), TLiwVariant(TTime(TDateTime(2007,EOctober,30,10,0,0,0))));
|
|
1746 |
map->InsertL(_L8("RepeatRule"), TLiwVariant(repeatmap));
|
|
1747 |
CleanupStack::Pop(repeatmap);
|
|
1748 |
repeatmap->DecRef();
|
|
1749 |
|
|
1750 |
|
|
1751 |
TLiwGenericParam element;
|
|
1752 |
element.SetNameAndValueL(_L8("Item"),TLiwVariant(map));
|
|
1753 |
|
|
1754 |
inparam->AppendL(element);
|
|
1755 |
element.Reset();
|
|
1756 |
map->DecRef();
|
|
1757 |
CleanupStack::Pop(map);
|
|
1758 |
|
|
1759 |
cells = User::CountAllocCells();
|
|
1760 |
|
|
1761 |
//TInt err;
|
|
1762 |
TRAPD(err, interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam ));
|
|
1763 |
TInt pos = 0 ;
|
|
1764 |
|
|
1765 |
cells = User::CountAllocCells();
|
|
1766 |
|
|
1767 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode"));
|
|
1768 |
|
|
1769 |
cells = User::CountAllocCells();
|
|
1770 |
|
|
1771 |
if(output)
|
|
1772 |
{
|
|
1773 |
err = output->Value().AsTInt32();
|
|
1774 |
if ( err == KErrNone )
|
|
1775 |
{
|
|
1776 |
output = outparam->FindFirst( pos,_L8("ReturnValue"));
|
|
1777 |
if(output)
|
|
1778 |
{
|
|
1779 |
uidset = new (ELeave) TUIDSet;
|
|
1780 |
TPtrC uidval = (TPtrC)(output->Value().AsDes());
|
|
1781 |
//GetLocalUid( uidval, uidset->iLocalUID );
|
|
1782 |
|
|
1783 |
uidset->iGlobalUID = HBufC8::NewL(uidval.Length());
|
|
1784 |
TPtr8 tmp = uidset->iGlobalUID->Des();
|
|
1785 |
GetGlobalUid( uidval, tmp );
|
|
1786 |
|
|
1787 |
/*const CLiwMap* res = output->Value().AsMap();
|
|
1788 |
if ( res )
|
|
1789 |
{
|
|
1790 |
uidset = new (ELeave) TUIDSet;
|
|
1791 |
TLiwVariant luid;
|
|
1792 |
if(res->FindL(_L8("LocalUid"), luid))
|
|
1793 |
{
|
|
1794 |
uidset->iLocalUID = luid.AsTUint();
|
|
1795 |
}
|
|
1796 |
else
|
|
1797 |
err = -1;
|
|
1798 |
|
|
1799 |
if(res->FindL(_L8("GlobalUid"), luid))
|
|
1800 |
{
|
|
1801 |
uidset->iGlobalUID = luid.AsData().AllocL();
|
|
1802 |
}
|
|
1803 |
else
|
|
1804 |
err = -1;
|
|
1805 |
|
|
1806 |
luid.Reset();
|
|
1807 |
}
|
|
1808 |
else
|
|
1809 |
err = -1;*/
|
|
1810 |
}
|
|
1811 |
else
|
|
1812 |
err = -1;
|
|
1813 |
}
|
|
1814 |
}
|
|
1815 |
cells = User::CountAllocCells();
|
|
1816 |
inparam->Reset();
|
|
1817 |
outparam->Reset();
|
|
1818 |
cells = User::CountAllocCells();
|
|
1819 |
// __UHEAP_MARKEND;
|
|
1820 |
|
|
1821 |
return err;
|
|
1822 |
}
|
|
1823 |
|
|
1824 |
|
|
1825 |
|
|
1826 |
TInt AddProvEvent(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset)
|
|
1827 |
{
|
|
1828 |
inparam->Reset();
|
|
1829 |
outparam->Reset();
|
|
1830 |
|
|
1831 |
TInt cells = User::CountAllocCells();
|
|
1832 |
// __UHEAP_MARK;
|
|
1833 |
|
|
1834 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
1835 |
CleanupStack::PushL(map);
|
|
1836 |
|
|
1837 |
TLiwVariant content(_L("CalendarEntry"));
|
|
1838 |
TLiwGenericParam element1;
|
|
1839 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
1840 |
inparam->AppendL(element1);
|
|
1841 |
content.Reset();
|
|
1842 |
element1.Reset();
|
|
1843 |
|
|
1844 |
|
|
1845 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar) );
|
|
1846 |
map->InsertL(_L8("Type"), TLiwVariant( _L("DayEvent") ));
|
|
1847 |
map->InsertL(_L8("StartTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,24,0,0,0,0))));
|
|
1848 |
map->InsertL(_L8("Replication"), TLiwVariant(_L("Open")));
|
|
1849 |
map->InsertL(_L8("Description"), TLiwVariant(_L("Event")));
|
|
1850 |
//map->InsertL(_L8("Method"), TLiwVariant(_L("None")));
|
|
1851 |
|
|
1852 |
TLiwGenericParam element;
|
|
1853 |
element.SetNameAndValueL(_L8("Item"),TLiwVariant(map));
|
|
1854 |
|
|
1855 |
inparam->AppendL(element);
|
|
1856 |
element.Reset();
|
|
1857 |
map->DecRef();
|
|
1858 |
CleanupStack::Pop(map);
|
|
1859 |
|
|
1860 |
cells = User::CountAllocCells();
|
|
1861 |
|
|
1862 |
//TInt err;
|
|
1863 |
TRAPD(err, interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam ));
|
|
1864 |
TInt pos = 0 ;
|
|
1865 |
|
|
1866 |
cells = User::CountAllocCells();
|
|
1867 |
|
|
1868 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode"));
|
|
1869 |
|
|
1870 |
cells = User::CountAllocCells();
|
|
1871 |
|
|
1872 |
if(output)
|
|
1873 |
{
|
|
1874 |
err = output->Value().AsTInt32();
|
|
1875 |
if ( err == KErrNone )
|
|
1876 |
{
|
|
1877 |
output = outparam->FindFirst( pos,_L8("ReturnValue"));
|
|
1878 |
if(output)
|
|
1879 |
{
|
|
1880 |
uidset = new (ELeave) TUIDSet;
|
|
1881 |
TPtrC uidval = (TPtrC)(output->Value().AsDes());
|
|
1882 |
//GetLocalUid( uidval, uidset->iLocalUID );
|
|
1883 |
|
|
1884 |
uidset->iGlobalUID = HBufC8::NewL(uidval.Length());
|
|
1885 |
TPtr8 tmp = uidset->iGlobalUID->Des();
|
|
1886 |
GetGlobalUid( uidval, tmp );
|
|
1887 |
/*const CLiwMap* res = output->Value().AsMap();
|
|
1888 |
if ( res )
|
|
1889 |
{
|
|
1890 |
uidset = new (ELeave) TUIDSet;
|
|
1891 |
TLiwVariant luid;
|
|
1892 |
if(res->FindL(_L8("LocalUid"), luid))
|
|
1893 |
{
|
|
1894 |
uidset->iLocalUID = luid.AsTUint();
|
|
1895 |
}
|
|
1896 |
else
|
|
1897 |
err = -1;
|
|
1898 |
|
|
1899 |
if(res->FindL(_L8("GlobalUid"), luid))
|
|
1900 |
{
|
|
1901 |
uidset->iGlobalUID = luid.AsData().AllocL();
|
|
1902 |
}
|
|
1903 |
else
|
|
1904 |
err = -1;
|
|
1905 |
|
|
1906 |
luid.Reset();
|
|
1907 |
}
|
|
1908 |
else
|
|
1909 |
err = -1;*/
|
|
1910 |
}
|
|
1911 |
else
|
|
1912 |
err = -1;
|
|
1913 |
}
|
|
1914 |
}
|
|
1915 |
cells = User::CountAllocCells();
|
|
1916 |
inparam->Reset();
|
|
1917 |
outparam->Reset();
|
|
1918 |
cells = User::CountAllocCells();
|
|
1919 |
// __UHEAP_MARKEND;
|
|
1920 |
|
|
1921 |
return err;
|
|
1922 |
};
|
|
1923 |
|
|
1924 |
|