author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 24 Nov 2009 08:56:33 +0200 | |
changeset 33 | 50974a8b132e |
parent 19 | 989d2f495d90 |
child 58 | ea43c23d28d2 |
permissions | -rw-r--r-- |
19 | 1 |
/* |
2 |
* Copyright (c) 2002 - 2007 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> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
24 |
#include <StifTestInterface.h> |
19 | 25 |
#include "tcal_providertest.h" |
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
26 |
#include <liwcommon.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
27 |
#include <liwvariant.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
28 |
#include <liwservicehandler.h> |
19 | 29 |
#include "calendarheader.h" |
30 |
#include "calendarconstants.h" |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
31 |
#include <badesca.h> |
19 | 32 |
#include "notify.h" |
33 |
//#include <SendUiConsts.h> |
|
34 |
#include "messaginginterface.h" |
|
35 |
#include "sendmessage.h" |
|
36 |
#include <f32file.h> |
|
37 |
#include "messageheader.h" |
|
38 |
#include "serviceerrno.h" |
|
39 |
||
40 |
using namespace LIW; |
|
41 |
||
42 |
// EXTERNAL DATA STRUCTURES |
|
43 |
//extern ?external_data; |
|
44 |
||
45 |
// EXTERNAL FUNCTION PROTOTYPES |
|
46 |
//extern ?external_function( ?arg_type,?arg_type ); |
|
47 |
||
48 |
// CONSTANTS |
|
49 |
//const ?type ?constant_var = ?constant; |
|
50 |
||
51 |
// MACROS |
|
52 |
//#define ?macro ?macro_def |
|
53 |
||
54 |
// LOCAL CONSTANTS AND MACROS |
|
55 |
//const ?type ?constant_var = ?constant; |
|
56 |
//#define ?macro_name ?macro_def |
|
57 |
||
58 |
// MODULE DATA STRUCTURES |
|
59 |
//enum ?declaration |
|
60 |
//typedef ?declaration |
|
61 |
||
62 |
// LOCAL FUNCTION PROTOTYPES |
|
63 |
//?type ?function_name( ?arg_type, ?arg_type ); |
|
64 |
||
65 |
// FORWARD DECLARATIONS |
|
66 |
//class ?FORWARD_CLASSNAME; |
|
67 |
||
68 |
// ============================= LOCAL FUNCTIONS =============================== |
|
69 |
||
70 |
// ----------------------------------------------------------------------------- |
|
71 |
// ?function_name ?description. |
|
72 |
// ?description |
|
73 |
// Returns: ?value_1: ?description |
|
74 |
// ?value_n: ?description_line1 |
|
75 |
// ?description_line2 |
|
76 |
// ----------------------------------------------------------------------------- |
|
77 |
// |
|
78 |
/* |
|
79 |
?type ?function_name( |
|
80 |
?arg_type arg, // ?description |
|
81 |
?arg_type arg) // ?description |
|
82 |
{ |
|
83 |
||
84 |
?code // ?comment |
|
85 |
||
86 |
// ?comment |
|
87 |
?code |
|
88 |
} |
|
89 |
*/ |
|
90 |
||
91 |
||
92 |
/*TInt RemoveProvCalendar(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar); |
|
93 |
TInt AddProvCalendar(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar); |
|
94 |
TInt AddProvAppointmentDailyRepeat(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset); |
|
95 |
TInt AddProvEvent(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset); |
|
96 |
TInt AddProvToDo(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset); |
|
97 |
TInt AddAppointmentProvLocal(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset); |
|
98 |
||
99 |
//void GetLocalUid( const TDesC& aLocalUid, TCalLocalUid& aOutLocalUid ); |
|
100 |
//TInt GetLocalUid( CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar,const TDesC& type, TCalLocalUid& aOutLocalUid ); |
|
101 |
TInt GetLocalUid( CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar,TCalLocalUid& aOutLocalUid ); |
|
102 |
void GetGlobalUid( const TDesC& aGlobalUid, TDes8& aOutGlobalUid );*/ |
|
103 |
TInt ReqNotification( TInt aChangeType, TBool aLocalUid ); |
|
104 |
||
105 |
TBuf<100> gid; |
|
106 |
_LIT8(KIDataSource, "IDataSource"); |
|
107 |
_LIT8(KService, "Service.Calendar"); |
|
108 |
_LIT8(KMsgService, "Service.Messaging"); |
|
109 |
_LIT8(KMsgIDataSource, "IMessaging"); |
|
110 |
_LIT8(KMsgSendCmd, "Send"); |
|
111 |
_LIT8(KMsgDelete, "Delete"); |
|
112 |
_LIT8(KErrCode,"ErrorCode"); |
|
113 |
_LIT8(KMsgGetListCmd,"GetList"); |
|
114 |
_LIT(KSearchTexttest ,"Meeting"); |
|
115 |
_LIT(KDefaultCalendar ,"C:Calendar"); |
|
116 |
_LIT(KTestCal1File, "C:getlistcal1"); |
|
117 |
_LIT(KTestCalFile, "C:ccc"); |
|
118 |
_LIT(KTestCal2File, "C:getlistcal2"); |
|
119 |
||
120 |
// ============================ MEMBER FUNCTIONS =============================== |
|
121 |
||
122 |
// ----------------------------------------------------------------------------- |
|
123 |
// Ctcal_providertest::Delete |
|
124 |
// Delete here all resources allocated and opened from test methods. |
|
125 |
// Called from destructor. |
|
126 |
// ----------------------------------------------------------------------------- |
|
127 |
// |
|
128 |
void Ctcal_providertest::Delete() |
|
129 |
{ |
|
130 |
||
131 |
} |
|
132 |
||
133 |
// ----------------------------------------------------------------------------- |
|
134 |
// Ctcal_providertest::RunMethodL |
|
135 |
// Run specified method. Contains also table of test mothods and their names. |
|
136 |
// ----------------------------------------------------------------------------- |
|
137 |
// |
|
138 |
TInt Ctcal_providertest::RunMethodL( |
|
139 |
CStifItemParser& aItem ) |
|
140 |
{ |
|
141 |
||
142 |
static TStifFunctionInfo const KFunctions[] = |
|
143 |
{ |
|
144 |
// Copy this line for every implemented function. |
|
145 |
// First string is the function name used in TestScripter script file. |
|
146 |
// Second is the actual implementation member function. |
|
147 |
ENTRY( "Calendar_ops1", Ctcal_providertest::Calendar_ops1 ), |
|
148 |
ENTRY( "Calendar_ops2", Ctcal_providertest::Calendar_ops2 ), |
|
149 |
ENTRY( "Calendar_ops3", Ctcal_providertest::Calendar_ops3 ), |
|
150 |
ENTRY( "Calendar_ops4", Ctcal_providertest::Calendar_ops4 ), |
|
151 |
ENTRY( "Calendar_ops5", Ctcal_providertest::Calendar_ops5 ), |
|
152 |
ENTRY( "Calendar_ops6", Ctcal_providertest::Calendar_ops6 ), |
|
153 |
ENTRY( "Calendar_ops7", Ctcal_providertest::Calendar_ops7 ), |
|
154 |
ENTRY( "Calendar_ops8", Ctcal_providertest::Calendar_ops8 ), |
|
155 |
ENTRY( "Calendar_ops9", Ctcal_providertest::Calendar_ops9 ), |
|
156 |
ENTRY( "Calendar_ops10", Ctcal_providertest::Calendar_ops10 ), |
|
157 |
ENTRY( "Calendar_ops11", Ctcal_providertest::Calendar_ops11 ), |
|
158 |
ENTRY( "Calendar_ops12", Ctcal_providertest::Calendar_ops12 ), |
|
159 |
ENTRY( "Calendar_ops13", Ctcal_providertest::Calendar_ops13 ), |
|
160 |
ENTRY( "Calendar_ops14", Ctcal_providertest::Calendar_ops14 ), |
|
161 |
ENTRY( "Calendar_ops15", Ctcal_providertest::Calendar_ops15 ), |
|
162 |
ENTRY( "Calendar_ops16", Ctcal_providertest::Calendar_ops16 ), |
|
163 |
ENTRY( "Calendar_ops17", Ctcal_providertest::Calendar_ops17 ), |
|
164 |
||
165 |
ENTRY( "RemoveFile", Ctcal_providertest::RemoveFile ), |
|
166 |
//ADD NEW ENTRY HERE |
|
167 |
||
168 |
}; |
|
169 |
||
170 |
const TInt count = sizeof( KFunctions ) / |
|
171 |
sizeof( TStifFunctionInfo ); |
|
172 |
||
173 |
return RunInternalL( KFunctions, count, aItem ); |
|
174 |
||
175 |
} |
|
176 |
||
177 |
// Function to remove a file |
|
178 |
TInt Ctcal_providertest::RemoveFile( CStifItemParser& aItem ) |
|
179 |
{ |
|
180 |
TPtrC16 file; |
|
181 |
aItem.GetNextString(file); |
|
182 |
RFile LogResult; |
|
183 |
RFs LogResultSession; |
|
184 |
User::LeaveIfError(LogResultSession.Connect()); |
|
185 |
if(LogResult.Open(LogResultSession ,file , EFileWrite | EFileShareAny ) != KErrNotFound) |
|
186 |
{ |
|
187 |
LogResult.Close(); |
|
188 |
||
189 |
LogResultSession.Delete(file); |
|
190 |
||
191 |
LogResultSession.Close(); |
|
192 |
} |
|
193 |
||
194 |
LogResult.Close(); |
|
195 |
LogResultSession.Close(); |
|
196 |
return KErrNone; |
|
197 |
||
198 |
} |
|
199 |
||
200 |
||
201 |
// ----------------------------------------------------------------------------- |
|
202 |
// Ctcal_providertest::Calendar_ops1 |
|
203 |
// Example test method function to combine Add/Update operations on calendar entries. |
|
204 |
// (other items were commented in a header). |
|
205 |
// ----------------------------------------------------------------------------- |
|
206 |
// |
|
207 |
TInt Ctcal_providertest::Calendar_ops1( CStifItemParser& aItem ) |
|
208 |
{ |
|
209 |
||
210 |
TInt32 result=KErrNone; |
|
211 |
TLiwGenericParam param; |
|
212 |
__UHEAP_MARK; |
|
213 |
||
214 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
215 |
||
216 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
217 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
218 |
||
219 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
220 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
221 |
||
222 |
RCriteriaArray a; |
|
223 |
||
224 |
a.AppendL(crit); |
|
225 |
||
226 |
iServiceHandler->AttachL(a); |
|
227 |
||
228 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
229 |
||
230 |
delete crit; |
|
231 |
crit = NULL; |
|
232 |
a.Reset(); |
|
233 |
||
234 |
TInt pos = 0; |
|
235 |
MLiwInterface* interface = NULL; |
|
236 |
outParamList->FindFirst(pos,KIDataSource ); |
|
237 |
if(pos != KErrNotFound) |
|
238 |
{ |
|
239 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
240 |
} |
|
241 |
||
242 |
inParamList->Reset(); |
|
243 |
outParamList->Reset(); |
|
244 |
||
245 |
iLog->Log(_L("interface created for calendar_ops1")); |
|
246 |
||
247 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
248 |
||
249 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
250 |
||
251 |
RPointerArray<TUIDSet> arruids(5); |
|
252 |
||
253 |
TUIDSet* uids = NULL; |
|
254 |
||
255 |
if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
256 |
{ |
|
257 |
arruids.Append(uids); |
|
258 |
uids = NULL; |
|
259 |
} |
|
260 |
||
261 |
if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
262 |
{ |
|
263 |
arruids.Append(uids); |
|
264 |
uids = NULL; |
|
265 |
} |
|
266 |
||
267 |
if ( arruids.Count() > 0 ) |
|
268 |
{ |
|
269 |
iLog->Log(_L("cal entries added for calendar_ops1")); |
|
270 |
||
271 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
272 |
CleanupStack::PushL(map); |
|
273 |
||
274 |
map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
275 |
||
276 |
gid.Copy( arruids[0]->iGlobalUID->Des() ); |
|
277 |
TInt lid_fetch_err = GetLocalUid(inParamList,outParamList,interface,KTestCal1File,arruids[0]->iLocalUID) ; |
|
278 |
if(lid_fetch_err) |
|
279 |
{ |
|
280 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
281 |
interface->Close(); |
|
282 |
iServiceHandler->Reset(); |
|
283 |
delete iServiceHandler; |
|
284 |
__UHEAP_MARKEND; |
|
285 |
return lid_fetch_err; |
|
286 |
} |
|
287 |
||
288 |
TBuf<10> localuid; |
|
289 |
localuid.Num(TInt64(arruids[0]->iLocalUID)); |
|
290 |
||
291 |
map->InsertL(_L8("LocalId"),TLiwVariant(localuid)); |
|
292 |
map->InsertL(_L8("Summary"), TLiwVariant(_L("test"))); |
|
293 |
||
294 |
||
295 |
param.SetNameAndValueL(KContentType,TLiwVariant(_L("CalendarEntry"))); |
|
296 |
inParamList->AppendL(param); |
|
297 |
param.Reset(); |
|
298 |
||
299 |
param.SetNameAndValueL(_L8("Item"),TLiwVariant(map)); |
|
300 |
inParamList->AppendL(param); |
|
301 |
param.Reset(); |
|
302 |
||
303 |
map->DecRef(); |
|
304 |
CleanupStack::Pop(map); |
|
305 |
||
306 |
interface->ExecuteCmdL( KCmdAdd, *inParamList ,*outParamList ); |
|
307 |
pos=0; |
|
308 |
||
309 |
const TLiwGenericParam* update_err = outParamList->FindFirst(pos,KErrorCode); |
|
310 |
if(update_err) |
|
311 |
result = update_err->Value().AsTInt32(); |
|
312 |
||
313 |
||
314 |
if(!result) |
|
315 |
{ |
|
316 |
inParamList->Reset(); |
|
317 |
outParamList->Reset(); |
|
318 |
||
319 |
TLiwGenericParam dsNameParam(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
320 |
inParamList->AppendL(dsNameParam); |
|
321 |
||
322 |
CLiwDefaultMap* map1 = CLiwDefaultMap::NewL(); |
|
323 |
CleanupStack::PushL(map1); |
|
324 |
||
325 |
map1->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
326 |
map1->InsertL(_L8("LocalId"),TLiwVariant(localuid)); |
|
327 |
||
328 |
TLiwVariant filterparam1(map1); |
|
329 |
TLiwGenericParam element2 ; |
|
330 |
element2.SetNameAndValueL(_L8("Filter"),filterparam1); |
|
331 |
filterparam1.Reset(); |
|
332 |
||
333 |
inParamList->AppendL(element2); |
|
334 |
element2.Reset(); |
|
335 |
||
336 |
map1->DecRef(); |
|
337 |
CleanupStack::Pop(map1); |
|
338 |
||
339 |
interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList); |
|
340 |
||
341 |
pos = 0 ; |
|
342 |
const TLiwGenericParam* getlist_err = outParamList->FindFirst(pos,KErrorCode); |
|
343 |
if(getlist_err) |
|
344 |
result = getlist_err->Value().AsTInt32(); |
|
345 |
pos=0; |
|
346 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue")); |
|
347 |
TInt item_found = 0; |
|
348 |
||
349 |
if(!result && output ) |
|
350 |
{ |
|
351 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
352 |
||
353 |
TLiwVariant data; |
|
354 |
||
355 |
while( iterlist->NextL(data)) |
|
356 |
{ |
|
357 |
const CLiwMap* res = data.AsMap(); |
|
358 |
if ( res ) |
|
359 |
{ |
|
360 |
TLiwVariant new_data; |
|
361 |
if(res->FindL(_L8("Summary"), new_data)) |
|
362 |
{ |
|
363 |
TPtrC loc = new_data.AsDes(); |
|
364 |
TBuf<40> buf; |
|
365 |
buf.Copy(loc); |
|
366 |
iLog->Log(buf); |
|
367 |
iLog->Log(_L("found entry whose summary field is being examined")); |
|
368 |
||
369 |
if( loc.CompareF(_L("test")) != 0 ) |
|
370 |
{ |
|
371 |
result = KErrGeneral; |
|
372 |
new_data.Reset(); |
|
373 |
break; |
|
374 |
} |
|
375 |
else |
|
376 |
iLog->Log(_L("summar is test")); |
|
377 |
||
378 |
} |
|
379 |
new_data.Reset(); |
|
380 |
} |
|
381 |
} |
|
382 |
||
383 |
data.Reset(); |
|
384 |
} |
|
385 |
} |
|
386 |
inParamList->Reset(); |
|
387 |
outParamList->Reset(); |
|
388 |
||
389 |
arruids.ResetAndDestroy(); |
|
390 |
} |
|
391 |
else |
|
392 |
result = KErrGeneral; |
|
393 |
||
394 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
395 |
||
396 |
interface->Close(); |
|
397 |
iServiceHandler->Reset(); |
|
398 |
delete iServiceHandler; |
|
399 |
||
400 |
__UHEAP_MARKEND; |
|
401 |
return result; |
|
402 |
||
403 |
} |
|
404 |
||
405 |
||
406 |
// ----------------------------------------------------------------------------- |
|
407 |
// Ctcal_providertest::Calendar_ops2 |
|
408 |
// Example test method function to combine import/export/Delete operations on calendar entries. |
|
409 |
// (other items were commented in a header). |
|
410 |
// ----------------------------------------------------------------------------- |
|
411 |
// |
|
412 |
TInt Ctcal_providertest::Calendar_ops2( CStifItemParser& aItem ) |
|
413 |
{ |
|
414 |
||
415 |
TInt32 result=KErrNone; |
|
416 |
||
417 |
__UHEAP_MARK; |
|
418 |
||
419 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
420 |
||
421 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
422 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
423 |
||
424 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
425 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
426 |
||
427 |
RCriteriaArray a; |
|
428 |
||
429 |
a.AppendL(crit); |
|
430 |
||
431 |
iServiceHandler->AttachL(a); |
|
432 |
||
433 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
434 |
||
435 |
delete crit; |
|
436 |
crit = NULL; |
|
437 |
a.Reset(); |
|
438 |
||
439 |
TInt pos = 0; |
|
440 |
MLiwInterface* interface = NULL; |
|
441 |
outParamList->FindFirst(pos,KIDataSource ); |
|
442 |
if(pos != KErrNotFound) |
|
443 |
{ |
|
444 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
445 |
} |
|
446 |
||
447 |
inParamList->Reset(); |
|
448 |
outParamList->Reset(); |
|
449 |
||
450 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
451 |
||
452 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
453 |
||
454 |
||
455 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
456 |
||
457 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
458 |
||
459 |
||
460 |
RPointerArray<TUIDSet> arruids(5); |
|
461 |
||
462 |
TUIDSet* uids = NULL; |
|
463 |
||
464 |
if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
465 |
{ |
|
466 |
arruids.Append(uids); |
|
467 |
uids = NULL; |
|
468 |
} |
|
469 |
||
470 |
if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
471 |
{ |
|
472 |
arruids.Append(uids); |
|
473 |
uids = NULL; |
|
474 |
} |
|
475 |
TInt count = 0; |
|
476 |
||
477 |
if ( arruids.Count() > 0 ) |
|
478 |
{ |
|
479 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
480 |
CleanupStack::PushL(map); |
|
481 |
||
482 |
map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
483 |
||
484 |
gid.Copy( arruids[0]->iGlobalUID->Des() ); |
|
485 |
TInt lid_fetch_err = GetLocalUid(inParamList,outParamList,interface,KTestCal1File,arruids[0]->iLocalUID) ; |
|
486 |
if(lid_fetch_err) |
|
487 |
{ |
|
488 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
489 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
490 |
interface->Close(); |
|
491 |
iServiceHandler->Reset(); |
|
492 |
delete iServiceHandler; |
|
493 |
__UHEAP_MARKEND; |
|
494 |
return lid_fetch_err; |
|
495 |
} |
|
496 |
||
497 |
TBuf<10> localuid; |
|
498 |
localuid.Num(TInt64(arruids[0]->iLocalUID)); |
|
499 |
||
500 |
map->InsertL(_L8("Format"), TLiwVariant(_L("VCal")) ); |
|
501 |
map->InsertL(_L8("FileName"), TLiwVariant(_L("c:\\exportall.txt"))); |
|
502 |
||
503 |
TLiwVariant content(_L("CalendarEntry")); |
|
504 |
TLiwGenericParam element1; |
|
505 |
element1.SetNameAndValueL(_L8("Type"),content); |
|
506 |
inParamList->AppendL(element1); |
|
507 |
content.Reset(); |
|
508 |
element1.Reset(); |
|
509 |
||
510 |
TLiwVariant filterparam(map); |
|
511 |
TLiwGenericParam element ; |
|
512 |
element.SetNameAndValueL(_L8("Data"),filterparam); |
|
513 |
filterparam.Reset(); |
|
514 |
||
515 |
inParamList->AppendL(element); |
|
516 |
element.Reset(); |
|
517 |
map->DecRef(); |
|
518 |
CleanupStack::Pop(map); |
|
519 |
||
520 |
interface->ExecuteCmdL( KCmdExport, *inParamList ,*outParamList ); |
|
521 |
pos=0; |
|
522 |
const TLiwGenericParam* export_err = outParamList->FindFirst(pos,KErrorCode); |
|
523 |
if(export_err) |
|
524 |
result = export_err->Value().AsTInt32(); |
|
525 |
||
526 |
if(!result) |
|
527 |
{ |
|
528 |
inParamList->Reset(); |
|
529 |
outParamList->Reset(); |
|
530 |
||
531 |
// Do an Import. |
|
532 |
||
533 |
TLiwGenericParam dsNameParam(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
534 |
inParamList->AppendL(dsNameParam); |
|
535 |
||
536 |
CLiwDefaultMap* map1 = CLiwDefaultMap::NewL(); |
|
537 |
CleanupStack::PushL(map1); |
|
538 |
||
539 |
map1->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal2File) ); |
|
540 |
map1->InsertL(_L8("Format"), TLiwVariant(_L("VCal")) ); |
|
541 |
map1->InsertL(_L8("FileName"), TLiwVariant(_L("c:\\exportall.txt"))); |
|
542 |
||
543 |
TLiwVariant filterparam1(map1); |
|
544 |
TLiwGenericParam element2 ; |
|
545 |
element2.SetNameAndValueL(_L8("Data"),filterparam1); |
|
546 |
filterparam1.Reset(); |
|
547 |
||
548 |
inParamList->AppendL(element2); |
|
549 |
element2.Reset(); |
|
550 |
||
551 |
map1->DecRef(); |
|
552 |
CleanupStack::Pop(map1); |
|
553 |
||
554 |
interface->ExecuteCmdL( KCmdImport ,*inParamList ,*outParamList); |
|
555 |
pos = 0 ; |
|
556 |
const TLiwGenericParam* import_err = outParamList->FindFirst(pos,KErrorCode); |
|
557 |
if(import_err) |
|
558 |
result = import_err->Value().AsTInt32(); |
|
559 |
||
560 |
if(!result) |
|
561 |
{ |
|
562 |
inParamList->Reset(); |
|
563 |
outParamList->Reset(); |
|
564 |
||
565 |
TLiwGenericParam dsNameParam1(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
566 |
inParamList->AppendL(dsNameParam1); |
|
567 |
||
568 |
CLiwDefaultMap* map2 = CLiwDefaultMap::NewL(); |
|
569 |
CleanupStack::PushL(map2); |
|
570 |
||
571 |
map2->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal2File) ); |
|
572 |
map2->InsertL(_L8("DeleteAll"), TLiwVariant(TBool(ETrue)) ); |
|
573 |
||
574 |
TLiwVariant filterparam2(map2); |
|
575 |
TLiwGenericParam element3 ; |
|
576 |
element3.SetNameAndValueL(_L8("Data"),filterparam2); |
|
577 |
filterparam2.Reset(); |
|
578 |
||
579 |
inParamList->AppendL(element3); |
|
580 |
element3.Reset(); |
|
581 |
||
582 |
map2->DecRef(); |
|
583 |
CleanupStack::Pop(map2); |
|
584 |
||
585 |
interface->ExecuteCmdL( KCmdDelete ,*inParamList ,*outParamList); |
|
586 |
const TLiwGenericParam* delete_err = outParamList->FindFirst(pos,KErrorCode); |
|
587 |
if(delete_err) |
|
588 |
result = delete_err->Value().AsTInt32(); |
|
589 |
||
590 |
if(!result) |
|
591 |
{ |
|
592 |
inParamList->Reset(); |
|
593 |
outParamList->Reset(); |
|
594 |
||
595 |
TLiwGenericParam dsNameParam2(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
596 |
inParamList->AppendL(dsNameParam2); |
|
597 |
||
598 |
CLiwDefaultMap* map3 = CLiwDefaultMap::NewL(); |
|
599 |
CleanupStack::PushL(map3); |
|
600 |
||
601 |
map3->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal2File) ); |
|
602 |
map3->InsertL(_L8("LocalUid"),TLiwVariant(localuid)); |
|
603 |
||
604 |
TLiwVariant filterparam3(map3); |
|
605 |
TLiwGenericParam element4 ; |
|
606 |
element4.SetNameAndValueL(_L8("Filter"),filterparam3); |
|
607 |
filterparam3.Reset(); |
|
608 |
||
609 |
inParamList->AppendL(element4); |
|
610 |
element4.Reset(); |
|
611 |
||
612 |
map3->DecRef(); |
|
613 |
CleanupStack::Pop(map3); |
|
614 |
||
615 |
interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList); |
|
616 |
pos = 0 ; |
|
617 |
const TLiwGenericParam* getlist_err = outParamList->FindFirst(pos,KErrorCode); |
|
618 |
if(getlist_err) |
|
619 |
result = getlist_err->Value().AsTInt32(); |
|
620 |
pos=0; |
|
621 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue")); |
|
622 |
if(!result && output) |
|
623 |
{ |
|
624 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
625 |
TLiwVariant data; |
|
626 |
while( iterlist->NextL(data)) |
|
627 |
{ |
|
628 |
count ++; |
|
629 |
} |
|
630 |
data.Reset(); |
|
631 |
} |
|
632 |
} |
|
633 |
} |
|
634 |
} |
|
635 |
||
636 |
inParamList->Reset(); |
|
637 |
outParamList->Reset(); |
|
638 |
arruids.ResetAndDestroy(); |
|
639 |
} |
|
640 |
else |
|
641 |
result = KErrGeneral; |
|
642 |
||
643 |
if(!result && count != 0) |
|
644 |
result = KErrGeneral; |
|
645 |
else |
|
646 |
iLog->Log(_L("result pass in calendar_ops2")); |
|
647 |
||
648 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
649 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
650 |
||
651 |
interface->Close(); |
|
652 |
iServiceHandler->Reset(); |
|
653 |
delete iServiceHandler; |
|
654 |
||
655 |
__UHEAP_MARKEND; |
|
656 |
||
657 |
return result; |
|
658 |
||
659 |
} |
|
660 |
||
661 |
// ----------------------------------------------------------------------------- |
|
662 |
// Ctcal_providertest::Calendar_ops3 |
|
663 |
// Example test method function to combine import/export/Update operations on calendar entries. |
|
664 |
// (other items were commented in a header). |
|
665 |
// ----------------------------------------------------------------------------- |
|
666 |
// |
|
667 |
TInt Ctcal_providertest::Calendar_ops3( CStifItemParser& aItem ) |
|
668 |
{ |
|
669 |
||
670 |
TInt32 result=KErrNone; |
|
671 |
||
672 |
__UHEAP_MARK; |
|
673 |
||
674 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
675 |
||
676 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
677 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
678 |
||
679 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
680 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
681 |
||
682 |
RCriteriaArray a; |
|
683 |
||
684 |
a.AppendL(crit); |
|
685 |
||
686 |
iServiceHandler->AttachL(a); |
|
687 |
||
688 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
689 |
||
690 |
delete crit; |
|
691 |
crit = NULL; |
|
692 |
a.Reset(); |
|
693 |
||
694 |
TInt pos = 0; |
|
695 |
MLiwInterface* interface = NULL; |
|
696 |
outParamList->FindFirst(pos,KIDataSource ); |
|
697 |
if(pos != KErrNotFound) |
|
698 |
{ |
|
699 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
700 |
} |
|
701 |
||
702 |
inParamList->Reset(); |
|
703 |
outParamList->Reset(); |
|
704 |
||
705 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
706 |
||
707 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
708 |
||
709 |
||
710 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
711 |
||
712 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
713 |
||
714 |
||
715 |
RPointerArray<TUIDSet> arruids(5); |
|
716 |
||
717 |
TUIDSet* uids = NULL; |
|
718 |
||
719 |
if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
720 |
{ |
|
721 |
arruids.Append(uids); |
|
722 |
uids = NULL; |
|
723 |
} |
|
724 |
||
725 |
if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
726 |
{ |
|
727 |
arruids.Append(uids); |
|
728 |
uids = NULL; |
|
729 |
} |
|
730 |
TInt count = 0; |
|
731 |
||
732 |
if ( arruids.Count() > 0 ) |
|
733 |
{ |
|
734 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
735 |
CleanupStack::PushL(map); |
|
736 |
map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
737 |
||
738 |
gid.Copy( arruids[0]->iGlobalUID->Des() ); |
|
739 |
TInt lid_fetch_err = GetLocalUid(inParamList,outParamList,interface,KTestCal1File,arruids[0]->iLocalUID) ; |
|
740 |
if(lid_fetch_err) |
|
741 |
{ |
|
742 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
743 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
744 |
interface->Close(); |
|
745 |
iServiceHandler->Reset(); |
|
746 |
delete iServiceHandler; |
|
747 |
__UHEAP_MARKEND; |
|
748 |
return lid_fetch_err; |
|
749 |
} |
|
750 |
||
751 |
TBuf<10> localuid; |
|
752 |
localuid.Num(TInt64(arruids[0]->iLocalUID)); |
|
753 |
||
754 |
TLiwVariant content(_L("CalendarEntry")); |
|
755 |
TLiwGenericParam element1; |
|
756 |
element1.SetNameAndValueL(_L8("Type"),content); |
|
757 |
inParamList->AppendL(element1); |
|
758 |
content.Reset(); |
|
759 |
element1.Reset(); |
|
760 |
||
761 |
map->InsertL(_L8("Format"), TLiwVariant(_L("VCal")) ); |
|
762 |
map->InsertL(_L8("FileName"), TLiwVariant(_L("c:\\exportall.txt"))); |
|
763 |
||
764 |
TLiwVariant filterparam(map); |
|
765 |
TLiwGenericParam element ; |
|
766 |
element.SetNameAndValueL(_L8("Data"),filterparam); |
|
767 |
filterparam.Reset(); |
|
768 |
||
769 |
inParamList->AppendL(element); |
|
770 |
element.Reset(); |
|
771 |
map->DecRef(); |
|
772 |
CleanupStack::Pop(map); |
|
773 |
||
774 |
interface->ExecuteCmdL( KCmdExport, *inParamList ,*outParamList ); |
|
775 |
pos = 0 ; |
|
776 |
const TLiwGenericParam* export_err = outParamList->FindFirst(pos,KErrorCode); |
|
777 |
if(export_err) |
|
778 |
result = export_err->Value().AsTInt32(); |
|
779 |
||
780 |
if(!result) |
|
781 |
{ |
|
782 |
inParamList->Reset(); |
|
783 |
outParamList->Reset(); |
|
784 |
||
785 |
// Do an Import. |
|
786 |
||
787 |
TLiwGenericParam dsNameParam(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
788 |
inParamList->AppendL(dsNameParam); |
|
789 |
||
790 |
CLiwDefaultMap* map1 = CLiwDefaultMap::NewL(); |
|
791 |
CleanupStack::PushL(map1); |
|
792 |
||
793 |
map1->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal2File) ); |
|
794 |
map1->InsertL(_L8("Format"), TLiwVariant(_L("VCal")) ); |
|
795 |
map1->InsertL(_L8("FileName"), TLiwVariant(_L("c:\\exportall.txt"))); |
|
796 |
||
797 |
TLiwVariant filterparam1(map1); |
|
798 |
TLiwGenericParam element2 ; |
|
799 |
element2.SetNameAndValueL(_L8("Data"),filterparam1); |
|
800 |
filterparam1.Reset(); |
|
801 |
||
802 |
inParamList->AppendL(element2); |
|
803 |
element2.Reset(); |
|
804 |
||
805 |
map1->DecRef(); |
|
806 |
CleanupStack::Pop(map1); |
|
807 |
||
808 |
interface->ExecuteCmdL( KCmdImport ,*inParamList ,*outParamList); |
|
809 |
pos=0; |
|
810 |
const TLiwGenericParam* import_err = outParamList->FindFirst(pos,KErrorCode); |
|
811 |
if(import_err) |
|
812 |
result = import_err->Value().AsTInt32(); |
|
813 |
||
814 |
if(!result) |
|
815 |
{ |
|
816 |
inParamList->Reset(); |
|
817 |
outParamList->Reset(); |
|
818 |
||
819 |
TLiwGenericParam dsNameParam1(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
820 |
inParamList->AppendL(dsNameParam1); |
|
821 |
||
822 |
CLiwDefaultMap* map2 = CLiwDefaultMap::NewL(); |
|
823 |
CleanupStack::PushL(map2); |
|
824 |
||
825 |
map2->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal2File) ); |
|
826 |
map2->InsertL(_L8("Summary"), TLiwVariant(_L("meeting")) ); |
|
827 |
map2->InsertL(_L8("LocalId"),TLiwVariant(localuid)); |
|
828 |
||
829 |
TLiwVariant filterparam2(map2); |
|
830 |
TLiwGenericParam element3 ; |
|
831 |
element3.SetNameAndValueL(_L8("Item"),filterparam2); |
|
832 |
filterparam2.Reset(); |
|
833 |
||
834 |
inParamList->AppendL(element3); |
|
835 |
element3.Reset(); |
|
836 |
||
837 |
map2->DecRef(); |
|
838 |
CleanupStack::Pop(map2); |
|
839 |
||
840 |
interface->ExecuteCmdL( KCmdAdd ,*inParamList ,*outParamList); |
|
841 |
pos=0; |
|
842 |
const TLiwGenericParam* update_err = outParamList->FindFirst(pos,KErrorCode); |
|
843 |
if(update_err) |
|
844 |
result = update_err->Value().AsTInt32(); |
|
845 |
||
846 |
if(!result) |
|
847 |
{ |
|
848 |
inParamList->Reset(); |
|
849 |
outParamList->Reset(); |
|
850 |
||
851 |
TLiwGenericParam dsNameParam2(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
852 |
inParamList->AppendL(dsNameParam2); |
|
853 |
||
854 |
CLiwDefaultMap* map3 = CLiwDefaultMap::NewL(); |
|
855 |
CleanupStack::PushL(map3); |
|
856 |
||
857 |
map3->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal2File) ); |
|
858 |
map3->InsertL(_L8("LocalId"),TLiwVariant(localuid)); |
|
859 |
||
860 |
TLiwVariant filterparam3(map3); |
|
861 |
TLiwGenericParam element4 ; |
|
862 |
element4.SetNameAndValueL(_L8("Filter"),filterparam3); |
|
863 |
filterparam3.Reset(); |
|
864 |
||
865 |
inParamList->AppendL(element4); |
|
866 |
element4.Reset(); |
|
867 |
||
868 |
map3->DecRef(); |
|
869 |
CleanupStack::Pop(map3); |
|
870 |
||
871 |
interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList); |
|
872 |
pos = 0 ; |
|
873 |
const TLiwGenericParam* getlist_err = outParamList->FindFirst(pos,KErrorCode); |
|
874 |
if(getlist_err) |
|
875 |
result = getlist_err->Value().AsTInt32(); |
|
876 |
pos=0; |
|
877 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue")); |
|
878 |
||
879 |
if(!result && output) |
|
880 |
{ |
|
881 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
882 |
TLiwVariant data; |
|
883 |
while( iterlist->NextL(data)) |
|
884 |
{ |
|
885 |
const CLiwMap* res = data.AsMap(); |
|
886 |
if ( res ) |
|
887 |
{ |
|
888 |
TLiwVariant new_data; |
|
889 |
if(res->FindL(_L8("Summary"), new_data)) |
|
890 |
{ |
|
891 |
TPtrC p_owner = new_data.AsDes(); |
|
892 |
if( p_owner.CompareF(_L("meeting")) != 0 ) |
|
893 |
{ |
|
894 |
result = KErrGeneral; |
|
895 |
new_data.Reset(); |
|
896 |
break; |
|
897 |
} |
|
898 |
} |
|
899 |
else |
|
900 |
result = KErrGeneral; |
|
901 |
new_data.Reset(); |
|
902 |
} |
|
903 |
else |
|
904 |
result = KErrGeneral; |
|
905 |
} |
|
906 |
data.Reset(); |
|
907 |
} |
|
908 |
} |
|
909 |
} |
|
910 |
} |
|
911 |
||
912 |
inParamList->Reset(); |
|
913 |
outParamList->Reset(); |
|
914 |
arruids.ResetAndDestroy(); |
|
915 |
} |
|
916 |
else |
|
917 |
result = KErrGeneral; |
|
918 |
||
919 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
920 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
921 |
||
922 |
interface->Close(); |
|
923 |
iServiceHandler->Reset(); |
|
924 |
delete iServiceHandler; |
|
925 |
||
926 |
__UHEAP_MARKEND; |
|
927 |
return result; |
|
928 |
} |
|
929 |
||
930 |
// ----------------------------------------------------------------------------- |
|
931 |
// Ctcal_providertest::Calendar_ops4 |
|
932 |
// Example test method function to combine notify/add ops on calendar entries. |
|
933 |
// (other items were commented in a header). |
|
934 |
// ----------------------------------------------------------------------------- |
|
935 |
// |
|
936 |
TInt Ctcal_providertest::Calendar_ops4( CStifItemParser& aItem ) |
|
937 |
{ |
|
938 |
TInt32 result = KErrNone; |
|
939 |
__UHEAP_MARK; |
|
940 |
||
941 |
result = ReqNotification(1, EFalse); |
|
942 |
||
943 |
__UHEAP_MARKEND; |
|
944 |
return result; |
|
945 |
||
946 |
} |
|
947 |
||
948 |
// ----------------------------------------------------------------------------- |
|
949 |
// Ctcal_providertest::Calendar_ops5 |
|
950 |
// Example test method function to combine notify/update/delete operations on calendar entries. |
|
951 |
// (other items were commented in a header). |
|
952 |
// ----------------------------------------------------------------------------- |
|
953 |
// |
|
954 |
TInt Ctcal_providertest::Calendar_ops5( CStifItemParser& aItem ) |
|
955 |
{ |
|
956 |
TInt32 result = KErrNone; |
|
957 |
__UHEAP_MARK; |
|
958 |
||
959 |
result = ReqNotification(2, EFalse); |
|
960 |
||
961 |
__UHEAP_MARKEND; |
|
962 |
return result; |
|
963 |
||
964 |
} |
|
965 |
||
966 |
||
967 |
// ----------------------------------------------------------------------------- |
|
968 |
// Ctcal_providertest::Calendar_ops6 |
|
969 |
// Example test method function to combine add/notify/update operations on calendar entries. |
|
970 |
// (other items were commented in a header). |
|
971 |
// ----------------------------------------------------------------------------- |
|
972 |
// |
|
973 |
TInt Ctcal_providertest::Calendar_ops6( CStifItemParser& aItem ) |
|
974 |
{ |
|
975 |
||
976 |
TInt32 result = KErrNone; |
|
977 |
__UHEAP_MARK; |
|
978 |
||
979 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
980 |
||
981 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
982 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
983 |
||
984 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
985 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
986 |
||
987 |
RCriteriaArray a; |
|
988 |
||
989 |
a.AppendL(crit); |
|
990 |
||
991 |
iServiceHandler->AttachL(a); |
|
992 |
||
993 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
994 |
||
995 |
delete crit; |
|
996 |
crit = NULL; |
|
997 |
a.Reset(); |
|
998 |
||
999 |
TInt pos = 0; |
|
1000 |
MLiwInterface* interface = NULL; |
|
1001 |
outParamList->FindFirst(pos,KIDataSource ); |
|
1002 |
if(pos != KErrNotFound) |
|
1003 |
{ |
|
1004 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
1005 |
} |
|
1006 |
||
1007 |
inParamList->Reset(); |
|
1008 |
outParamList->Reset(); |
|
1009 |
||
1010 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
1011 |
||
1012 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
1013 |
||
1014 |
RPointerArray<TUIDSet> arruids(5); |
|
1015 |
||
1016 |
TUIDSet* uids = NULL; |
|
1017 |
||
1018 |
if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
1019 |
{ |
|
1020 |
arruids.Append(uids); |
|
1021 |
uids = NULL; |
|
1022 |
} |
|
1023 |
||
1024 |
if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
1025 |
{ |
|
1026 |
arruids.Append(uids); |
|
1027 |
uids = NULL; |
|
1028 |
} |
|
1029 |
||
1030 |
||
1031 |
CTestAsync* test = CTestAsync::NewL(); |
|
1032 |
test->Start( 3, EFalse ); |
|
1033 |
result = test->Result(); |
|
1034 |
test->CancelNotification(); |
|
1035 |
delete test; |
|
1036 |
||
1037 |
||
1038 |
inParamList->Reset(); |
|
1039 |
outParamList->Reset(); |
|
1040 |
||
1041 |
arruids.ResetAndDestroy(); |
|
1042 |
||
1043 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
1044 |
||
1045 |
||
1046 |
interface->Close(); |
|
1047 |
iServiceHandler->Reset(); |
|
1048 |
delete iServiceHandler; |
|
1049 |
__UHEAP_MARKEND; |
|
1050 |
return result; |
|
1051 |
||
1052 |
} |
|
1053 |
||
1054 |
||
1055 |
// ----------------------------------------------------------------------------- |
|
1056 |
// Ctcal_providertest::Calendar_ops7 |
|
1057 |
// Example test method function to combine add/export/notify/update ops on calendar entries. |
|
1058 |
// (other items were commented in a header). |
|
1059 |
// ----------------------------------------------------------------------------- |
|
1060 |
// |
|
1061 |
TInt Ctcal_providertest::Calendar_ops7( CStifItemParser& aItem ) |
|
1062 |
{ |
|
1063 |
TInt32 result = KErrNone; |
|
1064 |
__UHEAP_MARK; |
|
1065 |
||
1066 |
result = ReqNotification(4, EFalse); |
|
1067 |
||
1068 |
__UHEAP_MARKEND; |
|
1069 |
return result; |
|
1070 |
||
1071 |
} |
|
1072 |
||
1073 |
// ----------------------------------------------------------------------------- |
|
1074 |
// Ctcal_providertest::Calendar_ops8 |
|
1075 |
// Example test method function to combine add/update/exp-upd/imp/getlist ops on calendar entries. |
|
1076 |
// (other items were commented in a header). |
|
1077 |
// ----------------------------------------------------------------------------- |
|
1078 |
// |
|
1079 |
TInt Ctcal_providertest::Calendar_ops8( CStifItemParser& aItem ) |
|
1080 |
{ |
|
1081 |
TInt32 result=KErrNone; |
|
1082 |
||
1083 |
__UHEAP_MARK; |
|
1084 |
||
1085 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
1086 |
||
1087 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
1088 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
1089 |
||
1090 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
1091 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
1092 |
||
1093 |
RCriteriaArray a; |
|
1094 |
||
1095 |
a.AppendL(crit); |
|
1096 |
||
1097 |
iServiceHandler->AttachL(a); |
|
1098 |
||
1099 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
1100 |
||
1101 |
delete crit; |
|
1102 |
crit = NULL; |
|
1103 |
a.Reset(); |
|
1104 |
||
1105 |
TInt pos = 0; |
|
1106 |
MLiwInterface* interface = NULL; |
|
1107 |
outParamList->FindFirst(pos,KIDataSource ); |
|
1108 |
if(pos != KErrNotFound) |
|
1109 |
{ |
|
1110 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
1111 |
} |
|
1112 |
||
1113 |
inParamList->Reset(); |
|
1114 |
outParamList->Reset(); |
|
1115 |
||
1116 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
1117 |
||
1118 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
1119 |
||
1120 |
||
1121 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
1122 |
||
1123 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
1124 |
||
1125 |
||
1126 |
RPointerArray<TUIDSet> arruids(5); |
|
1127 |
||
1128 |
TUIDSet* uids = NULL; |
|
1129 |
||
1130 |
if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
1131 |
{ |
|
1132 |
arruids.Append(uids); |
|
1133 |
uids = NULL; |
|
1134 |
} |
|
1135 |
||
1136 |
if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
1137 |
{ |
|
1138 |
arruids.Append(uids); |
|
1139 |
uids = NULL; |
|
1140 |
} |
|
1141 |
TInt count = 0; |
|
1142 |
||
1143 |
if ( arruids.Count() > 0 ) |
|
1144 |
{ |
|
1145 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
1146 |
CleanupStack::PushL(map); |
|
1147 |
||
1148 |
map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
1149 |
gid.Copy( arruids[0]->iGlobalUID->Des() ); |
|
1150 |
TInt lid_fetch_err = GetLocalUid(inParamList,outParamList,interface,KTestCal1File,arruids[0]->iLocalUID) ; |
|
1151 |
if(lid_fetch_err) |
|
1152 |
{ |
|
1153 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
1154 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
1155 |
interface->Close(); |
|
1156 |
iServiceHandler->Reset(); |
|
1157 |
delete iServiceHandler; |
|
1158 |
__UHEAP_MARKEND; |
|
1159 |
return lid_fetch_err; |
|
1160 |
} |
|
1161 |
||
1162 |
TBuf<10> localuid; |
|
1163 |
localuid.Num(TInt64(arruids[0]->iLocalUID)); |
|
1164 |
||
1165 |
// update the entry |
|
1166 |
||
1167 |
map->InsertL(_L8("Summary"), TLiwVariant(_L("meeting"))); |
|
1168 |
map->InsertL(_L8("LocalId"),TLiwVariant(localuid)); |
|
1169 |
||
1170 |
TLiwVariant content(_L("CalendarEntry")); |
|
1171 |
TLiwGenericParam element1; |
|
1172 |
element1.SetNameAndValueL(_L8("Type"),content); |
|
1173 |
inParamList->AppendL(element1); |
|
1174 |
content.Reset(); |
|
1175 |
element1.Reset(); |
|
1176 |
||
1177 |
||
1178 |
TLiwVariant filterparam(map); |
|
1179 |
TLiwGenericParam element ; |
|
1180 |
element.SetNameAndValueL(_L8("Item"),filterparam); |
|
1181 |
filterparam.Reset(); |
|
1182 |
||
1183 |
inParamList->AppendL(element); |
|
1184 |
element.Reset(); |
|
1185 |
map->DecRef(); |
|
1186 |
CleanupStack::Pop(map); |
|
1187 |
||
1188 |
interface->ExecuteCmdL( KCmdAdd, *inParamList ,*outParamList ); |
|
1189 |
pos=0; |
|
1190 |
const TLiwGenericParam* update_err = outParamList->FindFirst(pos,KErrorCode); |
|
1191 |
if(update_err) |
|
1192 |
result = update_err->Value().AsTInt32(); |
|
1193 |
||
1194 |
if(!result) |
|
1195 |
{ |
|
1196 |
inParamList->Reset(); |
|
1197 |
outParamList->Reset(); |
|
1198 |
||
1199 |
// Do an export of updated entry. |
|
1200 |
||
1201 |
TLiwGenericParam dsNameParam(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
1202 |
inParamList->AppendL(dsNameParam); |
|
1203 |
||
1204 |
CLiwDefaultMap* map1 = CLiwDefaultMap::NewL(); |
|
1205 |
CleanupStack::PushL(map1); |
|
1206 |
||
1207 |
CLiwDefaultList* attlist = CLiwDefaultList::NewL(); |
|
1208 |
CleanupStack::PushL(attlist); |
|
1209 |
attlist->AppendL( TLiwVariant(localuid)); |
|
1210 |
||
1211 |
map1->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
1212 |
map1->InsertL(_L8("Format"), TLiwVariant(_L("VCal")) ); |
|
1213 |
map1->InsertL(_L8("FileName"), TLiwVariant(_L("c:\\exportall.txt"))); |
|
1214 |
map1->InsertL(_L8("LocalIdList"),TLiwVariant(attlist)); |
|
1215 |
||
1216 |
CleanupStack::Pop(attlist); |
|
1217 |
attlist->DecRef(); |
|
1218 |
||
1219 |
TLiwVariant filterparam1(map1); |
|
1220 |
TLiwGenericParam element2 ; |
|
1221 |
element2.SetNameAndValueL(_L8("Data"),filterparam1); |
|
1222 |
filterparam1.Reset(); |
|
1223 |
||
1224 |
inParamList->AppendL(element2); |
|
1225 |
element2.Reset(); |
|
1226 |
||
1227 |
map1->DecRef(); |
|
1228 |
CleanupStack::Pop(map1); |
|
1229 |
||
1230 |
interface->ExecuteCmdL( KCmdExport ,*inParamList ,*outParamList); |
|
1231 |
pos = 0 ; |
|
1232 |
const TLiwGenericParam* export_err = outParamList->FindFirst(pos,KErrorCode); |
|
1233 |
if(export_err) |
|
1234 |
result = export_err->Value().AsTInt32(); |
|
1235 |
||
1236 |
if(!result) |
|
1237 |
{ |
|
1238 |
inParamList->Reset(); |
|
1239 |
outParamList->Reset(); |
|
1240 |
||
1241 |
// Import updated entry |
|
1242 |
||
1243 |
TLiwGenericParam dsNameParam1(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
1244 |
inParamList->AppendL(dsNameParam1); |
|
1245 |
||
1246 |
CLiwDefaultMap* map2 = CLiwDefaultMap::NewL(); |
|
1247 |
CleanupStack::PushL(map2); |
|
1248 |
||
1249 |
map2->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal2File) ); |
|
1250 |
map2->InsertL(_L8("Format"), TLiwVariant(_L("VCal")) ); |
|
1251 |
map2->InsertL(_L8("FileName"), TLiwVariant(_L("c:\\exportall.txt"))); |
|
1252 |
||
1253 |
TLiwVariant filterparam2(map2); |
|
1254 |
TLiwGenericParam element3 ; |
|
1255 |
element3.SetNameAndValueL(_L8("Data"),filterparam2); |
|
1256 |
filterparam2.Reset(); |
|
1257 |
||
1258 |
inParamList->AppendL(element3); |
|
1259 |
element3.Reset(); |
|
1260 |
||
1261 |
map2->DecRef(); |
|
1262 |
CleanupStack::Pop(map2); |
|
1263 |
||
1264 |
interface->ExecuteCmdL( KCmdImport ,*inParamList ,*outParamList); |
|
1265 |
pos=0; |
|
1266 |
const TLiwGenericParam* import_err = outParamList->FindFirst(pos,KErrorCode); |
|
1267 |
if(import_err) |
|
1268 |
result = import_err->Value().AsTInt32(); |
|
1269 |
||
1270 |
if(!result) |
|
1271 |
{ |
|
1272 |
inParamList->Reset(); |
|
1273 |
outParamList->Reset(); |
|
1274 |
// Check the updated entry |
|
1275 |
||
1276 |
TLiwGenericParam dsNameParam2(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
1277 |
inParamList->AppendL(dsNameParam2); |
|
1278 |
||
1279 |
CLiwDefaultMap* map3 = CLiwDefaultMap::NewL(); |
|
1280 |
CleanupStack::PushL(map3); |
|
1281 |
||
1282 |
map3->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal2File) ); |
|
1283 |
map3->InsertL(_L8("LocalId"),TLiwVariant(localuid)); |
|
1284 |
||
1285 |
TLiwVariant filterparam3(map3); |
|
1286 |
TLiwGenericParam element4 ; |
|
1287 |
element4.SetNameAndValueL(_L8("Filter"),filterparam3); |
|
1288 |
filterparam3.Reset(); |
|
1289 |
||
1290 |
inParamList->AppendL(element4); |
|
1291 |
element4.Reset(); |
|
1292 |
||
1293 |
map3->DecRef(); |
|
1294 |
CleanupStack::Pop(map3); |
|
1295 |
||
1296 |
interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList); |
|
1297 |
pos = 0 ; |
|
1298 |
const TLiwGenericParam* getlist_err = outParamList->FindFirst(pos,KErrorCode); |
|
1299 |
if(getlist_err) |
|
1300 |
result = getlist_err->Value().AsTInt32(); |
|
1301 |
pos=0; |
|
1302 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue")); |
|
1303 |
||
1304 |
if(!result && output) |
|
1305 |
{ |
|
1306 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
1307 |
TLiwVariant data; |
|
1308 |
while( iterlist->NextL(data)) |
|
1309 |
{ |
|
1310 |
const CLiwMap* res = data.AsMap(); |
|
1311 |
if ( res ) |
|
1312 |
{ |
|
1313 |
TLiwVariant new_data; |
|
1314 |
if(res->FindL(_L8("Summary"), new_data)) |
|
1315 |
{ |
|
1316 |
TPtrC p_owner = new_data.AsDes(); |
|
1317 |
if( p_owner.CompareF(_L("meeting")) != 0 ) |
|
1318 |
{ |
|
1319 |
result = KErrGeneral; |
|
1320 |
new_data.Reset(); |
|
1321 |
break; |
|
1322 |
} |
|
1323 |
} |
|
1324 |
else |
|
1325 |
result = KErrGeneral; |
|
1326 |
new_data.Reset(); |
|
1327 |
} |
|
1328 |
else |
|
1329 |
result = KErrGeneral; |
|
1330 |
} |
|
1331 |
data.Reset(); |
|
1332 |
} |
|
1333 |
} |
|
1334 |
} |
|
1335 |
} |
|
1336 |
inParamList->Reset(); |
|
1337 |
outParamList->Reset(); |
|
1338 |
arruids.ResetAndDestroy(); |
|
1339 |
} |
|
1340 |
else |
|
1341 |
result = KErrGeneral; |
|
1342 |
||
1343 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
1344 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
1345 |
||
1346 |
interface->Close(); |
|
1347 |
iServiceHandler->Reset(); |
|
1348 |
delete iServiceHandler; |
|
1349 |
||
1350 |
__UHEAP_MARKEND; |
|
1351 |
||
1352 |
return result; |
|
1353 |
||
1354 |
} |
|
1355 |
||
1356 |
// ----------------------------------------------------------------------------- |
|
1357 |
// Ctcal_providertest::Calendar_ops9 |
|
1358 |
// Example test method function to combine add/delete/getlist-Guid ops on calendar entries. |
|
1359 |
// (other items were commented in a header). |
|
1360 |
// ----------------------------------------------------------------------------- |
|
1361 |
// |
|
1362 |
TInt Ctcal_providertest::Calendar_ops9( CStifItemParser& aItem ) |
|
1363 |
{ |
|
1364 |
TInt32 result=KErrNone; |
|
1365 |
TInt item_found = 0; |
|
1366 |
||
1367 |
__UHEAP_MARK; |
|
1368 |
||
1369 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
1370 |
||
1371 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
1372 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
1373 |
||
1374 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
1375 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
1376 |
||
1377 |
RCriteriaArray a; |
|
1378 |
||
1379 |
a.AppendL(crit); |
|
1380 |
||
1381 |
iServiceHandler->AttachL(a); |
|
1382 |
||
1383 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
1384 |
||
1385 |
delete crit; |
|
1386 |
crit = NULL; |
|
1387 |
a.Reset(); |
|
1388 |
||
1389 |
TInt pos = 0; |
|
1390 |
MLiwInterface* interface = NULL; |
|
1391 |
outParamList->FindFirst(pos,KIDataSource ); |
|
1392 |
if(pos != KErrNotFound) |
|
1393 |
{ |
|
1394 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
1395 |
} |
|
1396 |
||
1397 |
inParamList->Reset(); |
|
1398 |
outParamList->Reset(); |
|
1399 |
||
1400 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
1401 |
||
1402 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
1403 |
||
1404 |
RPointerArray<TUIDSet> arruids(5); |
|
1405 |
||
1406 |
TUIDSet* uids = NULL; |
|
1407 |
||
1408 |
if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
1409 |
{ |
|
1410 |
arruids.Append(uids); |
|
1411 |
uids = NULL; |
|
1412 |
} |
|
1413 |
||
1414 |
if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
1415 |
{ |
|
1416 |
arruids.Append(uids); |
|
1417 |
uids = NULL; |
|
1418 |
} |
|
1419 |
TInt count = 0; |
|
1420 |
||
1421 |
if ( arruids.Count() > 0 ) |
|
1422 |
{ |
|
1423 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
1424 |
CleanupStack::PushL(map); |
|
1425 |
||
1426 |
map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
1427 |
gid.Copy( arruids[0]->iGlobalUID->Des() ); |
|
1428 |
||
1429 |
TInt lid_fetch_err = GetLocalUid(inParamList,outParamList,interface,KTestCal1File,arruids[0]->iLocalUID) ; |
|
1430 |
if(lid_fetch_err) |
|
1431 |
{ |
|
1432 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
1433 |
interface->Close(); |
|
1434 |
iServiceHandler->Reset(); |
|
1435 |
delete iServiceHandler; |
|
1436 |
__UHEAP_MARKEND; |
|
1437 |
return lid_fetch_err; |
|
1438 |
} |
|
1439 |
||
1440 |
TBuf<10> localuid; |
|
1441 |
localuid.Num(TInt64(arruids[0]->iLocalUID)); |
|
1442 |
TBuf<50> guid; |
|
1443 |
guid.Copy(arruids[0]->iGlobalUID->Des()); |
|
1444 |
// delete the entry by GUID |
|
1445 |
||
1446 |
CLiwDefaultList* attlist = CLiwDefaultList::NewL(); |
|
1447 |
CleanupStack::PushL(attlist); |
|
1448 |
attlist->AppendL( TLiwVariant(guid)); |
|
1449 |
||
1450 |
map->InsertL(_L8("IdList"),TLiwVariant(attlist)); |
|
1451 |
||
1452 |
CleanupStack::Pop(attlist); |
|
1453 |
attlist->DecRef(); |
|
1454 |
||
1455 |
TLiwVariant content(_L("CalendarEntry")); |
|
1456 |
TLiwGenericParam element1; |
|
1457 |
element1.SetNameAndValueL(_L8("Type"),content); |
|
1458 |
inParamList->AppendL(element1); |
|
1459 |
content.Reset(); |
|
1460 |
element1.Reset(); |
|
1461 |
||
1462 |
TLiwVariant filterparam(map); |
|
1463 |
TLiwGenericParam element ; |
|
1464 |
element.SetNameAndValueL(_L8("Data"),filterparam); |
|
1465 |
filterparam.Reset(); |
|
1466 |
||
1467 |
inParamList->AppendL(element); |
|
1468 |
element.Reset(); |
|
1469 |
map->DecRef(); |
|
1470 |
CleanupStack::Pop(map); |
|
1471 |
||
1472 |
interface->ExecuteCmdL( KCmdDelete, *inParamList ,*outParamList ); |
|
1473 |
pos = 0 ; |
|
1474 |
const TLiwGenericParam* delete_err = outParamList->FindFirst(pos,KErrorCode); |
|
1475 |
if(delete_err) |
|
1476 |
result = delete_err->Value().AsTInt32(); |
|
1477 |
||
1478 |
if(!result) |
|
1479 |
{ |
|
1480 |
||
1481 |
inParamList->Reset(); |
|
1482 |
outParamList->Reset(); |
|
1483 |
||
1484 |
// Check the deleted entry |
|
1485 |
||
1486 |
TLiwGenericParam dsNameParam2(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
1487 |
inParamList->AppendL(dsNameParam2); |
|
1488 |
||
1489 |
CLiwDefaultMap* map3 = CLiwDefaultMap::NewL(); |
|
1490 |
CleanupStack::PushL(map3); |
|
1491 |
map3->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
1492 |
map3->InsertL(_L8("LocalId"),TLiwVariant(localuid)); |
|
1493 |
||
1494 |
TLiwVariant filterparam3(map3); |
|
1495 |
TLiwGenericParam element4 ; |
|
1496 |
element4.SetNameAndValueL(_L8("Filter"),filterparam3); |
|
1497 |
filterparam3.Reset(); |
|
1498 |
||
1499 |
inParamList->AppendL(element4); |
|
1500 |
element4.Reset(); |
|
1501 |
||
1502 |
map3->DecRef(); |
|
1503 |
CleanupStack::Pop(map3); |
|
1504 |
||
1505 |
interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList); |
|
1506 |
pos = 0 ; |
|
1507 |
const TLiwGenericParam* getlist_err = outParamList->FindFirst(pos,KErrorCode); |
|
1508 |
if(getlist_err) |
|
1509 |
result = getlist_err->Value().AsTInt32(); |
|
1510 |
pos=0; |
|
1511 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue")); |
|
1512 |
||
1513 |
if(!result && output) |
|
1514 |
{ |
|
1515 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
1516 |
TLiwVariant data; |
|
1517 |
while( iterlist->NextL(data)) |
|
1518 |
{ |
|
1519 |
const CLiwMap* res = data.AsMap(); |
|
1520 |
if ( res ) |
|
1521 |
{ |
|
1522 |
item_found++; |
|
1523 |
} |
|
1524 |
} |
|
1525 |
data.Reset(); |
|
1526 |
} |
|
1527 |
} |
|
1528 |
inParamList->Reset(); |
|
1529 |
outParamList->Reset(); |
|
1530 |
arruids.ResetAndDestroy(); |
|
1531 |
} |
|
1532 |
else |
|
1533 |
result = KErrGeneral; |
|
1534 |
||
1535 |
if(!result && item_found != 0) |
|
1536 |
result = KErrGeneral; |
|
1537 |
||
1538 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
1539 |
//RmoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
1540 |
||
1541 |
interface->Close(); |
|
1542 |
iServiceHandler->Reset(); |
|
1543 |
delete iServiceHandler; |
|
1544 |
||
1545 |
__UHEAP_MARKEND; |
|
1546 |
||
1547 |
return result; |
|
1548 |
||
1549 |
} |
|
1550 |
||
1551 |
||
1552 |
// ----------------------------------------------------------------------------- |
|
1553 |
// Ctcal_providertest::Calendar_ops10 |
|
1554 |
// Example test method function to combine add/update/exp!upd/imp/getlist ops on calendar entries. |
|
1555 |
// (other items were commented in a header). |
|
1556 |
// ----------------------------------------------------------------------------- |
|
1557 |
// |
|
1558 |
TInt Ctcal_providertest::Calendar_ops10( CStifItemParser& aItem ) |
|
1559 |
{ |
|
1560 |
TInt32 result=KErrNone; |
|
1561 |
TInt item_found = 0; |
|
1562 |
TInt item_found1 = 0; |
|
1563 |
||
1564 |
__UHEAP_MARK; |
|
1565 |
||
1566 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
1567 |
||
1568 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
1569 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
1570 |
||
1571 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
1572 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
1573 |
||
1574 |
RCriteriaArray a; |
|
1575 |
||
1576 |
a.AppendL(crit); |
|
1577 |
||
1578 |
iServiceHandler->AttachL(a); |
|
1579 |
||
1580 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
1581 |
||
1582 |
delete crit; |
|
1583 |
crit = NULL; |
|
1584 |
a.Reset(); |
|
1585 |
||
1586 |
TInt pos = 0; |
|
1587 |
MLiwInterface* interface = NULL; |
|
1588 |
outParamList->FindFirst(pos,KIDataSource ); |
|
1589 |
if(pos != KErrNotFound) |
|
1590 |
{ |
|
1591 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
1592 |
} |
|
1593 |
||
1594 |
inParamList->Reset(); |
|
1595 |
outParamList->Reset(); |
|
1596 |
||
1597 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
1598 |
||
1599 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
1600 |
||
1601 |
||
1602 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
1603 |
||
1604 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
1605 |
||
1606 |
||
1607 |
RPointerArray<TUIDSet> arruids(5); |
|
1608 |
||
1609 |
TUIDSet* uids = NULL; |
|
1610 |
||
1611 |
if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
1612 |
{ |
|
1613 |
arruids.Append(uids); |
|
1614 |
uids = NULL; |
|
1615 |
} |
|
1616 |
||
1617 |
if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
1618 |
{ |
|
1619 |
arruids.Append(uids); |
|
1620 |
uids = NULL; |
|
1621 |
} |
|
1622 |
TInt count = 0; |
|
1623 |
||
1624 |
if ( arruids.Count() > 0 ) |
|
1625 |
{ |
|
1626 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
1627 |
CleanupStack::PushL(map); |
|
1628 |
||
1629 |
map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
1630 |
||
1631 |
gid.Copy( arruids[0]->iGlobalUID->Des() ); |
|
1632 |
||
1633 |
TInt lid_fetch_err = GetLocalUid(inParamList,outParamList,interface,KTestCal1File,arruids[0]->iLocalUID) ; |
|
1634 |
if(lid_fetch_err) |
|
1635 |
{ |
|
1636 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
1637 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
1638 |
interface->Close(); |
|
1639 |
iServiceHandler->Reset(); |
|
1640 |
delete iServiceHandler; |
|
1641 |
__UHEAP_MARKEND; |
|
1642 |
return lid_fetch_err; |
|
1643 |
} |
|
1644 |
||
1645 |
gid.Copy( arruids[1]->iGlobalUID->Des() ); |
|
1646 |
||
1647 |
TInt lid_fetch_err1 = GetLocalUid(inParamList,outParamList,interface,KTestCal1File,arruids[1]->iLocalUID) ; |
|
1648 |
if(lid_fetch_err1) |
|
1649 |
{ |
|
1650 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
1651 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
1652 |
interface->Close(); |
|
1653 |
iServiceHandler->Reset(); |
|
1654 |
delete iServiceHandler; |
|
1655 |
__UHEAP_MARKEND; |
|
1656 |
return lid_fetch_err1; |
|
1657 |
} |
|
1658 |
||
1659 |
TBuf<10> localuid; |
|
1660 |
localuid.Num(TInt64(arruids[0]->iLocalUID)); |
|
1661 |
TBuf<10> localuid1; |
|
1662 |
localuid1.Num(TInt64(arruids[1]->iLocalUID)); |
|
1663 |
TBuf<50> guid; |
|
1664 |
guid.Copy(arruids[0]->iGlobalUID->Des()); |
|
1665 |
||
1666 |
// update the entry |
|
1667 |
||
1668 |
map->InsertL(_L8("Summary"), TLiwVariant(_L("meeting")) ); |
|
1669 |
map->InsertL(_L8("LocalId"),TLiwVariant(localuid)); |
|
1670 |
||
1671 |
TLiwVariant content(_L("CalendarEntry")); |
|
1672 |
TLiwGenericParam element1; |
|
1673 |
element1.SetNameAndValueL(_L8("Type"),content); |
|
1674 |
inParamList->AppendL(element1); |
|
1675 |
content.Reset(); |
|
1676 |
element1.Reset(); |
|
1677 |
||
1678 |
TLiwVariant filterparam(map); |
|
1679 |
TLiwGenericParam element ; |
|
1680 |
element.SetNameAndValueL(_L8("Item"),filterparam); |
|
1681 |
filterparam.Reset(); |
|
1682 |
||
1683 |
inParamList->AppendL(element); |
|
1684 |
element.Reset(); |
|
1685 |
map->DecRef(); |
|
1686 |
CleanupStack::Pop(map); |
|
1687 |
||
1688 |
interface->ExecuteCmdL( KCmdAdd, *inParamList ,*outParamList ); |
|
1689 |
pos=0; |
|
1690 |
const TLiwGenericParam* update_err = outParamList->FindFirst(pos,KErrorCode); |
|
1691 |
if(update_err) |
|
1692 |
result = update_err->Value().AsTInt32(); |
|
1693 |
||
1694 |
if(!result) |
|
1695 |
{ |
|
1696 |
||
1697 |
inParamList->Reset(); |
|
1698 |
outParamList->Reset(); |
|
1699 |
||
1700 |
// Do an export of updated entry. |
|
1701 |
||
1702 |
TLiwGenericParam dsNameParam(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
1703 |
inParamList->AppendL(dsNameParam); |
|
1704 |
||
1705 |
CLiwDefaultMap* map1 = CLiwDefaultMap::NewL(); |
|
1706 |
CleanupStack::PushL(map1); |
|
1707 |
||
1708 |
CLiwDefaultList* attlist = CLiwDefaultList::NewL(); |
|
1709 |
CleanupStack::PushL(attlist); |
|
1710 |
attlist->AppendL( TLiwVariant(localuid1)); |
|
1711 |
||
1712 |
map1->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
1713 |
map1->InsertL(_L8("Format"), TLiwVariant(_L("VCal")) ); |
|
1714 |
map1->InsertL(_L8("FileName"), TLiwVariant(_L("c:\\exportall.txt"))); |
|
1715 |
map1->InsertL(_L8("LocalIdList"),TLiwVariant(attlist)); |
|
1716 |
||
1717 |
CleanupStack::Pop(attlist); |
|
1718 |
attlist->DecRef(); |
|
1719 |
||
1720 |
TLiwVariant filterparam1(map1); |
|
1721 |
TLiwGenericParam element2 ; |
|
1722 |
element2.SetNameAndValueL(_L8("Data"),filterparam1); |
|
1723 |
filterparam1.Reset(); |
|
1724 |
||
1725 |
inParamList->AppendL(element2); |
|
1726 |
element2.Reset(); |
|
1727 |
||
1728 |
map1->DecRef(); |
|
1729 |
CleanupStack::Pop(map1); |
|
1730 |
||
1731 |
interface->ExecuteCmdL( KCmdExport ,*inParamList ,*outParamList); |
|
1732 |
pos = 0 ; |
|
1733 |
const TLiwGenericParam* export_err = outParamList->FindFirst(pos,KErrorCode); |
|
1734 |
if(export_err) |
|
1735 |
result = export_err->Value().AsTInt32(); |
|
1736 |
||
1737 |
if(!result) |
|
1738 |
{ |
|
1739 |
inParamList->Reset(); |
|
1740 |
outParamList->Reset(); |
|
1741 |
||
1742 |
// Import updated entry |
|
1743 |
||
1744 |
TLiwGenericParam dsNameParam1(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
1745 |
inParamList->AppendL(dsNameParam1); |
|
1746 |
||
1747 |
CLiwDefaultMap* map2 = CLiwDefaultMap::NewL(); |
|
1748 |
CleanupStack::PushL(map2); |
|
1749 |
||
1750 |
map2->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal2File) ); |
|
1751 |
map2->InsertL(_L8("Format"), TLiwVariant(_L("VCal")) ); |
|
1752 |
map2->InsertL(_L8("FileName"), TLiwVariant(_L("c:\\exportall.txt"))); |
|
1753 |
||
1754 |
TLiwVariant filterparam2(map2); |
|
1755 |
TLiwGenericParam element3 ; |
|
1756 |
element3.SetNameAndValueL(_L8("Data"),filterparam2); |
|
1757 |
filterparam2.Reset(); |
|
1758 |
||
1759 |
inParamList->AppendL(element3); |
|
1760 |
element3.Reset(); |
|
1761 |
||
1762 |
map2->DecRef(); |
|
1763 |
CleanupStack::Pop(map2); |
|
1764 |
||
1765 |
interface->ExecuteCmdL( KCmdImport ,*inParamList ,*outParamList); |
|
1766 |
const TLiwGenericParam* import_err = outParamList->FindFirst(pos,KErrorCode); |
|
1767 |
if(import_err) |
|
1768 |
result = import_err->Value().AsTInt32(); |
|
1769 |
||
1770 |
if(!result) |
|
1771 |
{ |
|
1772 |
inParamList->Reset(); |
|
1773 |
outParamList->Reset(); |
|
1774 |
||
1775 |
// Check for the unexported updated entry |
|
1776 |
||
1777 |
TLiwGenericParam dsNameParam2(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
1778 |
inParamList->AppendL(dsNameParam2); |
|
1779 |
||
1780 |
CLiwDefaultMap* map3 = CLiwDefaultMap::NewL(); |
|
1781 |
CleanupStack::PushL(map3); |
|
1782 |
||
1783 |
map3->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
1784 |
map3->InsertL(_L8("LocalId"),TLiwVariant(localuid)); |
|
1785 |
||
1786 |
||
1787 |
TLiwVariant filterparam3(map3); |
|
1788 |
TLiwGenericParam element4 ; |
|
1789 |
element4.SetNameAndValueL(_L8("Filter"),filterparam3); |
|
1790 |
filterparam3.Reset(); |
|
1791 |
||
1792 |
inParamList->AppendL(element4); |
|
1793 |
element4.Reset(); |
|
1794 |
||
1795 |
map3->DecRef(); |
|
1796 |
CleanupStack::Pop(map3); |
|
1797 |
||
1798 |
interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList); |
|
1799 |
pos = 0 ; |
|
1800 |
const TLiwGenericParam* getlist_err = outParamList->FindFirst(pos,KErrorCode); |
|
1801 |
if(getlist_err) |
|
1802 |
result = getlist_err->Value().AsTInt32(); |
|
1803 |
pos=0; |
|
1804 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue")); |
|
1805 |
||
1806 |
if(!result && output) |
|
1807 |
{ |
|
1808 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
1809 |
TLiwVariant data; |
|
1810 |
while( iterlist->NextL(data)) |
|
1811 |
{ |
|
1812 |
const CLiwMap* res = data.AsMap(); |
|
1813 |
if ( res ) |
|
1814 |
{ |
|
1815 |
item_found++; |
|
1816 |
TLiwVariant new_data; |
|
1817 |
if(res->FindL(_L8("Summary"), new_data)) |
|
1818 |
{ |
|
1819 |
TPtrC p_owner = new_data.AsDes(); |
|
1820 |
if( p_owner.CompareF(_L("meeting")) != 0 ) |
|
1821 |
{ |
|
1822 |
result = KErrGeneral; |
|
1823 |
new_data.Reset(); |
|
1824 |
break; |
|
1825 |
} |
|
1826 |
} |
|
1827 |
else |
|
1828 |
result = KErrGeneral; |
|
1829 |
new_data.Reset(); |
|
1830 |
} |
|
1831 |
else |
|
1832 |
result = KErrGeneral; |
|
1833 |
} |
|
1834 |
data.Reset(); |
|
1835 |
} |
|
1836 |
} |
|
1837 |
} |
|
1838 |
} |
|
1839 |
inParamList->Reset(); |
|
1840 |
outParamList->Reset(); |
|
1841 |
arruids.ResetAndDestroy(); |
|
1842 |
} |
|
1843 |
else |
|
1844 |
result = KErrGeneral; |
|
1845 |
||
1846 |
if(!result && item_found != 1) |
|
1847 |
result = KErrGeneral; |
|
1848 |
||
1849 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
1850 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
1851 |
||
1852 |
interface->Close(); |
|
1853 |
iServiceHandler->Reset(); |
|
1854 |
delete iServiceHandler; |
|
1855 |
||
1856 |
__UHEAP_MARKEND; |
|
1857 |
return result; |
|
1858 |
} |
|
1859 |
||
1860 |
||
1861 |
// ----------------------------------------------------------------------------- |
|
1862 |
// Ctcal_providertest::Calendar_ops11 |
|
1863 |
// Example test method function to combine add/deleteall/exp/imp/getlist ops on calendar entries. |
|
1864 |
// (other items were commented in a header). |
|
1865 |
// ----------------------------------------------------------------------------- |
|
1866 |
// |
|
1867 |
TInt Ctcal_providertest::Calendar_ops11( CStifItemParser& aItem ) |
|
1868 |
{ |
|
1869 |
TInt32 result=KErrNone; |
|
1870 |
TInt item_found = 0; |
|
1871 |
TInt item_found1 = 0; |
|
1872 |
||
1873 |
__UHEAP_MARK; |
|
1874 |
||
1875 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
1876 |
||
1877 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
1878 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
1879 |
||
1880 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
1881 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
1882 |
||
1883 |
RCriteriaArray a; |
|
1884 |
||
1885 |
a.AppendL(crit); |
|
1886 |
||
1887 |
iServiceHandler->AttachL(a); |
|
1888 |
||
1889 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
1890 |
||
1891 |
delete crit; |
|
1892 |
crit = NULL; |
|
1893 |
a.Reset(); |
|
1894 |
||
1895 |
TInt pos = 0; |
|
1896 |
MLiwInterface* interface = NULL; |
|
1897 |
outParamList->FindFirst(pos,KIDataSource ); |
|
1898 |
if(pos != KErrNotFound) |
|
1899 |
{ |
|
1900 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
1901 |
} |
|
1902 |
||
1903 |
inParamList->Reset(); |
|
1904 |
outParamList->Reset(); |
|
1905 |
||
1906 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
1907 |
||
1908 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
1909 |
||
1910 |
||
1911 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
1912 |
||
1913 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
1914 |
||
1915 |
||
1916 |
RPointerArray<TUIDSet> arruids(5); |
|
1917 |
||
1918 |
TUIDSet* uids = NULL; |
|
1919 |
||
1920 |
if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
1921 |
{ |
|
1922 |
arruids.Append(uids); |
|
1923 |
uids = NULL; |
|
1924 |
} |
|
1925 |
||
1926 |
if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
1927 |
{ |
|
1928 |
arruids.Append(uids); |
|
1929 |
uids = NULL; |
|
1930 |
} |
|
1931 |
TInt count = 0; |
|
1932 |
||
1933 |
if ( arruids.Count() > 0 ) |
|
1934 |
{ |
|
1935 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
1936 |
CleanupStack::PushL(map); |
|
1937 |
||
1938 |
map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
1939 |
||
1940 |
gid.Copy( arruids[0]->iGlobalUID->Des() ); |
|
1941 |
||
1942 |
TInt lid_fetch_err = GetLocalUid(inParamList,outParamList,interface,KTestCal1File,arruids[0]->iLocalUID) ; |
|
1943 |
if(lid_fetch_err) |
|
1944 |
{ |
|
1945 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
1946 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
1947 |
interface->Close(); |
|
1948 |
iServiceHandler->Reset(); |
|
1949 |
delete iServiceHandler; |
|
1950 |
__UHEAP_MARKEND; |
|
1951 |
return lid_fetch_err; |
|
1952 |
} |
|
1953 |
||
1954 |
TBuf<10> localuid; |
|
1955 |
localuid.Num(TInt64(arruids[0]->iLocalUID)); |
|
1956 |
||
1957 |
// delete all |
|
1958 |
||
1959 |
// map->InsertL(_L8("LocalUid"),TLiwVariant(localuid)); |
|
1960 |
map->InsertL(_L8("DeleteAll"), TLiwVariant(TBool(ETrue)) ); |
|
1961 |
||
1962 |
TLiwVariant content(_L("CalendarEntry")); |
|
1963 |
TLiwGenericParam element1; |
|
1964 |
element1.SetNameAndValueL(_L8("Type"),content); |
|
1965 |
inParamList->AppendL(element1); |
|
1966 |
content.Reset(); |
|
1967 |
element1.Reset(); |
|
1968 |
||
1969 |
TLiwVariant filterparam(map); |
|
1970 |
TLiwGenericParam element ; |
|
1971 |
element.SetNameAndValueL(_L8("Data"),filterparam); |
|
1972 |
filterparam.Reset(); |
|
1973 |
||
1974 |
inParamList->AppendL(element); |
|
1975 |
element.Reset(); |
|
1976 |
map->DecRef(); |
|
1977 |
CleanupStack::Pop(map); |
|
1978 |
||
1979 |
interface->ExecuteCmdL( KCmdDelete, *inParamList ,*outParamList ); |
|
1980 |
pos=0; |
|
1981 |
const TLiwGenericParam* delete_err = outParamList->FindFirst(pos,KErrorCode); |
|
1982 |
if(delete_err) |
|
1983 |
result = delete_err->Value().AsTInt32(); |
|
1984 |
||
1985 |
if(!result) |
|
1986 |
{ |
|
1987 |
inParamList->Reset(); |
|
1988 |
outParamList->Reset(); |
|
1989 |
||
1990 |
// Do an export . |
|
1991 |
||
1992 |
TLiwGenericParam dsNameParam(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
1993 |
inParamList->AppendL(dsNameParam); |
|
1994 |
||
1995 |
CLiwDefaultMap* map1 = CLiwDefaultMap::NewL(); |
|
1996 |
CleanupStack::PushL(map1); |
|
1997 |
||
1998 |
map1->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
1999 |
map1->InsertL(_L8("Format"), TLiwVariant(_L("VCal")) ); |
|
2000 |
map1->InsertL(_L8("FileName"), TLiwVariant(_L("c:\\exportall.txt"))); |
|
2001 |
||
2002 |
TLiwVariant filterparam1(map1); |
|
2003 |
TLiwGenericParam element2 ; |
|
2004 |
element2.SetNameAndValueL(_L8("Data"),filterparam1); |
|
2005 |
filterparam1.Reset(); |
|
2006 |
||
2007 |
inParamList->AppendL(element2); |
|
2008 |
element2.Reset(); |
|
2009 |
||
2010 |
map1->DecRef(); |
|
2011 |
CleanupStack::Pop(map1); |
|
2012 |
||
2013 |
interface->ExecuteCmdL( KCmdExport ,*inParamList ,*outParamList); |
|
2014 |
pos = 0 ; |
|
2015 |
const TLiwGenericParam* export_err = outParamList->FindFirst(pos,KErrorCode); |
|
2016 |
if(export_err) |
|
2017 |
result = export_err->Value().AsTInt32(); |
|
2018 |
||
2019 |
if(!result) |
|
2020 |
{ |
|
2021 |
inParamList->Reset(); |
|
2022 |
outParamList->Reset(); |
|
2023 |
||
2024 |
// Import |
|
2025 |
||
2026 |
TLiwGenericParam dsNameParam1(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
2027 |
inParamList->AppendL(dsNameParam1); |
|
2028 |
||
2029 |
CLiwDefaultMap* map2 = CLiwDefaultMap::NewL(); |
|
2030 |
CleanupStack::PushL(map2); |
|
2031 |
||
2032 |
map2->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal2File) ); |
|
2033 |
map2->InsertL(_L8("Format"), TLiwVariant(_L("VCal")) ); |
|
2034 |
map2->InsertL(_L8("FileName"), TLiwVariant(_L("c:\\exportall.txt"))); |
|
2035 |
||
2036 |
TLiwVariant filterparam2(map2); |
|
2037 |
TLiwGenericParam element3 ; |
|
2038 |
element3.SetNameAndValueL(_L8("Data"),filterparam2); |
|
2039 |
filterparam2.Reset(); |
|
2040 |
||
2041 |
inParamList->AppendL(element3); |
|
2042 |
element3.Reset(); |
|
2043 |
||
2044 |
map2->DecRef(); |
|
2045 |
CleanupStack::Pop(map2); |
|
2046 |
||
2047 |
interface->ExecuteCmdL( KCmdImport ,*inParamList ,*outParamList); |
|
2048 |
pos=0; |
|
2049 |
const TLiwGenericParam* import_err = outParamList->FindFirst(pos,KErrorCode); |
|
2050 |
if(import_err) |
|
2051 |
result = import_err->Value().AsTInt32(); |
|
2052 |
||
2053 |
if(!result) |
|
2054 |
{ |
|
2055 |
inParamList->Reset(); |
|
2056 |
outParamList->Reset(); |
|
2057 |
||
2058 |
// Check for the entry |
|
2059 |
||
2060 |
TLiwGenericParam dsNameParam2(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
2061 |
inParamList->AppendL(dsNameParam2); |
|
2062 |
||
2063 |
CLiwDefaultMap* map3 = CLiwDefaultMap::NewL(); |
|
2064 |
CleanupStack::PushL(map3); |
|
2065 |
||
2066 |
map3->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
2067 |
map3->InsertL(_L8("LocalId"),TLiwVariant(localuid)); |
|
2068 |
||
2069 |
TLiwVariant filterparam3(map3); |
|
2070 |
TLiwGenericParam element4 ; |
|
2071 |
element4.SetNameAndValueL(_L8("Filter"),filterparam3); |
|
2072 |
filterparam3.Reset(); |
|
2073 |
||
2074 |
inParamList->AppendL(element4); |
|
2075 |
element4.Reset(); |
|
2076 |
||
2077 |
map3->DecRef(); |
|
2078 |
CleanupStack::Pop(map3); |
|
2079 |
||
2080 |
interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList); |
|
2081 |
pos = 0 ; |
|
2082 |
const TLiwGenericParam* getlist_err = outParamList->FindFirst(pos,KErrorCode); |
|
2083 |
if(getlist_err) |
|
2084 |
result = getlist_err->Value().AsTInt32(); |
|
2085 |
pos=0; |
|
2086 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue")); |
|
2087 |
||
2088 |
if(!result && output) |
|
2089 |
{ |
|
2090 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
2091 |
TLiwVariant data; |
|
2092 |
||
2093 |
while( iterlist->NextL(data)) |
|
2094 |
{ |
|
2095 |
const CLiwMap* res = data.AsMap(); |
|
2096 |
if ( res ) |
|
2097 |
{ |
|
2098 |
item_found++; |
|
2099 |
} |
|
2100 |
else |
|
2101 |
result = KErrGeneral; |
|
2102 |
} |
|
2103 |
data.Reset(); |
|
2104 |
} |
|
2105 |
} |
|
2106 |
} |
|
2107 |
} |
|
2108 |
inParamList->Reset(); |
|
2109 |
outParamList->Reset(); |
|
2110 |
arruids.ResetAndDestroy(); |
|
2111 |
} |
|
2112 |
else |
|
2113 |
result = KErrGeneral; |
|
2114 |
||
2115 |
if(!result && item_found != 0) |
|
2116 |
result = KErrGeneral; |
|
2117 |
||
2118 |
||
2119 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
2120 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
2121 |
||
2122 |
||
2123 |
interface->Close(); |
|
2124 |
iServiceHandler->Reset(); |
|
2125 |
delete iServiceHandler; |
|
2126 |
||
2127 |
__UHEAP_MARKEND; |
|
2128 |
||
2129 |
return result; |
|
2130 |
||
2131 |
||
2132 |
} |
|
2133 |
||
2134 |
// ----------------------------------------------------------------------------- |
|
2135 |
// Ctcal_providertest::Calendar_ops12 |
|
2136 |
// Example test method function to combine add/del-tmrg/exp-Null/imp/getlist ops on calendar entries. |
|
2137 |
// (other items were commented in a header). |
|
2138 |
// ----------------------------------------------------------------------------- |
|
2139 |
// |
|
2140 |
TInt Ctcal_providertest::Calendar_ops12( CStifItemParser& aItem ) |
|
2141 |
{ |
|
2142 |
TInt32 result=KErrNone; |
|
2143 |
TInt item_found = 0; |
|
2144 |
TInt item_found1 = 0; |
|
2145 |
||
2146 |
__UHEAP_MARK; |
|
2147 |
||
2148 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
2149 |
||
2150 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
2151 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
2152 |
||
2153 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
2154 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
2155 |
||
2156 |
RCriteriaArray a; |
|
2157 |
||
2158 |
a.AppendL(crit); |
|
2159 |
||
2160 |
iServiceHandler->AttachL(a); |
|
2161 |
||
2162 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
2163 |
||
2164 |
delete crit; |
|
2165 |
crit = NULL; |
|
2166 |
a.Reset(); |
|
2167 |
||
2168 |
TInt pos = 0; |
|
2169 |
MLiwInterface* interface = NULL; |
|
2170 |
outParamList->FindFirst(pos,KIDataSource ); |
|
2171 |
if(pos != KErrNotFound) |
|
2172 |
{ |
|
2173 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
2174 |
} |
|
2175 |
||
2176 |
inParamList->Reset(); |
|
2177 |
outParamList->Reset(); |
|
2178 |
||
2179 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
2180 |
||
2181 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
2182 |
||
2183 |
||
2184 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
2185 |
||
2186 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
2187 |
||
2188 |
||
2189 |
RPointerArray<TUIDSet> arruids(5); |
|
2190 |
||
2191 |
TUIDSet* uids = NULL; |
|
2192 |
||
2193 |
if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
2194 |
{ |
|
2195 |
arruids.Append(uids); |
|
2196 |
uids = NULL; |
|
2197 |
} |
|
2198 |
||
2199 |
if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
2200 |
{ |
|
2201 |
arruids.Append(uids); |
|
2202 |
uids = NULL; |
|
2203 |
} |
|
2204 |
TInt count = 0; |
|
2205 |
||
2206 |
if ( arruids.Count() > 0 ) |
|
2207 |
{ |
|
2208 |
TLiwVariant content(_L("CalendarEntry")); |
|
2209 |
TLiwGenericParam element1; |
|
2210 |
element1.SetNameAndValueL(_L8("Type"),content); |
|
2211 |
inParamList->AppendL(element1); |
|
2212 |
content.Reset(); |
|
2213 |
element1.Reset(); |
|
2214 |
||
2215 |
||
2216 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
2217 |
CleanupStack::PushL(map); |
|
2218 |
||
2219 |
map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
2220 |
||
2221 |
TBuf<10> localuid; |
|
2222 |
localuid.Num(TInt64(arruids[0]->iLocalUID)); |
|
2223 |
||
2224 |
||
2225 |
// delete with time range |
|
2226 |
||
2227 |
map->InsertL(_L8("StartRange"),TLiwVariant(TTime(TDateTime(2007,EOctober,22,10,0,0,0)))); |
|
2228 |
map->InsertL(_L8("EndRange"),TLiwVariant(TTime(TDateTime(2007,EOctober,25,10,0,0,0)))); |
|
2229 |
||
2230 |
TLiwVariant filterparam(map); |
|
2231 |
TLiwGenericParam element ; |
|
2232 |
element.SetNameAndValueL(_L8("Data"),filterparam); |
|
2233 |
filterparam.Reset(); |
|
2234 |
||
2235 |
inParamList->AppendL(element); |
|
2236 |
element.Reset(); |
|
2237 |
map->DecRef(); |
|
2238 |
CleanupStack::Pop(map); |
|
2239 |
||
2240 |
interface->ExecuteCmdL( KCmdDelete, *inParamList ,*outParamList ); |
|
2241 |
pos=0; |
|
2242 |
const TLiwGenericParam* delete_err = outParamList->FindFirst(pos,KErrorCode); |
|
2243 |
if(delete_err) |
|
2244 |
result = delete_err->Value().AsTInt32(); |
|
2245 |
||
2246 |
if(!result) |
|
2247 |
{ |
|
2248 |
inParamList->Reset(); |
|
2249 |
outParamList->Reset(); |
|
2250 |
// Do an export . |
|
2251 |
||
2252 |
TLiwGenericParam dsNameParam(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
2253 |
inParamList->AppendL(dsNameParam); |
|
2254 |
||
2255 |
CLiwDefaultMap* map1 = CLiwDefaultMap::NewL(); |
|
2256 |
CleanupStack::PushL(map1); |
|
2257 |
||
2258 |
map1->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
2259 |
map1->InsertL(_L8("Format"), TLiwVariant(_L("VCal")) ); |
|
2260 |
map1->InsertL(_L8("FileName"), TLiwVariant(_L("c:\\exportall.txt"))); |
|
2261 |
||
2262 |
TLiwVariant filterparam1(map1); |
|
2263 |
TLiwGenericParam element2 ; |
|
2264 |
element2.SetNameAndValueL(_L8("Data"),filterparam1); |
|
2265 |
filterparam1.Reset(); |
|
2266 |
||
2267 |
inParamList->AppendL(element2); |
|
2268 |
element2.Reset(); |
|
2269 |
||
2270 |
map1->DecRef(); |
|
2271 |
CleanupStack::Pop(map1); |
|
2272 |
||
2273 |
interface->ExecuteCmdL( KCmdExport ,*inParamList ,*outParamList); |
|
2274 |
pos = 0 ; |
|
2275 |
const TLiwGenericParam* export_err = outParamList->FindFirst(pos,KErrorCode); |
|
2276 |
if(export_err) |
|
2277 |
result = export_err->Value().AsTInt32(); |
|
2278 |
||
2279 |
if(!result) |
|
2280 |
{ |
|
2281 |
inParamList->Reset(); |
|
2282 |
outParamList->Reset(); |
|
2283 |
||
2284 |
// Import |
|
2285 |
||
2286 |
TLiwGenericParam dsNameParam1(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
2287 |
inParamList->AppendL(dsNameParam1); |
|
2288 |
||
2289 |
CLiwDefaultMap* map2 = CLiwDefaultMap::NewL(); |
|
2290 |
CleanupStack::PushL(map2); |
|
2291 |
||
2292 |
map2->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal2File) ); |
|
2293 |
map2->InsertL(_L8("Format"), TLiwVariant(_L("VCal")) ); |
|
2294 |
map2->InsertL(_L8("FileName"), TLiwVariant(_L("c:\\exportall.txt"))); |
|
2295 |
||
2296 |
TLiwVariant filterparam2(map2); |
|
2297 |
TLiwGenericParam element3 ; |
|
2298 |
element3.SetNameAndValueL(_L8("Data"),filterparam2); |
|
2299 |
filterparam2.Reset(); |
|
2300 |
||
2301 |
inParamList->AppendL(element3); |
|
2302 |
element3.Reset(); |
|
2303 |
||
2304 |
map2->DecRef(); |
|
2305 |
CleanupStack::Pop(map2); |
|
2306 |
||
2307 |
interface->ExecuteCmdL( KCmdImport ,*inParamList ,*outParamList); |
|
2308 |
pos=0; |
|
2309 |
const TLiwGenericParam* import_err = outParamList->FindFirst(pos,KErrorCode); |
|
2310 |
if(import_err) |
|
2311 |
result = import_err->Value().AsTInt32(); |
|
2312 |
||
2313 |
if(!result) |
|
2314 |
{ |
|
2315 |
inParamList->Reset(); |
|
2316 |
outParamList->Reset(); |
|
2317 |
||
2318 |
// Check for entries |
|
2319 |
||
2320 |
TLiwGenericParam dsNameParam2(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
2321 |
inParamList->AppendL(dsNameParam2); |
|
2322 |
||
2323 |
CLiwDefaultMap* map3 = CLiwDefaultMap::NewL(); |
|
2324 |
CleanupStack::PushL(map3); |
|
2325 |
||
2326 |
map3->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
2327 |
map3->InsertL(_L8("Type"),TLiwVariant(_L("IncludeAll"))); |
|
2328 |
||
2329 |
TLiwVariant filterparam3(map3); |
|
2330 |
TLiwGenericParam element4 ; |
|
2331 |
element4.SetNameAndValueL(_L8("Filter"),filterparam3); |
|
2332 |
filterparam3.Reset(); |
|
2333 |
||
2334 |
inParamList->AppendL(element4); |
|
2335 |
element4.Reset(); |
|
2336 |
||
2337 |
map3->DecRef(); |
|
2338 |
CleanupStack::Pop(map3); |
|
2339 |
||
2340 |
interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList); |
|
2341 |
pos = 0 ; |
|
2342 |
const TLiwGenericParam* getlist_err = outParamList->FindFirst(pos,KErrorCode); |
|
2343 |
if(getlist_err) |
|
2344 |
result = getlist_err->Value().AsTInt32(); |
|
2345 |
pos=0; |
|
2346 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue")); |
|
2347 |
if(!result && output) |
|
2348 |
{ |
|
2349 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
2350 |
TLiwVariant data; |
|
2351 |
||
2352 |
while( iterlist->NextL(data)) |
|
2353 |
{ |
|
2354 |
const CLiwMap* res = data.AsMap(); |
|
2355 |
if ( res ) |
|
2356 |
{ |
|
2357 |
item_found++; |
|
2358 |
} |
|
2359 |
else |
|
2360 |
result = KErrGeneral; |
|
2361 |
} |
|
2362 |
data.Reset(); |
|
2363 |
} |
|
2364 |
} |
|
2365 |
} |
|
2366 |
} |
|
2367 |
||
2368 |
inParamList->Reset(); |
|
2369 |
outParamList->Reset(); |
|
2370 |
arruids.ResetAndDestroy(); |
|
2371 |
} |
|
2372 |
else |
|
2373 |
result = KErrGeneral; |
|
2374 |
||
2375 |
if(!result && item_found != 6) |
|
2376 |
result = KErrGeneral; |
|
2377 |
||
2378 |
||
2379 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
2380 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
2381 |
||
2382 |
||
2383 |
interface->Close(); |
|
2384 |
iServiceHandler->Reset(); |
|
2385 |
delete iServiceHandler; |
|
2386 |
||
2387 |
__UHEAP_MARKEND; |
|
2388 |
||
2389 |
return result; |
|
2390 |
||
2391 |
||
2392 |
} |
|
2393 |
||
2394 |
// ----------------------------------------------------------------------------- |
|
2395 |
// Ctcal_providertest::Calendar_ops13 |
|
2396 |
// Example test method function to combine add/upd-inst/getlist/del/getlist ops on calendar entries. |
|
2397 |
// (other items were commented in a header). |
|
2398 |
// ----------------------------------------------------------------------------- |
|
2399 |
// |
|
2400 |
TInt Ctcal_providertest::Calendar_ops13( CStifItemParser& aItem ) |
|
2401 |
{ |
|
2402 |
TInt32 result=KErrNone; |
|
2403 |
TInt item_found = 0; |
|
2404 |
TInt item_found1 = 0; |
|
2405 |
||
2406 |
__UHEAP_MARK; |
|
2407 |
||
2408 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
2409 |
||
2410 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
2411 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
2412 |
||
2413 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
2414 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
2415 |
||
2416 |
RCriteriaArray a; |
|
2417 |
||
2418 |
a.AppendL(crit); |
|
2419 |
||
2420 |
iServiceHandler->AttachL(a); |
|
2421 |
||
2422 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
2423 |
||
2424 |
delete crit; |
|
2425 |
crit = NULL; |
|
2426 |
a.Reset(); |
|
2427 |
||
2428 |
TInt pos = 0; |
|
2429 |
MLiwInterface* interface = NULL; |
|
2430 |
outParamList->FindFirst(pos,KIDataSource ); |
|
2431 |
if(pos != KErrNotFound) |
|
2432 |
{ |
|
2433 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
2434 |
} |
|
2435 |
||
2436 |
inParamList->Reset(); |
|
2437 |
outParamList->Reset(); |
|
2438 |
||
2439 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
2440 |
||
2441 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
2442 |
||
2443 |
||
2444 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
2445 |
||
2446 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
2447 |
||
2448 |
||
2449 |
RPointerArray<TUIDSet> arruids(5); |
|
2450 |
||
2451 |
TUIDSet* uids = NULL; |
|
2452 |
||
2453 |
if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
2454 |
{ |
|
2455 |
arruids.Append(uids); |
|
2456 |
uids = NULL; |
|
2457 |
} |
|
2458 |
||
2459 |
if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
2460 |
{ |
|
2461 |
arruids.Append(uids); |
|
2462 |
uids = NULL; |
|
2463 |
} |
|
2464 |
TInt count = 0; |
|
2465 |
||
2466 |
if ( arruids.Count() > 0 ) |
|
2467 |
{ |
|
2468 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
2469 |
CleanupStack::PushL(map); |
|
2470 |
||
2471 |
map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
2472 |
||
2473 |
gid.Copy( arruids[0]->iGlobalUID->Des() ); |
|
2474 |
||
2475 |
TInt lid_fetch_err = GetLocalUid(inParamList,outParamList,interface,KTestCal1File,arruids[0]->iLocalUID) ; |
|
2476 |
if(lid_fetch_err) |
|
2477 |
{ |
|
2478 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
2479 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
2480 |
interface->Close(); |
|
2481 |
iServiceHandler->Reset(); |
|
2482 |
delete iServiceHandler; |
|
2483 |
__UHEAP_MARKEND; |
|
2484 |
return lid_fetch_err; |
|
2485 |
} |
|
2486 |
||
2487 |
TBuf<10> localuid; |
|
2488 |
localuid.Num(TInt64(arruids[0]->iLocalUID)); |
|
2489 |
TBuf<50> guid; |
|
2490 |
guid.Copy(arruids[0]->iGlobalUID->Des()); |
|
2491 |
||
2492 |
// update instance |
|
2493 |
map->InsertL(_L8("StartTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,25,14,30,0,0)))); |
|
2494 |
map->InsertL(_L8("EndTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,25,15,30,0,0)))); |
|
2495 |
map->InsertL(_L8("InstanceStartTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,25,10,0,0,0)))); |
|
2496 |
map->InsertL(_L8("LocalId"),TLiwVariant(localuid)); |
|
2497 |
||
2498 |
TLiwVariant content(_L("CalendarEntry")); |
|
2499 |
TLiwGenericParam element1; |
|
2500 |
element1.SetNameAndValueL(_L8("Type"),content); |
|
2501 |
inParamList->AppendL(element1); |
|
2502 |
content.Reset(); |
|
2503 |
element1.Reset(); |
|
2504 |
||
2505 |
||
2506 |
TLiwVariant filterparam(map); |
|
2507 |
TLiwGenericParam element ; |
|
2508 |
element.SetNameAndValueL(_L8("Item"),filterparam); |
|
2509 |
filterparam.Reset(); |
|
2510 |
||
2511 |
inParamList->AppendL(element); |
|
2512 |
element.Reset(); |
|
2513 |
map->DecRef(); |
|
2514 |
CleanupStack::Pop(map); |
|
2515 |
||
2516 |
interface->ExecuteCmdL( KCmdAdd, *inParamList ,*outParamList ); |
|
2517 |
pos=0; |
|
2518 |
const TLiwGenericParam* update_err = outParamList->FindFirst(pos,KErrorCode); |
|
2519 |
if(update_err) |
|
2520 |
result = update_err->Value().AsTInt32(); |
|
2521 |
||
2522 |
if(!result) |
|
2523 |
{ |
|
2524 |
inParamList->Reset(); |
|
2525 |
outParamList->Reset(); |
|
2526 |
||
2527 |
// Do an getlist by Guid . |
|
2528 |
||
2529 |
TLiwGenericParam dsNameParam(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
2530 |
inParamList->AppendL(dsNameParam); |
|
2531 |
||
2532 |
CLiwDefaultMap* map1 = CLiwDefaultMap::NewL(); |
|
2533 |
CleanupStack::PushL(map1); |
|
2534 |
||
2535 |
map1->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
2536 |
map1->InsertL(_L8("id"),TLiwVariant(guid)); |
|
2537 |
||
2538 |
TLiwVariant filterparam1(map1); |
|
2539 |
TLiwGenericParam element2 ; |
|
2540 |
element2.SetNameAndValueL(_L8("Filter"),filterparam1); |
|
2541 |
filterparam1.Reset(); |
|
2542 |
||
2543 |
inParamList->AppendL(element2); |
|
2544 |
element2.Reset(); |
|
2545 |
||
2546 |
map1->DecRef(); |
|
2547 |
CleanupStack::Pop(map1); |
|
2548 |
||
2549 |
interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList); |
|
2550 |
pos = 0 ; |
|
2551 |
const TLiwGenericParam* getlist_err = outParamList->FindFirst(pos,KErrorCode); |
|
2552 |
if(getlist_err) |
|
2553 |
result = getlist_err->Value().AsTInt32(); |
|
2554 |
pos=0; |
|
2555 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue")); |
|
2556 |
if(!result && output) |
|
2557 |
{ |
|
2558 |
TInt err = output->Value().AsTInt32(); |
|
2559 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
2560 |
TLiwVariant data; |
|
2561 |
||
2562 |
while( iterlist->NextL(data)) |
|
2563 |
{ |
|
2564 |
const CLiwMap* res = data.AsMap(); |
|
2565 |
if ( res ) |
|
2566 |
{ |
|
2567 |
item_found++; |
|
2568 |
} |
|
2569 |
else |
|
2570 |
result = KErrGeneral; |
|
2571 |
} |
|
2572 |
data.Reset(); |
|
2573 |
} |
|
2574 |
||
2575 |
if(!result) |
|
2576 |
{ |
|
2577 |
inParamList->Reset(); |
|
2578 |
outParamList->Reset(); |
|
2579 |
||
2580 |
// Delete by Guid |
|
2581 |
||
2582 |
TLiwGenericParam dsNameParam1(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
2583 |
inParamList->AppendL(dsNameParam1); |
|
2584 |
||
2585 |
CLiwDefaultMap* map2 = CLiwDefaultMap::NewL(); |
|
2586 |
CleanupStack::PushL(map2); |
|
2587 |
||
2588 |
CLiwDefaultList* attlist = CLiwDefaultList::NewL(); |
|
2589 |
CleanupStack::PushL(attlist); |
|
2590 |
attlist->AppendL( TLiwVariant(guid)); |
|
2591 |
||
2592 |
||
2593 |
map2->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
2594 |
map2->InsertL(_L8("IdList"),TLiwVariant(attlist)); |
|
2595 |
||
2596 |
CleanupStack::Pop(attlist); |
|
2597 |
attlist->DecRef(); |
|
2598 |
||
2599 |
TLiwVariant filterparam2(map2); |
|
2600 |
TLiwGenericParam element3 ; |
|
2601 |
element3.SetNameAndValueL(_L8("Data"),filterparam2); |
|
2602 |
filterparam2.Reset(); |
|
2603 |
||
2604 |
inParamList->AppendL(element3); |
|
2605 |
element3.Reset(); |
|
2606 |
||
2607 |
map2->DecRef(); |
|
2608 |
CleanupStack::Pop(map2); |
|
2609 |
||
2610 |
interface->ExecuteCmdL( KCmdDelete ,*inParamList ,*outParamList); |
|
2611 |
pos=0; |
|
2612 |
const TLiwGenericParam* delete_err = outParamList->FindFirst(pos,KErrorCode); |
|
2613 |
if(delete_err) |
|
2614 |
result = delete_err->Value().AsTInt32(); |
|
2615 |
||
2616 |
if(!result) |
|
2617 |
{ |
|
2618 |
inParamList->Reset(); |
|
2619 |
outParamList->Reset(); |
|
2620 |
||
2621 |
// Check for deleted entry |
|
2622 |
||
2623 |
TLiwGenericParam dsNameParam2(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
2624 |
inParamList->AppendL(dsNameParam2); |
|
2625 |
||
2626 |
CLiwDefaultMap* map3 = CLiwDefaultMap::NewL(); |
|
2627 |
CleanupStack::PushL(map3); |
|
2628 |
||
2629 |
map3->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
2630 |
map3->InsertL(_L8("Type"),TLiwVariant(_L("IncludeAll"))); |
|
2631 |
||
2632 |
||
2633 |
TLiwVariant filterparam3(map3); |
|
2634 |
TLiwGenericParam element4 ; |
|
2635 |
element4.SetNameAndValueL(_L8("Filter"),filterparam3); |
|
2636 |
filterparam3.Reset(); |
|
2637 |
||
2638 |
inParamList->AppendL(element4); |
|
2639 |
element4.Reset(); |
|
2640 |
||
2641 |
map3->DecRef(); |
|
2642 |
CleanupStack::Pop(map3); |
|
2643 |
||
2644 |
||
2645 |
interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList); |
|
2646 |
pos = 0 ; |
|
2647 |
const TLiwGenericParam* getlist_err = outParamList->FindFirst(pos,KErrorCode); |
|
2648 |
if(getlist_err) |
|
2649 |
result = getlist_err->Value().AsTInt32(); |
|
2650 |
pos=0; |
|
2651 |
||
2652 |
const TLiwGenericParam* output1 = outParamList->FindFirst( pos,_L8("ReturnValue")); |
|
2653 |
||
2654 |
if(!result && output1) |
|
2655 |
{ |
|
2656 |
CLiwIterable* iterlist1 = output1->Value().AsIterable(); |
|
2657 |
||
2658 |
TLiwVariant data1; |
|
2659 |
||
2660 |
while( iterlist1->NextL(data1)) |
|
2661 |
{ |
|
2662 |
const CLiwMap* res1 = data1.AsMap(); |
|
2663 |
if ( res1 ) |
|
2664 |
{ |
|
2665 |
item_found1++; |
|
2666 |
||
2667 |
} |
|
2668 |
else |
|
2669 |
result = KErrGeneral; |
|
2670 |
} |
|
2671 |
||
2672 |
data1.Reset(); |
|
2673 |
} |
|
2674 |
} |
|
2675 |
} |
|
2676 |
} |
|
2677 |
||
2678 |
inParamList->Reset(); |
|
2679 |
outParamList->Reset(); |
|
2680 |
arruids.ResetAndDestroy(); |
|
2681 |
} |
|
2682 |
else |
|
2683 |
result = KErrGeneral; |
|
2684 |
||
2685 |
if(!result && (item_found1 != 1 || item_found != 2)) |
|
2686 |
result = KErrGeneral; |
|
2687 |
||
2688 |
||
2689 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
2690 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal2File); |
|
2691 |
||
2692 |
||
2693 |
interface->Close(); |
|
2694 |
iServiceHandler->Reset(); |
|
2695 |
delete iServiceHandler; |
|
2696 |
||
2697 |
__UHEAP_MARKEND; |
|
2698 |
||
2699 |
return result; |
|
2700 |
||
2701 |
||
2702 |
} |
|
2703 |
||
2704 |
// ----------------------------------------------------------------------------- |
|
2705 |
// Ctcal_providertest::Calendar_ops14 |
|
2706 |
// Example test method function to test for invalid values |
|
2707 |
// (other items were commented in a header). |
|
2708 |
// ----------------------------------------------------------------------------- |
|
2709 |
// |
|
2710 |
TInt Ctcal_providertest::Calendar_ops14( CStifItemParser& aItem ) |
|
2711 |
{ |
|
2712 |
||
2713 |
TInt32 result=KErrNone; |
|
2714 |
TInt item_found = 0; |
|
2715 |
||
2716 |
__UHEAP_MARK; |
|
2717 |
||
2718 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
2719 |
||
2720 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
2721 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
2722 |
||
2723 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
2724 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
2725 |
||
2726 |
RCriteriaArray a; |
|
2727 |
||
2728 |
a.AppendL(crit); |
|
2729 |
||
2730 |
iServiceHandler->AttachL(a); |
|
2731 |
||
2732 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
2733 |
||
2734 |
delete crit; |
|
2735 |
crit = NULL; |
|
2736 |
a.Reset(); |
|
2737 |
||
2738 |
TInt pos = 0; |
|
2739 |
MLiwInterface* interface = NULL; |
|
2740 |
outParamList->FindFirst(pos,KIDataSource ); |
|
2741 |
if(pos != KErrNotFound) |
|
2742 |
{ |
|
2743 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
2744 |
} |
|
2745 |
||
2746 |
inParamList->Reset(); |
|
2747 |
outParamList->Reset(); |
|
2748 |
||
2749 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
2750 |
||
2751 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
2752 |
||
2753 |
||
2754 |
RPointerArray<TUIDSet> arruids(5); |
|
2755 |
||
2756 |
TUIDSet* uids = NULL; |
|
2757 |
||
2758 |
if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
2759 |
{ |
|
2760 |
arruids.Append(uids); |
|
2761 |
uids = NULL; |
|
2762 |
} |
|
2763 |
||
2764 |
if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
2765 |
{ |
|
2766 |
arruids.Append(uids); |
|
2767 |
uids = NULL; |
|
2768 |
} |
|
2769 |
TInt count = 0; |
|
2770 |
||
2771 |
if ( arruids.Count() > 0 ) |
|
2772 |
{ |
|
2773 |
||
2774 |
TLiwGenericParam dsNameParam2(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
2775 |
inParamList->AppendL(dsNameParam2); |
|
2776 |
||
2777 |
CLiwDefaultMap* map3 = CLiwDefaultMap::NewL(); |
|
2778 |
CleanupStack::PushL(map3); |
|
2779 |
||
2780 |
map3->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
2781 |
map3->InsertL(_L8("Type"),TLiwVariant(_L("Include"))); |
|
2782 |
||
2783 |
TLiwVariant filterparam3(map3); |
|
2784 |
TLiwGenericParam element4 ; |
|
2785 |
element4.SetNameAndValueL(_L8("Filter"),filterparam3); |
|
2786 |
filterparam3.Reset(); |
|
2787 |
||
2788 |
inParamList->AppendL(element4); |
|
2789 |
element4.Reset(); |
|
2790 |
||
2791 |
map3->DecRef(); |
|
2792 |
CleanupStack::Pop(map3); |
|
2793 |
||
2794 |
||
2795 |
interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList); |
|
2796 |
pos = 0 ; |
|
2797 |
||
2798 |
const TLiwGenericParam* err_output3 = outParamList->FindFirst( pos,_L8("ErrorCode")); |
|
2799 |
||
2800 |
||
2801 |
if(err_output3) |
|
2802 |
{ |
|
2803 |
TInt err3 = err_output3->Value().AsTInt32(); |
|
2804 |
if(err3 == KErrNone) |
|
2805 |
result = KErrGeneral; |
|
2806 |
} |
|
2807 |
||
2808 |
inParamList->Reset(); |
|
2809 |
outParamList->Reset(); |
|
2810 |
arruids.ResetAndDestroy(); |
|
2811 |
} |
|
2812 |
else |
|
2813 |
result = KErrGeneral; |
|
2814 |
||
2815 |
||
2816 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
2817 |
||
2818 |
||
2819 |
interface->Close(); |
|
2820 |
iServiceHandler->Reset(); |
|
2821 |
delete iServiceHandler; |
|
2822 |
||
2823 |
__UHEAP_MARKEND; |
|
2824 |
||
2825 |
return result; |
|
2826 |
||
2827 |
} |
|
2828 |
||
2829 |
// ----------------------------------------------------------------------------- |
|
2830 |
// Ctcal_providertest::Calendar_ops15 |
|
2831 |
// Example test method function to check if apt cal entry exists and include the data in a message |
|
2832 |
// (other items were commented in a header). |
|
2833 |
// ----------------------------------------------------------------------------- |
|
2834 |
// |
|
2835 |
TInt Ctcal_providertest::Calendar_ops15( CStifItemParser& aItem ) |
|
2836 |
{ |
|
2837 |
TInt32 result=KErrNone; |
|
2838 |
TInt32 message_id = 0; |
|
2839 |
TInt err; |
|
2840 |
||
2841 |
TInt flag =0; |
|
2842 |
||
2843 |
||
2844 |
__UHEAP_MARK; |
|
2845 |
||
2846 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
2847 |
||
2848 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
2849 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
2850 |
||
2851 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
2852 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
2853 |
||
2854 |
RCriteriaArray a; |
|
2855 |
||
2856 |
a.AppendL(crit); |
|
2857 |
||
2858 |
iServiceHandler->AttachL(a); |
|
2859 |
||
2860 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
2861 |
||
2862 |
delete crit; |
|
2863 |
crit = NULL; |
|
2864 |
a.Reset(); |
|
2865 |
||
2866 |
TInt pos = 0; |
|
2867 |
MLiwInterface* interface = NULL; |
|
2868 |
outParamList->FindFirst(pos,KIDataSource ); |
|
2869 |
if(pos != KErrNotFound) |
|
2870 |
{ |
|
2871 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
2872 |
} |
|
2873 |
||
2874 |
inParamList->Reset(); |
|
2875 |
outParamList->Reset(); |
|
2876 |
||
2877 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
2878 |
||
2879 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
2880 |
||
2881 |
||
2882 |
RPointerArray<TUIDSet> arruids(5); |
|
2883 |
||
2884 |
TUIDSet* uids = NULL; |
|
2885 |
||
2886 |
if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
2887 |
{ |
|
2888 |
arruids.Append(uids); |
|
2889 |
uids = NULL; |
|
2890 |
} |
|
2891 |
||
2892 |
if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
2893 |
{ |
|
2894 |
arruids.Append(uids); |
|
2895 |
uids = NULL; |
|
2896 |
} |
|
2897 |
TInt count = 0; |
|
2898 |
||
2899 |
||
2900 |
TLiwGenericParam dsNameParam(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
2901 |
inParamList->AppendL(dsNameParam); |
|
2902 |
||
2903 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
2904 |
CleanupStack::PushL(map); |
|
2905 |
||
2906 |
map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
2907 |
map->InsertL(_L8("Type"),TLiwVariant(_L("Meeting"))); |
|
2908 |
||
2909 |
||
2910 |
TLiwVariant filterparam(map); |
|
2911 |
TLiwGenericParam element ; |
|
2912 |
element.SetNameAndValueL(_L8("Filter"),filterparam); |
|
2913 |
filterparam.Reset(); |
|
2914 |
||
2915 |
inParamList->AppendL(element); |
|
2916 |
element.Reset(); |
|
2917 |
||
2918 |
map->DecRef(); |
|
2919 |
CleanupStack::Pop(map); |
|
2920 |
||
2921 |
||
2922 |
interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList); |
|
2923 |
pos = 0 ; |
|
2924 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue")); |
|
2925 |
||
2926 |
if(output) |
|
2927 |
{ |
|
2928 |
CLiwIterable* iterlist1 = output->Value().AsIterable(); |
|
2929 |
TLiwVariant data; |
|
2930 |
while( iterlist1->NextL(data)) |
|
2931 |
{ |
|
2932 |
const CLiwMap* res = data.AsMap(); |
|
2933 |
if ( res ) |
|
2934 |
{ |
|
2935 |
flag = 1; |
|
2936 |
break; |
|
2937 |
} |
|
2938 |
else |
|
2939 |
result = KErrGeneral; |
|
2940 |
} |
|
2941 |
data.Reset(); |
|
2942 |
} |
|
2943 |
inParamList->Reset(); |
|
2944 |
outParamList->Reset(); |
|
2945 |
arruids.ResetAndDestroy(); |
|
2946 |
||
2947 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
2948 |
interface->Close(); |
|
2949 |
||
2950 |
// Send Msg with guid of meeting entry |
|
2951 |
||
2952 |
CLiwGenericParamList* inParam = &(iServiceHandler->InParamListL()); |
|
2953 |
CLiwGenericParamList* outParam = &(iServiceHandler->OutParamListL()); |
|
2954 |
CLiwCriteriaItem* crit_msg = CLiwCriteriaItem::NewL(1, KMsgIDataSource,KMsgService); |
|
2955 |
||
2956 |
crit_msg->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
2957 |
||
2958 |
RCriteriaArray a_msg; |
|
2959 |
a_msg.AppendL(crit_msg); |
|
2960 |
||
2961 |
iServiceHandler->AttachL(a_msg); |
|
2962 |
||
2963 |
iServiceHandler->ExecuteServiceCmdL(*crit_msg, *inParam, *outParam); |
|
2964 |
||
2965 |
TInt pos_msg = 0; |
|
2966 |
MLiwInterface* interface_msg = NULL; |
|
2967 |
||
2968 |
outParam->FindFirst(pos_msg,KMsgIDataSource); |
|
2969 |
if(pos_msg != KErrNotFound) |
|
2970 |
{ |
|
2971 |
interface_msg = (*outParam)[pos_msg].Value().AsInterface(); |
|
2972 |
} |
|
2973 |
||
2974 |
inParam->Reset(); |
|
2975 |
outParam->Reset(); |
|
2976 |
||
2977 |
delete crit_msg; |
|
2978 |
crit_msg = NULL; |
|
2979 |
a_msg.Reset(); |
|
2980 |
||
2981 |
inParam->AppendL(TLiwGenericParam( _L8("MessageType"), TLiwVariant( _L("SMS") ))); |
|
2982 |
inParam->AppendL(TLiwGenericParam( _L8("To"), TLiwVariant( _L("9740067386") ))); |
|
2983 |
if(flag) |
|
2984 |
inParam->AppendL(TLiwGenericParam( _L8("BodyText"), TLiwVariant( _L("Appointment") ))); |
|
2985 |
else |
|
2986 |
inParam->AppendL(TLiwGenericParam( _L8("BodyText"), TLiwVariant( _L("No Apt") ))); |
|
2987 |
||
2988 |
interface_msg->ExecuteCmdL( KMsgSendCmd ,*inParam ,*outParam,0,NULL ); |
|
2989 |
||
2990 |
TInt index = 0; |
|
2991 |
const TLiwGenericParam* err2 = outParam->FindFirst(index,KErrCode); |
|
2992 |
result = err2->Value().AsTInt32(); |
|
2993 |
||
2994 |
||
2995 |
||
2996 |
/* if(!result) |
|
2997 |
{ |
|
2998 |
inParam->Reset(); |
|
2999 |
outParam->Reset(); |
|
3000 |
||
3001 |
TLiwVariant content(_L8("Inbox")); |
|
3002 |
TLiwGenericParam element1 ; |
|
3003 |
element1.SetNameAndValueL(_L8("Type"),_L("Inbox")); |
|
3004 |
inParam->AppendL(element1); |
|
3005 |
content.Reset(); |
|
3006 |
element1.Reset(); |
|
3007 |
CLiwDefaultMap* map1 = CLiwDefaultMap::NewL(); |
|
3008 |
CleanupStack::PushL(map1); |
|
3009 |
||
3010 |
CLiwDefaultList* mtmtypelist = CLiwDefaultList::NewL(); |
|
3011 |
CleanupStack::PushL(mtmtypelist); |
|
3012 |
||
3013 |
TLiwVariant mmsmtm(KMessageTypeSMS); |
|
3014 |
mtmtypelist->AppendL(mmsmtm); |
|
3015 |
mmsmtm.Reset(); |
|
3016 |
||
3017 |
TLiwVariant add1(mtmtypelist); |
|
3018 |
||
3019 |
map1->InsertL(_L8("MessageTypeList"), add1); // Mtmtype is added |
|
3020 |
mtmtypelist->DecRef(); |
|
3021 |
CleanupStack::Pop(mtmtypelist); |
|
3022 |
add1.Reset(); |
|
3023 |
||
3024 |
TLiwVariant filterparam1(map1); |
|
3025 |
TLiwGenericParam element2 ; |
|
3026 |
element2.SetNameAndValueL(_L8("Filter"),filterparam1); |
|
3027 |
filterparam1.Reset(); |
|
3028 |
||
3029 |
inParam->AppendL(element2); |
|
3030 |
element2.Reset(); |
|
3031 |
||
3032 |
map1->DecRef(); |
|
3033 |
CleanupStack::Pop(map1); |
|
3034 |
||
3035 |
interface_msg->ExecuteCmdL( KMsgGetListCmd ,*inParam ,*outParam); |
|
3036 |
pos = 0 ; |
|
3037 |
const TLiwGenericParam* getlistmsg_err = outParam->FindFirst(pos,KErrCode); |
|
3038 |
if(getlistmsg_err) |
|
3039 |
result = getlistmsg_err->Value().AsTInt32(); |
|
3040 |
pos=0; |
|
3041 |
const TLiwGenericParam* output1 = outParam->FindFirst( pos,_L8("ReturnValue")); |
|
3042 |
||
3043 |
if(!result && output1) |
|
3044 |
{ |
|
3045 |
TInt err = output1->Value().AsTInt32(); |
|
3046 |
CLiwIterable* iterlist2 = output1->Value().AsIterable(); |
|
3047 |
||
3048 |
TLiwVariant data; |
|
3049 |
||
3050 |
while( iterlist2->NextL(data)) |
|
3051 |
{ |
|
3052 |
const CLiwMap* res = data.AsMap(); |
|
3053 |
if ( res ) |
|
3054 |
{ |
|
3055 |
TLiwVariant text; |
|
3056 |
if(res->FindL(_L8("BodyText"), text)) |
|
3057 |
{ |
|
3058 |
TPtrC apt_text = text.AsDes(); |
|
3059 |
TBuf<40> buf ; |
|
3060 |
buf.Copy(apt_text) ; |
|
3061 |
iLog->Log(buf) ; |
|
3062 |
||
3063 |
TInt val = apt_text.Compare(_L("Appointment")); |
|
3064 |
||
3065 |
if(apt_text.Compare(_L("Appointment")) != 0) |
|
3066 |
result = KErrGeneral; |
|
3067 |
||
3068 |
} |
|
3069 |
text.Reset(); |
|
3070 |
||
3071 |
TLiwVariant mid; |
|
3072 |
if(res->FindL(_L8("MessageId"), mid)) |
|
3073 |
{ |
|
3074 |
message_id = mid.AsTInt32(); |
|
3075 |
||
3076 |
} |
|
3077 |
mid.Reset(); |
|
3078 |
} |
|
3079 |
else |
|
3080 |
result = KErrGeneral; |
|
3081 |
} |
|
3082 |
data.Reset(); |
|
3083 |
||
3084 |
} |
|
3085 |
} |
|
3086 |
||
3087 |
if(!result && message_id) |
|
3088 |
{ |
|
3089 |
//Delete the message |
|
3090 |
inParam->Reset(); |
|
3091 |
outParam->Reset(); |
|
3092 |
inParam->AppendL(TLiwGenericParam( _L8("MessageId"), TLiwVariant( TInt32(message_id) ))); |
|
3093 |
||
3094 |
interface_msg->ExecuteCmdL( KMsgDelete ,*inParam ,*outParam,0,NULL ); |
|
3095 |
||
3096 |
index = 0; |
|
3097 |
const TLiwGenericParam* err_del = outParam->FindFirst(index,KErrCode); |
|
3098 |
result = err_del->Value().AsTInt32(); |
|
3099 |
}*/ |
|
3100 |
||
3101 |
inParam->Reset(); |
|
3102 |
outParam->Reset(); |
|
3103 |
||
3104 |
interface_msg->Close(); |
|
3105 |
iServiceHandler->Reset(); |
|
3106 |
delete iServiceHandler; |
|
3107 |
__UHEAP_MARKEND; |
|
3108 |
return result; |
|
3109 |
} |
|
3110 |
||
3111 |
||
3112 |
// ----------------------------------------------------------------------------- |
|
3113 |
// Ctcal_providertest::Calendar_ops16 |
|
3114 |
// Example test method function to create to-do entry,send a message and change status of to-do |
|
3115 |
// (other items were commented in a header). |
|
3116 |
// ----------------------------------------------------------------------------- |
|
3117 |
// |
|
3118 |
TInt Ctcal_providertest::Calendar_ops16( CStifItemParser& aItem ) |
|
3119 |
{ |
|
3120 |
TInt32 result=KErrNone; |
|
3121 |
TInt32 message_id = 0; |
|
3122 |
TInt err; |
|
3123 |
||
3124 |
||
3125 |
__UHEAP_MARK; |
|
3126 |
||
3127 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
3128 |
||
3129 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
3130 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
3131 |
||
3132 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
3133 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
3134 |
||
3135 |
RCriteriaArray a; |
|
3136 |
||
3137 |
a.AppendL(crit); |
|
3138 |
||
3139 |
iServiceHandler->AttachL(a); |
|
3140 |
||
3141 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
3142 |
||
3143 |
delete crit; |
|
3144 |
crit = NULL; |
|
3145 |
a.Reset(); |
|
3146 |
||
3147 |
TInt pos = 0; |
|
3148 |
MLiwInterface* interface = NULL; |
|
3149 |
outParamList->FindFirst(pos,KIDataSource ); |
|
3150 |
if(pos != KErrNotFound) |
|
3151 |
{ |
|
3152 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
3153 |
} |
|
3154 |
||
3155 |
inParamList->Reset(); |
|
3156 |
outParamList->Reset(); |
|
3157 |
||
3158 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
3159 |
||
3160 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
3161 |
||
3162 |
||
3163 |
RPointerArray<TUIDSet> arruids(5); |
|
3164 |
||
3165 |
TUIDSet* uids = NULL; |
|
3166 |
||
3167 |
if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
3168 |
{ |
|
3169 |
arruids.Append(uids); |
|
3170 |
uids = NULL; |
|
3171 |
} |
|
3172 |
||
3173 |
if(AddProvToDo(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
3174 |
{ |
|
3175 |
arruids.Append(uids); |
|
3176 |
uids = NULL; |
|
3177 |
} |
|
3178 |
TInt count = arruids.Count(); |
|
3179 |
||
3180 |
||
3181 |
if ( arruids.Count() > 0 ) |
|
3182 |
{ |
|
3183 |
CLiwGenericParamList* inParam = &(iServiceHandler->InParamListL()); |
|
3184 |
CLiwGenericParamList* outParam = &(iServiceHandler->OutParamListL()); |
|
3185 |
CLiwCriteriaItem* crit_msg = CLiwCriteriaItem::NewL(1, KMsgIDataSource,KMsgService); |
|
3186 |
||
3187 |
crit_msg->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
3188 |
||
3189 |
RCriteriaArray a_msg; |
|
3190 |
a_msg.AppendL(crit_msg); |
|
3191 |
||
3192 |
iServiceHandler->AttachL(a_msg); |
|
3193 |
||
3194 |
iServiceHandler->ExecuteServiceCmdL(*crit_msg, *inParam, *outParam); |
|
3195 |
||
3196 |
TInt pos_msg = 0; |
|
3197 |
MLiwInterface* interface_msg = NULL; |
|
3198 |
||
3199 |
outParam->FindFirst(pos_msg,KMsgIDataSource); |
|
3200 |
if(pos_msg != KErrNotFound) |
|
3201 |
{ |
|
3202 |
interface_msg = (*outParam)[pos_msg].Value().AsInterface(); |
|
3203 |
} |
|
3204 |
||
3205 |
inParam->Reset(); |
|
3206 |
outParam->Reset(); |
|
3207 |
||
3208 |
delete crit_msg; |
|
3209 |
crit_msg = NULL; |
|
3210 |
a_msg.Reset(); |
|
3211 |
||
3212 |
inParam->AppendL(TLiwGenericParam( _L8("MessageType"), TLiwVariant( _L("SMS") ))); |
|
3213 |
inParam->AppendL(TLiwGenericParam( _L8("To"), TLiwVariant( _L("9740067386") ))); |
|
3214 |
inParam->AppendL(TLiwGenericParam( _L8("BodyText"), TLiwVariant( _L("Test Message") ))); |
|
3215 |
||
3216 |
interface_msg->ExecuteCmdL( KMsgSendCmd ,*inParam ,*outParam,0,NULL ); |
|
3217 |
||
3218 |
TInt index = 0; |
|
3219 |
const TLiwGenericParam* err2 = outParam->FindFirst(index,KErrCode); |
|
3220 |
result = err2->Value().AsTInt32(); |
|
3221 |
||
3222 |
/* if(!result) |
|
3223 |
{ |
|
3224 |
inParam->Reset(); |
|
3225 |
outParam->Reset(); |
|
3226 |
||
3227 |
TLiwVariant content(_L8("Inbox")); |
|
3228 |
TLiwGenericParam element1 ; |
|
3229 |
element1.SetNameAndValueL(_L8("Type"),_L("Inbox")); |
|
3230 |
inParam->AppendL(element1); |
|
3231 |
content.Reset(); |
|
3232 |
element1.Reset(); |
|
3233 |
CLiwDefaultMap* map1 = CLiwDefaultMap::NewL(); |
|
3234 |
CleanupStack::PushL(map1); |
|
3235 |
||
3236 |
CLiwDefaultList* mtmtypelist = CLiwDefaultList::NewL(); |
|
3237 |
CleanupStack::PushL(mtmtypelist); |
|
3238 |
||
3239 |
TLiwVariant mmsmtm(KMessageTypeSMS); |
|
3240 |
mtmtypelist->AppendL(mmsmtm); |
|
3241 |
mmsmtm.Reset(); |
|
3242 |
||
3243 |
TLiwVariant add1(mtmtypelist); |
|
3244 |
||
3245 |
map1->InsertL(_L8("MessageTypeList"), add1); // Mtmtype is added |
|
3246 |
mtmtypelist->DecRef(); |
|
3247 |
CleanupStack::Pop(mtmtypelist); |
|
3248 |
add1.Reset(); |
|
3249 |
||
3250 |
TLiwVariant filterparam1(map1); |
|
3251 |
TLiwGenericParam element2 ; |
|
3252 |
element2.SetNameAndValueL(_L8("Filter"),filterparam1); |
|
3253 |
filterparam1.Reset(); |
|
3254 |
||
3255 |
inParam->AppendL(element2); |
|
3256 |
element2.Reset(); |
|
3257 |
||
3258 |
map1->DecRef(); |
|
3259 |
CleanupStack::Pop(map1); |
|
3260 |
||
3261 |
interface_msg->ExecuteCmdL( KMsgGetListCmd ,*inParam ,*outParam); |
|
3262 |
index = 0 ; |
|
3263 |
const TLiwGenericParam* getlistmsg_err = outParam->FindFirst(index,KErrCode); |
|
3264 |
if(getlistmsg_err) |
|
3265 |
result = getlistmsg_err->Value().AsTInt32(); |
|
3266 |
index=0; |
|
3267 |
const TLiwGenericParam* output1 = outParam->FindFirst( index,_L8("ReturnValue")); |
|
3268 |
||
3269 |
if(!result && output1) |
|
3270 |
{ |
|
3271 |
TInt err = output1->Value().AsTInt32(); |
|
3272 |
CLiwIterable* iterlist2 = output1->Value().AsIterable(); |
|
3273 |
||
3274 |
TLiwVariant data; |
|
3275 |
||
3276 |
while( iterlist2->NextL(data)) |
|
3277 |
{ |
|
3278 |
const CLiwMap* res = data.AsMap(); |
|
3279 |
if ( res ) |
|
3280 |
{ |
|
3281 |
||
3282 |
TLiwVariant mid; |
|
3283 |
if(res->FindL(_L8("MessageId"), mid)) |
|
3284 |
{ |
|
3285 |
message_id = mid.AsTInt32(); |
|
3286 |
} |
|
3287 |
mid.Reset(); |
|
3288 |
} |
|
3289 |
else |
|
3290 |
result = KErrGeneral; |
|
3291 |
} |
|
3292 |
data.Reset(); |
|
3293 |
} |
|
3294 |
||
3295 |
if(!result && message_id) |
|
3296 |
{ |
|
3297 |
//Delete the message |
|
3298 |
inParam->Reset(); |
|
3299 |
outParam->Reset(); |
|
3300 |
inParam->AppendL(TLiwGenericParam( _L8("MessageId"), TLiwVariant( TInt32(message_id) ))); |
|
3301 |
||
3302 |
interface_msg->ExecuteCmdL( KMsgDelete ,*inParam ,*outParam,0,NULL ); |
|
3303 |
||
3304 |
index = 0; |
|
3305 |
const TLiwGenericParam* err_del = outParam->FindFirst(index,KErrCode); |
|
3306 |
result = err_del->Value().AsTInt32(); |
|
3307 |
} |
|
3308 |
}*/ |
|
3309 |
||
3310 |
inParam->Reset(); |
|
3311 |
outParam->Reset(); |
|
3312 |
||
3313 |
interface_msg->Close(); |
|
3314 |
||
3315 |
} |
|
3316 |
else |
|
3317 |
result = KErrGeneral; |
|
3318 |
||
3319 |
//Update to-Do status to completed |
|
3320 |
if(!result) |
|
3321 |
{ |
|
3322 |
||
3323 |
inParamList->Reset(); |
|
3324 |
outParamList->Reset(); |
|
3325 |
||
3326 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
3327 |
CleanupStack::PushL(map); |
|
3328 |
||
3329 |
map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); |
|
3330 |
||
3331 |
gid.Copy( arruids[1]->iGlobalUID->Des() ); |
|
3332 |
||
3333 |
TInt lid_fetch_err = GetLocalUid(inParamList,outParamList,interface,KTestCal1File,arruids[1]->iLocalUID) ; |
|
3334 |
if(lid_fetch_err) |
|
3335 |
{ |
|
3336 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
3337 |
interface->Close(); |
|
3338 |
iServiceHandler->Reset(); |
|
3339 |
delete iServiceHandler; |
|
3340 |
__UHEAP_MARKEND; |
|
3341 |
return lid_fetch_err; |
|
3342 |
} |
|
3343 |
||
3344 |
TBuf<10> localuid; |
|
3345 |
localuid.Num(TInt64(arruids[1]->iLocalUID)); |
|
3346 |
||
3347 |
map->InsertL(_L8("LocalId"),TLiwVariant(localuid)); |
|
3348 |
map->InsertL(_L8("Status"), TLiwVariant(_L("TodoCompleted"))); |
|
3349 |
||
3350 |
TLiwVariant content(_L("CalendarEntry")); |
|
3351 |
TLiwGenericParam element1; |
|
3352 |
element1.SetNameAndValueL(_L8("Type"),content); |
|
3353 |
inParamList->AppendL(element1); |
|
3354 |
content.Reset(); |
|
3355 |
element1.Reset(); |
|
3356 |
||
3357 |
TLiwVariant filterparam(map); |
|
3358 |
TLiwGenericParam element ; |
|
3359 |
element.SetNameAndValueL(_L8("Item"),filterparam); |
|
3360 |
filterparam.Reset(); |
|
3361 |
||
3362 |
inParamList->AppendL(element); |
|
3363 |
element.Reset(); |
|
3364 |
map->DecRef(); |
|
3365 |
CleanupStack::Pop(map); |
|
3366 |
||
3367 |
interface->ExecuteCmdL( KCmdAdd, *inParamList ,*outParamList ); |
|
3368 |
pos=0; |
|
3369 |
const TLiwGenericParam* update_err = outParamList->FindFirst(pos,KErrorCode); |
|
3370 |
if(update_err) |
|
3371 |
result = update_err->Value().AsTInt32(); |
|
3372 |
} |
|
3373 |
||
3374 |
inParamList->Reset(); |
|
3375 |
outParamList->Reset(); |
|
3376 |
arruids.ResetAndDestroy(); |
|
3377 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
3378 |
interface->Close(); |
|
3379 |
iServiceHandler->Reset(); |
|
3380 |
delete iServiceHandler; |
|
3381 |
||
3382 |
__UHEAP_MARKEND; |
|
3383 |
||
3384 |
return result; |
|
3385 |
||
3386 |
||
3387 |
} |
|
3388 |
||
3389 |
// ----------------------------------------------------------------------------- |
|
3390 |
// Ctcal_providertest::Calendar_ops17 |
|
3391 |
// Example test method function to send msg with path of cal file |
|
3392 |
// (other items were commented in a header). |
|
3393 |
// ----------------------------------------------------------------------------- |
|
3394 |
// |
|
3395 |
TInt Ctcal_providertest::Calendar_ops17( CStifItemParser& aItem ) |
|
3396 |
{ |
|
3397 |
TInt32 result=KErrNone; |
|
3398 |
TInt err; |
|
3399 |
TInt32 message_id =0; |
|
3400 |
||
3401 |
__UHEAP_MARK; |
|
3402 |
||
3403 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
3404 |
||
3405 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
3406 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
3407 |
||
3408 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
3409 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
3410 |
||
3411 |
RCriteriaArray a; |
|
3412 |
||
3413 |
a.AppendL(crit); |
|
3414 |
||
3415 |
iServiceHandler->AttachL(a); |
|
3416 |
||
3417 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
3418 |
||
3419 |
delete crit; |
|
3420 |
crit = NULL; |
|
3421 |
a.Reset(); |
|
3422 |
||
3423 |
TInt pos = 0; |
|
3424 |
MLiwInterface* interface = NULL; |
|
3425 |
outParamList->FindFirst(pos,KIDataSource ); |
|
3426 |
if(pos != KErrNotFound) |
|
3427 |
{ |
|
3428 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
3429 |
} |
|
3430 |
||
3431 |
inParamList->Reset(); |
|
3432 |
outParamList->Reset(); |
|
3433 |
||
3434 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
3435 |
||
3436 |
AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
3437 |
||
3438 |
||
3439 |
RPointerArray<TUIDSet> arruids(5); |
|
3440 |
||
3441 |
TUIDSet* uids = NULL; |
|
3442 |
||
3443 |
if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
3444 |
{ |
|
3445 |
arruids.Append(uids); |
|
3446 |
uids = NULL; |
|
3447 |
} |
|
3448 |
||
3449 |
if(AddProvToDo(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) |
|
3450 |
{ |
|
3451 |
arruids.Append(uids); |
|
3452 |
uids = NULL; |
|
3453 |
} |
|
3454 |
TInt count = arruids.Count(); |
|
3455 |
||
3456 |
||
3457 |
if ( arruids.Count() > 0 ) |
|
3458 |
{ |
|
3459 |
CLiwGenericParamList* inParam = &(iServiceHandler->InParamListL()); |
|
3460 |
CLiwGenericParamList* outParam = &(iServiceHandler->OutParamListL()); |
|
3461 |
CLiwCriteriaItem* crit_msg = CLiwCriteriaItem::NewL(1, KMsgIDataSource,KMsgService); |
|
3462 |
||
3463 |
crit_msg->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
3464 |
||
3465 |
RCriteriaArray a_msg; |
|
3466 |
a_msg.AppendL(crit_msg); |
|
3467 |
||
3468 |
iServiceHandler->AttachL(a_msg); |
|
3469 |
||
3470 |
iServiceHandler->ExecuteServiceCmdL(*crit_msg, *inParam, *outParam); |
|
3471 |
||
3472 |
TInt pos_msg = 0; |
|
3473 |
MLiwInterface* interface_msg = NULL; |
|
3474 |
||
3475 |
outParam->FindFirst(pos_msg,KMsgIDataSource); |
|
3476 |
if(pos_msg != KErrNotFound) |
|
3477 |
{ |
|
3478 |
interface_msg = (*outParam)[pos_msg].Value().AsInterface(); |
|
3479 |
} |
|
3480 |
||
3481 |
inParam->Reset(); |
|
3482 |
outParam->Reset(); |
|
3483 |
||
3484 |
delete crit_msg; |
|
3485 |
crit_msg = NULL; |
|
3486 |
a_msg.Reset(); |
|
3487 |
||
3488 |
// inParam->AppendL(TLiwGenericParam( _L8("MessageType"), TLiwVariant( _L("MMS") ))); |
|
3489 |
// inParam->AppendL(TLiwGenericParam( _L8("To"), TLiwVariant( _L("9740067386") ))); |
|
3490 |
// inParam->AppendL(TLiwGenericParam( _L8("Subject"), TLiwVariant( _L("Send attachment") ))); |
|
3491 |
// inParam->AppendL(TLiwGenericParam( _L8("Attachment"), TLiwVariant( _L("c\\private\\10003a5b\\getlistcal1") ))); |
|
3492 |
inParam->AppendL(TLiwGenericParam( _L8("MimeType"), TLiwVariant( _L("text/plain") ))); |
|
3493 |
||
3494 |
inParam->AppendL(TLiwGenericParam( _L8("MessageType"), TLiwVariant( _L("SMS") ))); |
|
3495 |
inParam->AppendL(TLiwGenericParam( _L8("To"), TLiwVariant( _L("9008032761") ))); |
|
3496 |
inParam->AppendL(TLiwGenericParam( _L8("BodyText"), TLiwVariant( _L("C\\private\\10003a5b\\getlistcal1") ))); |
|
3497 |
//inParam->AppendL(TLiwGenericParam( _L8("Subject"), TLiwVariant( _L("Test") ))); |
|
3498 |
//inParam->AppendL(TLiwGenericParam( _L8("Attachment"), TLiwVariant( _L("C\\private\\10003a5b\\getlistcal1") ))); |
|
3499 |
||
3500 |
interface_msg->ExecuteCmdL( KMsgSendCmd ,*inParam ,*outParam,0,NULL ); |
|
3501 |
||
3502 |
TInt index = 0; |
|
3503 |
const TLiwGenericParam* err2 = outParam->FindFirst(index,KErrCode); |
|
3504 |
result = err2->Value().AsTInt32(); |
|
3505 |
||
3506 |
// if(result == SErrBadArgumentType) |
|
3507 |
// result = KErrNone; |
|
3508 |
||
3509 |
/* if(!result) |
|
3510 |
{ |
|
3511 |
inParam->Reset(); |
|
3512 |
outParam->Reset(); |
|
3513 |
||
3514 |
TLiwVariant content(_L8("Inbox")); |
|
3515 |
TLiwGenericParam element1 ; |
|
3516 |
element1.SetNameAndValueL(_L8("Type"),_L("Inbox")); |
|
3517 |
inParam->AppendL(element1); |
|
3518 |
content.Reset(); |
|
3519 |
element1.Reset(); |
|
3520 |
CLiwDefaultMap* map1 = CLiwDefaultMap::NewL(); |
|
3521 |
CleanupStack::PushL(map1); |
|
3522 |
||
3523 |
CLiwDefaultList* mtmtypelist = CLiwDefaultList::NewL(); |
|
3524 |
CleanupStack::PushL(mtmtypelist); |
|
3525 |
||
3526 |
TLiwVariant mmsmtm(KMessageTypeSMS); |
|
3527 |
mtmtypelist->AppendL(mmsmtm); |
|
3528 |
mmsmtm.Reset(); |
|
3529 |
||
3530 |
TLiwVariant add1(mtmtypelist); |
|
3531 |
||
3532 |
map1->InsertL(_L8("MessageTypeList"), add1); // Mtmtype is added |
|
3533 |
mtmtypelist->DecRef(); |
|
3534 |
CleanupStack::Pop(mtmtypelist); |
|
3535 |
add1.Reset(); |
|
3536 |
||
3537 |
TLiwVariant filterparam1(map1); |
|
3538 |
TLiwGenericParam element2 ; |
|
3539 |
element2.SetNameAndValueL(_L8("Filter"),filterparam1); |
|
3540 |
filterparam1.Reset(); |
|
3541 |
||
3542 |
inParam->AppendL(element2); |
|
3543 |
element2.Reset(); |
|
3544 |
||
3545 |
map1->DecRef(); |
|
3546 |
CleanupStack::Pop(map1); |
|
3547 |
||
3548 |
interface_msg->ExecuteCmdL( KMsgGetListCmd ,*inParam ,*outParam); |
|
3549 |
index = 0 ; |
|
3550 |
const TLiwGenericParam* getlistmsg_err = outParam->FindFirst(index,KErrCode); |
|
3551 |
if(getlistmsg_err) |
|
3552 |
result = getlistmsg_err->Value().AsTInt32(); |
|
3553 |
index=0; |
|
3554 |
const TLiwGenericParam* output1 = outParam->FindFirst( index,_L8("ReturnValue")); |
|
3555 |
||
3556 |
if(!result && output1) |
|
3557 |
{ |
|
3558 |
TInt err = output1->Value().AsTInt32(); |
|
3559 |
CLiwIterable* iterlist2 = output1->Value().AsIterable(); |
|
3560 |
||
3561 |
TLiwVariant data; |
|
3562 |
||
3563 |
while( iterlist2->NextL(data)) |
|
3564 |
{ |
|
3565 |
const CLiwMap* res = data.AsMap(); |
|
3566 |
if ( res ) |
|
3567 |
{ |
|
3568 |
||
3569 |
TLiwVariant mid; |
|
3570 |
if(res->FindL(_L8("MessageId"), mid)) |
|
3571 |
{ |
|
3572 |
message_id = mid.AsTInt32(); |
|
3573 |
} |
|
3574 |
mid.Reset(); |
|
3575 |
} |
|
3576 |
else |
|
3577 |
result = KErrGeneral; |
|
3578 |
} |
|
3579 |
data.Reset(); |
|
3580 |
} |
|
3581 |
||
3582 |
if(!result && message_id) |
|
3583 |
{ |
|
3584 |
//Delete the message |
|
3585 |
inParam->Reset(); |
|
3586 |
outParam->Reset(); |
|
3587 |
inParam->AppendL(TLiwGenericParam( _L8("MessageId"), TLiwVariant( TInt32(message_id) ))); |
|
3588 |
||
3589 |
interface_msg->ExecuteCmdL( KMsgDelete ,*inParam ,*outParam,0,NULL ); |
|
3590 |
||
3591 |
index = 0; |
|
3592 |
const TLiwGenericParam* err_del = outParam->FindFirst(index,KErrCode); |
|
3593 |
result = err_del->Value().AsTInt32(); |
|
3594 |
} |
|
3595 |
}*/ |
|
3596 |
||
3597 |
inParam->Reset(); |
|
3598 |
outParam->Reset(); |
|
3599 |
||
3600 |
interface_msg->Close(); |
|
3601 |
||
3602 |
||
3603 |
} |
|
3604 |
else |
|
3605 |
result = KErrGeneral; |
|
3606 |
||
3607 |
||
3608 |
||
3609 |
inParamList->Reset(); |
|
3610 |
outParamList->Reset(); |
|
3611 |
arruids.ResetAndDestroy(); |
|
3612 |
RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); |
|
3613 |
interface->Close(); |
|
3614 |
iServiceHandler->Reset(); |
|
3615 |
delete iServiceHandler; |
|
3616 |
||
3617 |
__UHEAP_MARKEND; |
|
3618 |
||
3619 |
return result; |
|
3620 |
||
3621 |
} |
|
3622 |
||
3623 |
||
3624 |
TInt RemoveProvCalendar(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar) |
|
3625 |
{ |
|
3626 |
inparam->Reset(); |
|
3627 |
outparam->Reset(); |
|
3628 |
__UHEAP_MARK; |
|
3629 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
3630 |
CleanupStack::PushL(map); |
|
3631 |
||
3632 |
CLiwDefaultList* callist = CLiwDefaultList::NewL(); |
|
3633 |
CleanupStack::PushL(callist); |
|
3634 |
||
3635 |
TLiwVariant content(_L("Calendar")); |
|
3636 |
TLiwGenericParam element1; |
|
3637 |
element1.SetNameAndValueL(_L8("Type"),content); |
|
3638 |
inparam->AppendL(element1); |
|
3639 |
content.Reset(); |
|
3640 |
element1.Reset(); |
|
3641 |
||
3642 |
TLiwVariant smsmtm(aCalendar); |
|
3643 |
callist->AppendL(smsmtm); |
|
3644 |
smsmtm.Reset(); |
|
3645 |
||
3646 |
TLiwVariant add1(callist); |
|
3647 |
// map->InsertL(_L8("CalendarList"), add1); |
|
3648 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar) ); |
|
3649 |
callist->DecRef(); |
|
3650 |
CleanupStack::Pop(callist); |
|
3651 |
add1.Reset(); |
|
3652 |
||
3653 |
TLiwVariant filterparam(map); |
|
3654 |
TLiwGenericParam element ; |
|
3655 |
element.SetNameAndValueL(_L8("Data"),filterparam); |
|
3656 |
filterparam.Reset(); |
|
3657 |
||
3658 |
inparam->AppendL(element); |
|
3659 |
element.Reset(); |
|
3660 |
map->DecRef(); |
|
3661 |
CleanupStack::Pop(map); |
|
3662 |
||
3663 |
interface->ExecuteCmdL( KCmdDelete ,*inparam,*outparam ); |
|
3664 |
TInt pos = 0 ; |
|
3665 |
||
3666 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode")); |
|
3667 |
TInt32 err; |
|
3668 |
if(output) |
|
3669 |
{ |
|
3670 |
err = output->Value().AsTInt32(); |
|
3671 |
} |
|
3672 |
||
3673 |
inparam->Reset(); |
|
3674 |
outparam->Reset(); |
|
3675 |
__UHEAP_MARKEND; |
|
3676 |
||
3677 |
return err; |
|
3678 |
} |
|
3679 |
||
3680 |
TInt AddProvCalendar(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar) |
|
3681 |
{ |
|
3682 |
inparam->Reset(); |
|
3683 |
outparam->Reset(); |
|
3684 |
||
3685 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
3686 |
CleanupStack::PushL(map); |
|
3687 |
||
3688 |
TLiwVariant content(_L("Calendar")); |
|
3689 |
TLiwGenericParam element1; |
|
3690 |
element1.SetNameAndValueL(_L8("Type"),content); |
|
3691 |
inparam->AppendL(element1); |
|
3692 |
content.Reset(); |
|
3693 |
element1.Reset(); |
|
3694 |
||
3695 |
||
3696 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar) ); |
|
3697 |
||
3698 |
TLiwGenericParam element; |
|
3699 |
element.SetNameAndValueL(_L8("Item"),TLiwVariant(map)); |
|
3700 |
||
3701 |
inparam->AppendL(element); |
|
3702 |
element.Reset(); |
|
3703 |
map->DecRef(); |
|
3704 |
CleanupStack::Pop(map); |
|
3705 |
||
3706 |
interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam ); |
|
3707 |
TInt pos = 0 ; |
|
3708 |
||
3709 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode")); |
|
3710 |
TInt32 err; |
|
3711 |
if(output) |
|
3712 |
{ |
|
3713 |
err = output->Value().AsTInt32(); |
|
3714 |
} |
|
3715 |
||
3716 |
inparam->Reset(); |
|
3717 |
outparam->Reset(); |
|
3718 |
||
3719 |
return err; |
|
3720 |
}; |
|
3721 |
||
3722 |
||
3723 |
TInt AddProvAppointmentDailyRepeat(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset) |
|
3724 |
{ |
|
3725 |
inparam->Reset(); |
|
3726 |
outparam->Reset(); |
|
3727 |
TInt cells = User::CountAllocCells(); |
|
3728 |
||
3729 |
||
3730 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
3731 |
CleanupStack::PushL(map); |
|
3732 |
||
3733 |
TLiwVariant content(_L("CalendarEntry")); |
|
3734 |
TLiwGenericParam element1; |
|
3735 |
element1.SetNameAndValueL(_L8("Type"),content); |
|
3736 |
inparam->AppendL(element1); |
|
3737 |
content.Reset(); |
|
3738 |
element1.Reset(); |
|
3739 |
||
3740 |
||
3741 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar) ); |
|
3742 |
map->InsertL(_L8("Type"), TLiwVariant( _L("Meeting") )); |
|
3743 |
map->InsertL(_L8("StartTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,0,0,0)))); |
|
3744 |
map->InsertL(_L8("EndTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,30,0,0)))); |
|
3745 |
map->InsertL(_L8("Replication"), TLiwVariant(_L("Open"))); |
|
3746 |
map->InsertL(_L8("Description"), TLiwVariant(_L("Meeting"))); |
|
3747 |
map->InsertL(_L8("Status"), TLiwVariant(_L("Confirmed"))); |
|
3748 |
map->InsertL(_L8("Method"), TLiwVariant(_L("None"))); |
|
3749 |
||
3750 |
CLiwDefaultMap* repeatmap = CLiwDefaultMap::NewL(); |
|
3751 |
CleanupStack::PushL(repeatmap); |
|
3752 |
repeatmap->InsertL(_L8("Type"), TLiwVariant(TInt32(1))); |
|
3753 |
repeatmap->InsertL(_L8("StartDate"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,0,0,0)))); |
|
3754 |
repeatmap->InsertL(_L8("UntilDate"), TLiwVariant(TTime(TDateTime(2007,ENovember,0,10,0,0,0)))); |
|
3755 |
map->InsertL(_L8("RepeatRule"), TLiwVariant(repeatmap)); |
|
3756 |
CleanupStack::Pop(repeatmap); |
|
3757 |
repeatmap->DecRef(); |
|
3758 |
||
3759 |
||
3760 |
TLiwGenericParam element; |
|
3761 |
element.SetNameAndValueL(_L8("Item"),TLiwVariant(map)); |
|
3762 |
||
3763 |
inparam->AppendL(element); |
|
3764 |
element.Reset(); |
|
3765 |
map->DecRef(); |
|
3766 |
CleanupStack::Pop(map); |
|
3767 |
||
3768 |
cells = User::CountAllocCells(); |
|
3769 |
||
3770 |
||
3771 |
interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam ); |
|
3772 |
TInt pos = 0 ; |
|
3773 |
||
3774 |
cells = User::CountAllocCells(); |
|
3775 |
||
3776 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode")); |
|
3777 |
||
3778 |
cells = User::CountAllocCells(); |
|
3779 |
TInt32 err; |
|
3780 |
if(output) |
|
3781 |
{ |
|
3782 |
err = output->Value().AsTInt32(); |
|
3783 |
if ( err == KErrNone ) |
|
3784 |
{ |
|
3785 |
output = outparam->FindFirst( pos,_L8("ReturnValue")); |
|
3786 |
if(output) |
|
3787 |
{ |
|
3788 |
uidset = new (ELeave) TUIDSet; |
|
3789 |
TPtrC uidval = (TPtrC)(output->Value().AsDes()); |
|
3790 |
// GetLocalUid( uidval, uidset->iLocalUID ); |
|
3791 |
||
3792 |
uidset->iGlobalUID = HBufC8::NewL(uidval.Length()); |
|
3793 |
TPtr8 tmp = uidset->iGlobalUID->Des(); |
|
3794 |
// GetGlobalUid( uidval, tmp ); |
|
3795 |
tmp.Copy(uidval); |
|
3796 |
} |
|
3797 |
else |
|
3798 |
err = -1; |
|
3799 |
} |
|
3800 |
} |
|
3801 |
cells = User::CountAllocCells(); |
|
3802 |
inparam->Reset(); |
|
3803 |
outparam->Reset(); |
|
3804 |
cells = User::CountAllocCells(); |
|
3805 |
||
3806 |
||
3807 |
return err; |
|
3808 |
}; |
|
3809 |
||
3810 |
||
3811 |
//TInt GetLocalUid( CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar,const TDesC& type, TCalLocalUid& aOutLocalUid ) |
|
3812 |
TInt GetLocalUid( CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar,TCalLocalUid& aOutLocalUid ) |
|
3813 |
{ |
|
3814 |
TInt ret = 0; |
|
3815 |
TInt pos = 0; |
|
3816 |
aOutLocalUid = 0; |
|
3817 |
||
3818 |
inparam->Reset(); |
|
3819 |
outparam->Reset(); |
|
3820 |
||
3821 |
TLiwGenericParam dsNameParam(KContentType, TLiwVariant(_L("CalendarEntry"))); |
|
3822 |
inparam->AppendL(dsNameParam); |
|
3823 |
||
3824 |
CLiwDefaultMap* map1 = CLiwDefaultMap::NewL(); |
|
3825 |
CleanupStack::PushL(map1); |
|
3826 |
||
3827 |
map1->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar) ); |
|
3828 |
map1->InsertL(_L8("id"),TLiwVariant(gid)); |
|
3829 |
||
3830 |
TLiwVariant filterparam1(map1); |
|
3831 |
TLiwGenericParam element2 ; |
|
3832 |
element2.SetNameAndValueL(_L8("Filter"),filterparam1); |
|
3833 |
filterparam1.Reset(); |
|
3834 |
||
3835 |
inparam->AppendL(element2); |
|
3836 |
element2.Reset(); |
|
3837 |
||
3838 |
map1->DecRef(); |
|
3839 |
CleanupStack::Pop(map1); |
|
3840 |
||
3841 |
interface->ExecuteCmdL( KCmdGetList ,*inparam ,*outparam); |
|
3842 |
||
3843 |
const TLiwGenericParam* getlist_err = outparam->FindFirst(pos,KErrorCode); |
|
3844 |
if(getlist_err) |
|
3845 |
ret = getlist_err->Value().AsTInt32(); |
|
3846 |
pos=0; |
|
3847 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ReturnValue")); |
|
3848 |
TInt item_found = 0; |
|
3849 |
||
3850 |
if(!ret && output ) |
|
3851 |
{ |
|
3852 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
3853 |
TLiwVariant data; |
|
3854 |
while( iterlist->NextL(data)) |
|
3855 |
{ |
|
3856 |
const CLiwMap* res = data.AsMap(); |
|
3857 |
if ( res ) |
|
3858 |
{ |
|
3859 |
TLiwVariant new_data; |
|
3860 |
if(res->FindL(_L8("LocalId"), new_data)) |
|
3861 |
{ |
|
3862 |
TPtrC temp; |
|
3863 |
temp.Set(new_data.AsDes()); |
|
3864 |
TBuf<40> buf; |
|
3865 |
buf.Copy(temp); |
|
3866 |
// iLog->Log(_L("Local uid")); |
|
3867 |
// iLog->Log(buf); |
|
3868 |
TLex lex(temp); |
|
3869 |
TInt32 num; |
|
3870 |
if(lex.Val(num) == KErrNone) |
|
3871 |
aOutLocalUid = TCalLocalUid(num); |
|
3872 |
} |
|
3873 |
else |
|
3874 |
ret = KErrGeneral; |
|
3875 |
||
3876 |
new_data.Reset(); |
|
3877 |
} |
|
3878 |
} |
|
3879 |
data.Reset(); |
|
3880 |
} |
|
3881 |
||
3882 |
inparam->Reset(); |
|
3883 |
outparam->Reset(); |
|
3884 |
return ret; |
|
3885 |
} |
|
3886 |
||
3887 |
||
3888 |
void GetGlobalUid( const TDesC& aGlobalUid, TDes8& aOutGlobalUid ) |
|
3889 |
{ |
|
3890 |
if( aGlobalUid.Length() ) |
|
3891 |
{ |
|
3892 |
TInt sepPos = aGlobalUid.Locate( KUidSeparator ); |
|
3893 |
||
3894 |
if( sepPos == KErrNotFound ) |
|
3895 |
{ |
|
3896 |
aOutGlobalUid.Copy( aGlobalUid.Mid(0) ); |
|
3897 |
} |
|
3898 |
else |
|
3899 |
{ |
|
3900 |
aOutGlobalUid.Copy( aGlobalUid.Mid( sepPos + 1 ) ); |
|
3901 |
} |
|
3902 |
} |
|
3903 |
} |
|
3904 |
||
3905 |
||
3906 |
TInt AddAppointmentProvLocal(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset) |
|
3907 |
{ |
|
3908 |
||
3909 |
inparam->Reset(); |
|
3910 |
outparam->Reset(); |
|
3911 |
TInt cells = User::CountAllocCells(); |
|
3912 |
||
3913 |
||
3914 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
3915 |
CleanupStack::PushL(map); |
|
3916 |
||
3917 |
TLiwVariant content(_L("CalendarEntry")); |
|
3918 |
TLiwGenericParam element1; |
|
3919 |
element1.SetNameAndValueL(_L8("Type"),content); |
|
3920 |
inparam->AppendL(element1); |
|
3921 |
content.Reset(); |
|
3922 |
element1.Reset(); |
|
3923 |
||
3924 |
||
3925 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar) ); |
|
3926 |
map->InsertL(_L8("Type"), TLiwVariant( _L("Meeting") )); |
|
3927 |
map->InsertL(_L8("StartTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,0,0,0)))); |
|
3928 |
map->InsertL(_L8("EndTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,30,0,0)))); |
|
3929 |
map->InsertL(_L8("SeqNum"), TLiwVariant(1)); |
|
3930 |
map->InsertL(_L8("Replication"), TLiwVariant(_L("Open"))); |
|
3931 |
map->InsertL(_L8("Location"), TLiwVariant(_L("Hara Room"))); |
|
3932 |
map->InsertL(_L8("Summary"), TLiwVariant(_L("Meeting happen at 10"))); |
|
3933 |
map->InsertL(_L8("Description"), TLiwVariant(_L("Meeting"))); |
|
3934 |
map->InsertL(_L8("Status"), TLiwVariant(_L("Confirmed"))); |
|
3935 |
map->InsertL(_L8("Method"), TLiwVariant(_L("None"))); |
|
3936 |
||
3937 |
CLiwDefaultMap* repeatmap = CLiwDefaultMap::NewL(); |
|
3938 |
CleanupStack::PushL(repeatmap); |
|
3939 |
repeatmap->InsertL(_L8("Type"), TLiwVariant(TInt32(1))); |
|
3940 |
repeatmap->InsertL(_L8("StartDate"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,0,0,0)))); |
|
3941 |
repeatmap->InsertL(_L8("UntilDate"), TLiwVariant(TTime(TDateTime(2007,EOctober,30,10,0,0,0)))); |
|
3942 |
map->InsertL(_L8("RepeatRule"), TLiwVariant(repeatmap)); |
|
3943 |
CleanupStack::Pop(repeatmap); |
|
3944 |
repeatmap->DecRef(); |
|
3945 |
||
3946 |
||
3947 |
TLiwGenericParam element; |
|
3948 |
element.SetNameAndValueL(_L8("Item"),TLiwVariant(map)); |
|
3949 |
||
3950 |
inparam->AppendL(element); |
|
3951 |
element.Reset(); |
|
3952 |
map->DecRef(); |
|
3953 |
CleanupStack::Pop(map); |
|
3954 |
||
3955 |
cells = User::CountAllocCells(); |
|
3956 |
||
3957 |
//TInt err; |
|
3958 |
interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam ); |
|
3959 |
TInt pos = 0 ; |
|
3960 |
||
3961 |
cells = User::CountAllocCells(); |
|
3962 |
||
3963 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode")); |
|
3964 |
||
3965 |
cells = User::CountAllocCells(); |
|
3966 |
TInt32 err; |
|
3967 |
if(output) |
|
3968 |
{ |
|
3969 |
err = output->Value().AsTInt32(); |
|
3970 |
if ( err == KErrNone ) |
|
3971 |
{ |
|
3972 |
output = outparam->FindFirst( pos,_L8("ReturnValue")); |
|
3973 |
if(output) |
|
3974 |
{ |
|
3975 |
uidset = new (ELeave) TUIDSet; |
|
3976 |
TPtrC uidval = (TPtrC)(output->Value().AsDes()); |
|
3977 |
// GetLocalUid( uidval, uidset->iLocalUID ); |
|
3978 |
||
3979 |
uidset->iGlobalUID = HBufC8::NewL(uidval.Length()); |
|
3980 |
TPtr8 tmp = uidset->iGlobalUID->Des(); |
|
3981 |
// GetGlobalUid( uidval, tmp ); |
|
3982 |
tmp.Copy(uidval); |
|
3983 |
||
3984 |
} |
|
3985 |
else |
|
3986 |
err = -1; |
|
3987 |
} |
|
3988 |
} |
|
3989 |
cells = User::CountAllocCells(); |
|
3990 |
inparam->Reset(); |
|
3991 |
outparam->Reset(); |
|
3992 |
cells = User::CountAllocCells(); |
|
3993 |
||
3994 |
||
3995 |
return err; |
|
3996 |
} |
|
3997 |
||
3998 |
TInt AddProvToDo(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset) |
|
3999 |
{ |
|
4000 |
inparam->Reset(); |
|
4001 |
outparam->Reset(); |
|
4002 |
||
4003 |
TInt cells = User::CountAllocCells(); |
|
4004 |
||
4005 |
||
4006 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
4007 |
CleanupStack::PushL(map); |
|
4008 |
||
4009 |
TLiwVariant content(_L("CalendarEntry")); |
|
4010 |
TLiwGenericParam element1; |
|
4011 |
element1.SetNameAndValueL(_L8("Type"),content); |
|
4012 |
inparam->AppendL(element1); |
|
4013 |
content.Reset(); |
|
4014 |
element1.Reset(); |
|
4015 |
||
4016 |
||
4017 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar) ); |
|
4018 |
map->InsertL(_L8("Type"), TLiwVariant( _L("ToDo") )); |
|
4019 |
map->InsertL(_L8("EndTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,25,0,0,0,0)))); |
|
4020 |
map->InsertL(_L8("Replication"), TLiwVariant(_L("Private"))); |
|
4021 |
map->InsertL(_L8("Description"), TLiwVariant(_L("To do"))); |
|
4022 |
map->InsertL(_L8("Status"), TLiwVariant(_L("TodoNeedsAction"))); |
|
4023 |
||
4024 |
||
4025 |
TLiwGenericParam element; |
|
4026 |
element.SetNameAndValueL(_L8("Item"),TLiwVariant(map)); |
|
4027 |
||
4028 |
inparam->AppendL(element); |
|
4029 |
element.Reset(); |
|
4030 |
map->DecRef(); |
|
4031 |
CleanupStack::Pop(map); |
|
4032 |
||
4033 |
cells = User::CountAllocCells(); |
|
4034 |
||
4035 |
//TInt err; |
|
4036 |
interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam ); |
|
4037 |
TInt pos = 0 ; |
|
4038 |
||
4039 |
cells = User::CountAllocCells(); |
|
4040 |
||
4041 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode")); |
|
4042 |
||
4043 |
cells = User::CountAllocCells(); |
|
4044 |
TInt32 err; |
|
4045 |
if(output) |
|
4046 |
{ |
|
4047 |
err = output->Value().AsTInt32(); |
|
4048 |
if ( err == KErrNone ) |
|
4049 |
{ |
|
4050 |
output = outparam->FindFirst( pos,_L8("ReturnValue")); |
|
4051 |
if(output) |
|
4052 |
{ |
|
4053 |
uidset = new (ELeave) TUIDSet; |
|
4054 |
TPtrC uidval = (TPtrC)(output->Value().AsDes()); |
|
4055 |
//GetLocalUid( uidval, uidset->iLocalUID ); |
|
4056 |
||
4057 |
uidset->iGlobalUID = HBufC8::NewL(uidval.Length()); |
|
4058 |
TPtr8 tmp = uidset->iGlobalUID->Des(); |
|
4059 |
// GetGlobalUid( uidval, tmp ); |
|
4060 |
tmp.Copy(uidval); |
|
4061 |
||
4062 |
} |
|
4063 |
else |
|
4064 |
err = -1; |
|
4065 |
} |
|
4066 |
} |
|
4067 |
cells = User::CountAllocCells(); |
|
4068 |
inparam->Reset(); |
|
4069 |
outparam->Reset(); |
|
4070 |
cells = User::CountAllocCells(); |
|
4071 |
||
4072 |
||
4073 |
return err; |
|
4074 |
} |
|
4075 |
||
4076 |
||
4077 |
TInt AddProvEvent(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset) |
|
4078 |
{ |
|
4079 |
inparam->Reset(); |
|
4080 |
outparam->Reset(); |
|
4081 |
||
4082 |
TInt cells = User::CountAllocCells(); |
|
4083 |
||
4084 |
||
4085 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
4086 |
CleanupStack::PushL(map); |
|
4087 |
||
4088 |
TLiwVariant content(_L("CalendarEntry")); |
|
4089 |
TLiwGenericParam element1; |
|
4090 |
element1.SetNameAndValueL(_L8("Type"),content); |
|
4091 |
inparam->AppendL(element1); |
|
4092 |
content.Reset(); |
|
4093 |
element1.Reset(); |
|
4094 |
||
4095 |
||
4096 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar) ); |
|
4097 |
map->InsertL(_L8("Type"), TLiwVariant( _L("DayEvent") )); |
|
4098 |
map->InsertL(_L8("StartTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,24,0,0,0,0)))); |
|
4099 |
map->InsertL(_L8("Replication"), TLiwVariant(_L("Open"))); |
|
4100 |
map->InsertL(_L8("Description"), TLiwVariant(_L("Event"))); |
|
4101 |
//map->InsertL(_L8("Method"), TLiwVariant(_L("None"))); |
|
4102 |
||
4103 |
TLiwGenericParam element; |
|
4104 |
element.SetNameAndValueL(_L8("Item"),TLiwVariant(map)); |
|
4105 |
||
4106 |
inparam->AppendL(element); |
|
4107 |
element.Reset(); |
|
4108 |
map->DecRef(); |
|
4109 |
CleanupStack::Pop(map); |
|
4110 |
||
4111 |
cells = User::CountAllocCells(); |
|
4112 |
||
4113 |
//TInt err; |
|
4114 |
interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam ); |
|
4115 |
TInt pos = 0 ; |
|
4116 |
||
4117 |
cells = User::CountAllocCells(); |
|
4118 |
||
4119 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode")); |
|
4120 |
||
4121 |
cells = User::CountAllocCells(); |
|
4122 |
TInt32 err; |
|
4123 |
if(output) |
|
4124 |
{ |
|
4125 |
err = output->Value().AsTInt32(); |
|
4126 |
if ( err == KErrNone ) |
|
4127 |
{ |
|
4128 |
output = outparam->FindFirst( pos,_L8("ReturnValue")); |
|
4129 |
if(output) |
|
4130 |
{ |
|
4131 |
uidset = new (ELeave) TUIDSet; |
|
4132 |
TPtrC uidval = (TPtrC)(output->Value().AsDes()); |
|
4133 |
//GetLocalUid( uidval, uidset->iLocalUID ); |
|
4134 |
||
4135 |
uidset->iGlobalUID = HBufC8::NewL(uidval.Length()); |
|
4136 |
TPtr8 tmp = uidset->iGlobalUID->Des(); |
|
4137 |
// GetGlobalUid( uidval, tmp ); |
|
4138 |
tmp.Copy(uidval); |
|
4139 |
||
4140 |
} |
|
4141 |
else |
|
4142 |
err = -1; |
|
4143 |
} |
|
4144 |
} |
|
4145 |
cells = User::CountAllocCells(); |
|
4146 |
inparam->Reset(); |
|
4147 |
outparam->Reset(); |
|
4148 |
cells = User::CountAllocCells(); |
|
4149 |
||
4150 |
||
4151 |
return err; |
|
4152 |
}; |
|
4153 |