author | Pat Downey <patd@symbian.org> |
Wed, 01 Sep 2010 12:28:47 +0100 | |
branch | RCL_3 |
changeset 66 | a9c0808a1095 |
parent 65 | 0b68a1b0c15e |
permissions | -rw-r--r-- |
19 | 1 |
/* |
2 |
* Copyright (c) 2006-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 |
||
22 |
||
23 |
||
24 |
// INCLUDE FILES |
|
25 |
#include <e32svr.h> |
|
26 |
#include <StifParser.h> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
27 |
#include <StifTestInterface.h> |
19 | 28 |
|
29 |
#include <f32file.h> |
|
30 |
#include <e32des16.h> |
|
31 |
#include <e32base.h> |
|
32 |
||
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
33 |
#include <liwservicehandler.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
34 |
#include <liwcommon.h> |
19 | 35 |
|
36 |
#include "serviceerrno.h" |
|
37 |
||
38 |
#include "tcontactsprovider_sim.h" |
|
39 |
||
40 |
||
41 |
_LIT(KCntSimDbUri,"sim://global_adn"); |
|
42 |
||
43 |
// _LIT8(KFirstName,"FirstName"); |
|
44 |
_LIT(KName,"Arnold"); |
|
45 |
_LIT8(KNumber,"MobilePhoneGen"); |
|
46 |
_LIT(KPhoneNumber,"09918765432"); |
|
47 |
||
48 |
||
49 |
||
50 |
||
51 |
_LIT(KError,"Error code is"); |
|
52 |
_LIT(KSuccess,"Successful"); |
|
53 |
_LIT(KNewLine,"\n"); |
|
54 |
_LIT(KServiceOpen,"Service handle created"); |
|
55 |
_LIT(KServiceClose,"Service handle deleted"); |
|
56 |
||
57 |
_LIT(KGroup1,"Test1"); |
|
58 |
||
59 |
_LIT8( KIDataSource,"IDataSource" ); |
|
60 |
_LIT8( KExitCode, "ErrorCode" ); |
|
61 |
_LIT8( KService, "Service.Contact" ); |
|
62 |
||
63 |
//commands that can be performed on the contacts database. |
|
64 |
_LIT8( KCmdImport, "Import" ); |
|
65 |
_LIT8( KCmdExport, "Export" ); |
|
66 |
_LIT8( KCmdGetList, "GetList"); |
|
67 |
_LIT8( KCmdAdd, "Add" ); |
|
68 |
_LIT8( KCmdDelete, "Delete" ); |
|
69 |
_LIT8( KCmdOrganiseGroups, "Organise" ); |
|
70 |
||
71 |
// Constant for the appending Error code |
|
72 |
_LIT8( KErrorCode, "ErrorCode" ); |
|
73 |
||
74 |
// Constant for the appending TransactionID |
|
75 |
_LIT8( KTransactionID, "TransactionID" ); |
|
76 |
||
77 |
//Constant for appending Iterator |
|
78 |
_LIT8( KReturnValue, "ReturnValue"); |
|
79 |
||
80 |
_LIT8(KSourceFileNameParam, "SourceFile"); |
|
81 |
_LIT8(KDestFileNameParam, "DestinationFile"); |
|
82 |
_LIT8(KGroupId,"id"); |
|
83 |
||
84 |
||
85 |
_LIT8(KFieldLabel, "Label"); |
|
86 |
_LIT8(KFieldValue, " Value"); |
|
87 |
_LIT8(KFieldNext, "Next"); |
|
88 |
_LIT8(KGroupLabel, "GroupLabel"); |
|
89 |
_LIT8(KContents, "Contents"); |
|
90 |
_LIT8(KContactId, "id"); |
|
91 |
||
92 |
_LIT8(KList, "IdList"); |
|
93 |
_LIT8(KContact, "Contact"); |
|
94 |
_LIT8(KGroup, "Group"); |
|
95 |
_LIT8(KDatabase, "Database"); |
|
96 |
||
97 |
_LIT8(KDBUri, "DBUri"); |
|
98 |
_LIT8(KSearchVal, "SearchVal"); |
|
99 |
_LIT8(KType, "Type"); |
|
100 |
_LIT8(KFilter, "Filter"); |
|
101 |
_LIT8(KSort, "Sort"); |
|
102 |
_LIT8(KOrder, "Order"); |
|
103 |
_LIT8(KData, "Data"); |
|
104 |
_LIT8(KOperationType, "OperationType"); |
|
105 |
||
106 |
_LIT(KAssociate, "Associate"); |
|
107 |
_LIT(KDissociate, "Disassociate"); |
|
108 |
||
109 |
_LIT(KAscending, "Ascending"); |
|
110 |
_LIT(KDescending, "Descending"); |
|
111 |
||
112 |
//Field Keys |
|
113 |
_LIT8(KSync, "Sync"); |
|
114 |
_LIT8(KLastName, "LastName"); |
|
115 |
_LIT8(KLastNameReading, "LastNameReading"); |
|
116 |
_LIT8(KFirstName, "FirstName"); |
|
117 |
_LIT8(KFirstNameReading, "FirstNameReading"); |
|
118 |
_LIT8(KPrefix, "Prefix"); |
|
119 |
_LIT8(KSuffix, "Suffix"); |
|
120 |
_LIT8(KSecondName, "SecondName"); |
|
121 |
_LIT8(KLandPhoneHome, "LandPhoneHome"); |
|
122 |
_LIT8(KMobilePhoneHome, "MobilePhoneHome"); |
|
123 |
_LIT8(KVideoNumberHome, "VideoNumberHome"); |
|
124 |
_LIT8(KFaxNumberHome, "FaxNumberHome"); |
|
125 |
_LIT8(KVoipHome, "VoipHome"); |
|
126 |
_LIT8(KEmailHome, "EmailHome"); |
|
127 |
_LIT8(KURLHome, "URLHome"); |
|
128 |
_LIT8(KAddrLabelHome, "AddrLabelHome"); |
|
129 |
_LIT8(KAddrPOHome, "AddrPOHome"); |
|
130 |
_LIT8(KAddrEXTHome, "AddrEXTHome"); |
|
131 |
_LIT8(KAddrStreetHome, "AddrStreetHome"); |
|
132 |
_LIT8(KAddrLocalHome, "AddrLocalHome"); |
|
133 |
_LIT8(KAddrRegionHome, "AddrRegionHome"); |
|
134 |
_LIT8(KAddrPostCodeHome, "AddrPostCodeHome"); |
|
135 |
_LIT8(KAddrCountryHome, "AddrCountryHome"); |
|
136 |
_LIT8(KJobTitle, "JobTitle"); |
|
137 |
_LIT8(KCompanyName,"CompanyName"); |
|
138 |
_LIT8(KLandPhoneWork, "LandPhoneWork"); |
|
139 |
_LIT8(KMobilePhoneWork, "MobilePhoneWork"); |
|
140 |
_LIT8(KVideoNumberWork, "VideoNumberWork"); |
|
141 |
_LIT8(KFaxNumberWork, "FaxNumberWork"); |
|
142 |
_LIT8(KVoipWork, "VoipWork"); |
|
143 |
_LIT8(KEmailWork, "EmailWork"); |
|
144 |
_LIT8(KURLWork, "URLWork"); |
|
145 |
_LIT8(KAddrLabelWork, "AddrLabelWork"); |
|
146 |
_LIT8(KAddrPOWork, "AddrPOWork"); |
|
147 |
_LIT8(KAddrEXTWork, "AddrEXTWork"); |
|
148 |
_LIT8(KAddrStreetWork, "AddrStreetWork"); |
|
149 |
_LIT8(KAddrLocalWork, "AddrLocalWork"); |
|
150 |
_LIT8(KAddrRegionWork, "AddrRegionWork"); |
|
151 |
_LIT8(KAddrPostCodeWork, "AddrPostCodeWork"); |
|
152 |
_LIT8(KAddrCountryWork, "AddrCountryWork"); |
|
153 |
_LIT8(KLandPhoneGen, "LandPhoneGen"); |
|
154 |
_LIT8(KMobilePhoneGen, "MobilePhoneGen"); |
|
155 |
_LIT8(KVideoNumberGen, "VideoNumberGen"); |
|
156 |
_LIT8(KFaxNumberGen, "FaxNumberGen"); |
|
157 |
_LIT8(KVOIPGen, "VOIPGen"); |
|
158 |
_LIT8(KPOC, "POC"); |
|
159 |
_LIT8(KSWIS, "SWIS"); |
|
160 |
_LIT8(KSIP, "SIP"); |
|
161 |
_LIT8(KEmailGen, "EmailGen"); |
|
162 |
_LIT8(KURLGen, "URLGen"); |
|
163 |
_LIT8(KAddrLabelGen, "AddrLabelGen"); |
|
164 |
_LIT8(KAddrPOGen, "AddrPOGen"); |
|
165 |
_LIT8(KAddrExtGen, "AddrExtGen"); |
|
166 |
_LIT8(KAddrStreetGen, "AddrStreetGen"); |
|
167 |
_LIT8(KAddrLocalGen, "AddrLocalGen"); |
|
168 |
_LIT8(KAddrRegionGen, "AddrRegionGen"); |
|
169 |
_LIT8(KAddrPostCodeGen, "AddrPostCodeGen"); |
|
170 |
_LIT8(KAddrCountryGen, "AddrCountryGen"); |
|
171 |
_LIT8(KPageNumber, "PageNumber"); |
|
172 |
_LIT8(KDTMFString, "DTMFString"); |
|
173 |
_LIT8(KWVAddress, "WVAddress"); |
|
174 |
_LIT8(KDate, "Date"); |
|
175 |
_LIT8(KNote, "Note"); |
|
176 |
_LIT8(KThumbNailPic, "ThumbNailPic"); |
|
177 |
_LIT8(KRingtone, "Ringtone"); |
|
178 |
_LIT8(KCallerObjImg, "CallerObjImg"); |
|
179 |
_LIT8(KCallerObjText, "CallerObjText"); |
|
180 |
_LIT8(KMiddleName, "MiddleName"); |
|
181 |
_LIT8(KDepartment, "Department"); |
|
182 |
_LIT8(KAsstName, "AsstName"); |
|
183 |
_LIT8(KSpouse, "Spouse"); |
|
184 |
_LIT8(KChildren, "Children"); |
|
185 |
_LIT8(KAsstPhone, "AsstPhone"); |
|
186 |
_LIT8(KCarPhone, "CarPhone"); |
|
187 |
_LIT8(KAnniversary, "Anniversary"); |
|
188 |
_LIT8(KSyncClass, "SyncClass"); |
|
189 |
_LIT8(KLOCPrivacy, "LOCPrivacy"); |
|
190 |
_LIT8(KGenLabel, "GenLabel"); |
|
191 |
||
192 |
||
193 |
||
194 |
||
195 |
void CContactsUT::Delete() |
|
196 |
{ |
|
197 |
iIface->Close(); |
|
198 |
iCriteriaArray.Close(); |
|
199 |
delete iServiceHandler; |
|
200 |
delete iInparams; |
|
201 |
delete iOutparams; |
|
202 |
delete iCriteria; |
|
203 |
delete inList; |
|
204 |
delete outList; |
|
205 |
delete iCntID; |
|
206 |
} |
|
207 |
||
208 |
||
209 |
||
210 |
||
211 |
void CContactsUT::LoadService() |
|
212 |
{ |
|
213 |
TInt pos = 0; |
|
214 |
//iCntID = HBufC::NewL(255); |
|
215 |
inList = CLiwGenericParamList::NewL(); |
|
216 |
outList = CLiwGenericParamList::NewL(); |
|
217 |
||
218 |
iServiceHandler = CLiwServiceHandler::NewL(); |
|
219 |
||
220 |
iInparams = &(iServiceHandler->InParamListL()); |
|
221 |
iOutparams = &(iServiceHandler->OutParamListL()); |
|
222 |
||
223 |
iCriteria = CLiwCriteriaItem::NewL( 1, KIDataSource, KService ); |
|
224 |
iCriteria->SetServiceClass(TUid::Uid( KLiwClassBase )); |
|
225 |
||
226 |
iCriteriaArray.AppendL( iCriteria ); |
|
227 |
iServiceHandler->AttachL( iCriteriaArray ); |
|
228 |
||
229 |
iServiceHandler->ExecuteServiceCmdL( *iCriteria, *iInparams, *iOutparams ); |
|
230 |
||
231 |
iOutparams->FindFirst( pos, KIDataSource ); |
|
232 |
if(pos != KErrNotFound) |
|
233 |
{ |
|
234 |
//LogMessage(_L8("Service Loaded\n")); |
|
235 |
iIface = ( *iOutparams )[pos].Value().AsInterface(); |
|
236 |
} |
|
237 |
else |
|
238 |
{ |
|
239 |
//LogMessage(_L8("Service Not found\n")); |
|
240 |
} |
|
241 |
if( iInparams ) |
|
242 |
{ |
|
243 |
iInparams->Reset(); |
|
244 |
iInparams = NULL; |
|
245 |
} |
|
246 |
if( iOutparams ) |
|
247 |
{ |
|
248 |
iOutparams->Reset(); |
|
249 |
iOutparams = NULL; } |
|
250 |
if( iCriteria ) |
|
251 |
{ |
|
252 |
delete iCriteria; |
|
253 |
iCriteria = NULL; |
|
254 |
} |
|
255 |
} |
|
256 |
||
257 |
||
258 |
||
259 |
TInt CContactsUT::HandleNotifyL(TInt aCmdId,TInt aEventId,CLiwGenericParamList& aEventParamList, |
|
260 |
const CLiwGenericParamList& aInParamList) |
|
261 |
||
262 |
{ |
|
263 |
RFs fs; |
|
264 |
RFile file; |
|
265 |
User::LeaveIfError(fs.Connect()); |
|
266 |
CleanupClosePushL(fs); |
|
267 |
TInt errfile =file.Replace(fs,_L("C:\\tcontacts_simlog2.txt"), EFileWrite | EFileStreamText); |
|
268 |
file.Write(_L8("\n Starting logs")); |
|
269 |
file.Flush(); |
|
270 |
CActiveScheduler::Stop(); |
|
271 |
||
272 |
TInt pos = 0; |
|
273 |
const TLiwGenericParam* param; |
|
274 |
||
275 |
param = aEventParamList.FindFirst( pos, KExitCode ); |
|
276 |
||
277 |
TLiwVariant err = param->Value(); |
|
278 |
||
279 |
TInt code = err.AsTInt32(); |
|
280 |
TBuf8<225> error; |
|
281 |
error.Num(code); |
|
282 |
file.Write(error); |
|
283 |
file.Flush(); |
|
284 |
error.Zero(); |
|
285 |
||
286 |
iErr = KErrGeneral; |
|
287 |
||
288 |
if((iCase == EGetList || iCase == ESearch || iCase == EDeleteContact || iCase ==EExport) && (code ==SErrNone)) |
|
289 |
{ |
|
290 |
||
291 |
param = aEventParamList.FindFirst(pos, KReturnValue); |
|
292 |
||
293 |
TBool tResult = EFalse; |
|
294 |
||
295 |
TBool findResult = EFalse; |
|
296 |
TLiwVariant err = param->Value(); |
|
297 |
TLiwVariant cntId; |
|
298 |
TLiwVariant mapfield; |
|
299 |
TLiwVariant firstname; |
|
300 |
TBuf<255> firstName; |
|
301 |
TLiwVariant entry; |
|
302 |
const CLiwMap* map = NULL; |
|
303 |
const CLiwMap* mapField = NULL; |
|
304 |
||
305 |
TLiwVariant iterator = param->Value(); |
|
306 |
CLiwIterable* iter = iterator.AsIterable(); |
|
307 |
TBuf8<255> buf; |
|
308 |
||
309 |
while(iter->NextL(entry)) |
|
310 |
{ |
|
311 |
file.Write(_L8("\n iterator nextl called")); |
|
312 |
file.Flush(); |
|
313 |
map = entry.AsMap(); |
|
314 |
TInt count1 = map->Count(); |
|
315 |
map->FindL(KContactId, cntId); |
|
316 |
TPtrC ptr = cntId.AsDes(); |
|
317 |
||
318 |
file.Write(_L8("Count1 ")); |
|
319 |
buf.Num(count1); |
|
320 |
file.Write(buf); |
|
321 |
file.Flush(); |
|
322 |
buf.Zero(); |
|
323 |
// count log |
|
324 |
if(iCase == EDeleteContact || iCase ==EExport ) |
|
325 |
{ |
|
326 |
iCntID = ptr.AllocL(); |
|
327 |
||
328 |
file.Write(_L8("Contactid is assinged as ")); |
|
329 |
buf.Copy(*iCntID); |
|
330 |
file.Write(buf); |
|
331 |
file.Flush(); |
|
332 |
||
333 |
break; |
|
334 |
} |
|
335 |
||
336 |
file.Write(_L8("\n contact id")); |
|
337 |
file.Flush(); |
|
338 |
if(map->FindL(KLastName,mapfield)) |
|
339 |
mapField = mapfield.AsMap(); |
|
340 |
||
341 |
TInt count = mapField->Count(); |
|
342 |
||
343 |
file.Write(_L8("Count2 ")); |
|
344 |
buf.Num(count1); |
|
345 |
file.Write(buf); |
|
346 |
file.Flush(); |
|
347 |
buf.Zero(); |
|
348 |
||
349 |
mapField->FindL(KFieldValue,firstname); |
|
350 |
firstName = firstname.AsDes(); |
|
351 |
buf.Copy(firstName); |
|
352 |
file.Write(buf); |
|
353 |
file.Flush(); |
|
354 |
buf.Zero(); |
|
355 |
if(iCase == EGetList) |
|
356 |
{ |
|
357 |
if(firstName.CompareF(_L("Arnold")) == 0) |
|
358 |
{ |
|
359 |
tResult = ETrue; |
|
360 |
} |
|
361 |
||
362 |
} |
|
363 |
||
364 |
if(iCase == ESearch) |
|
365 |
{ |
|
366 |
if(firstName.CompareF(_L("Monica Bellucc")) == 0) |
|
367 |
{ |
|
368 |
tResult = ETrue; |
|
369 |
} |
|
370 |
||
371 |
} |
|
372 |
mapfield.Reset(); |
|
373 |
firstname.Reset(); |
|
374 |
entry.Reset(); |
|
375 |
} |
|
376 |
||
377 |
if(tResult) |
|
378 |
{ |
|
379 |
iErr = KErrNone; |
|
380 |
} |
|
381 |
||
382 |
iterator.Reset(); |
|
383 |
delete iter; |
|
384 |
||
385 |
||
386 |
file.Write(_L8("iterator deleted\n")); |
|
387 |
file.Flush(); |
|
388 |
||
389 |
||
390 |
||
391 |
||
392 |
} |
|
393 |
||
394 |
||
395 |
if( iCase == EExportChk || iCase == EImport || iCase == EDeleteCkh || iCase == EAddContact ) |
|
396 |
{ |
|
397 |
if(aEventId == KLiwEventCompleted && code == KErrNone ) |
|
398 |
{ |
|
399 |
iErr = KErrNone; |
|
400 |
} |
|
401 |
else |
|
402 |
{ |
|
403 |
iErr = code; |
|
404 |
} |
|
405 |
error.Num(iErr); |
|
406 |
file.Write(_L8("Error for import : ")); |
|
407 |
file.Write(error); |
|
408 |
file.Flush(); |
|
409 |
error.Zero(); |
|
410 |
||
411 |
} |
|
412 |
||
413 |
||
414 |
||
415 |
||
416 |
file.Write(_L8("\n Last statement")); |
|
417 |
file.Flush(); |
|
418 |
file.Close(); |
|
419 |
CleanupStack::PopAndDestroy(); |
|
66 | 420 |
return 0; |
19 | 421 |
} |
422 |
||
423 |
||
424 |
||
425 |
||
426 |
||
427 |
||
428 |
||
429 |
||
430 |
||
431 |
||
432 |
||
433 |
||
434 |
||
435 |
||
436 |
||
437 |
||
438 |
||
439 |
||
440 |
||
441 |
||
442 |
// ============================ MEMBER FUNCTIONS =============================== |
|
443 |
||
444 |
||
445 |
// ----------------------------------------------------------------------------- |
|
446 |
// Csapi_getheader:RunMethodL |
|
447 |
// Run specified method. Contains also table of test mothods and their names. |
|
448 |
// ----------------------------------------------------------------------------- |
|
449 |
// |
|
450 |
TInt CContactsUT::RunMethodL( |
|
451 |
CStifItemParser& aItem ) |
|
452 |
{ |
|
453 |
||
454 |
static TStifFunctionInfo const KFunctions[] = |
|
455 |
{ |
|
456 |
ENTRY( "addcontact", CContactsUT::addcontactL ), |
|
457 |
ENTRY( "getlisttest", CContactsUT::getlisttestL ), |
|
458 |
ENTRY( "getlisttest_search", CContactsUT::getlisttest_searchL ), |
|
459 |
ENTRY( "deletetest" , CContactsUT::deletetestL ), |
|
460 |
ENTRY( "importtest" , CContactsUT::importL ), |
|
461 |
ENTRY( "exporttest" , CContactsUT::exportL ), |
|
462 |
||
463 |
}; |
|
464 |
||
465 |
const TInt count = sizeof( KFunctions ) / |
|
466 |
sizeof( TStifFunctionInfo ); |
|
467 |
||
468 |
return RunInternalL( KFunctions, count, aItem ); |
|
469 |
||
470 |
} |
|
471 |
// ----------------------------------------------------------------------------- |
|
472 |
// CContactsUT:addcontactL |
|
473 |
// Example test method function. |
|
474 |
// (other items were commented in a header). |
|
475 |
// ----------------------------------------------------------------------------- |
|
476 |
// |
|
477 |
TInt CContactsUT::addcontactL( CStifItemParser& aItem ) |
|
478 |
{ |
|
479 |
||
480 |
iErr = KErrGeneral; |
|
481 |
iCase = EAddContact; |
|
482 |
LoadService(); |
|
483 |
||
484 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL(); |
|
485 |
||
486 |
CLiwDefaultMap* fieldMap = CLiwDefaultMap::NewL(); |
|
487 |
TInt pos = 0; |
|
488 |
fieldMap->InsertL(KFieldLabel,TLiwVariant(_L("Mobile"))); |
|
489 |
||
490 |
fieldMap->InsertL(KFieldValue,TLiwVariant(_L("9980161669"))); |
|
491 |
pMap->InsertL(KDBUri, TLiwVariant( _L("sim://global_adn"))); |
|
492 |
||
493 |
||
494 |
pMap->InsertL(KContactId, TLiwVariant( _L(""))); |
|
495 |
pMap->InsertL(KMobilePhoneGen, TLiwVariant(fieldMap)); // doubt here |
|
496 |
||
497 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact"))); |
|
498 |
const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); ; |
|
499 |
||
500 |
inList ->AppendL( paramContentType ); |
|
501 |
inList ->AppendL( paramAddData ); |
|
502 |
||
503 |
||
504 |
iIface->ExecuteCmdL(KCmdAdd, *inList, *outList, KLiwOptASyncronous, this); |
|
505 |
||
506 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); |
|
507 |
TLiwVariant err = param->Value(); |
|
508 |
TInt code = err.AsTInt32(); |
|
509 |
||
510 |
if(code == SErrNone) |
|
511 |
{ |
|
512 |
CActiveScheduler::Start(); |
|
513 |
} |
|
514 |
||
515 |
fieldMap->DecRef(); |
|
516 |
fieldMap->DecRef(); |
|
517 |
pMap->DecRef(); |
|
518 |
||
519 |
inList->Reset(); |
|
520 |
outList->Reset(); |
|
521 |
||
522 |
return iErr; |
|
523 |
||
524 |
||
525 |
} |
|
526 |
||
527 |
// ----------------------------------------------------------------------------- |
|
528 |
// CContactsUT:getlisttestL |
|
529 |
// Example test method function. |
|
530 |
// (other items were commented in a header). |
|
531 |
// ----------------------------------------------------------------------------- |
|
532 |
// |
|
533 |
TInt CContactsUT::getlisttestL( CStifItemParser& aItem ) |
|
534 |
{ |
|
535 |
||
536 |
||
537 |
RFs fs; |
|
538 |
RFile file; |
|
539 |
User::LeaveIfError(fs.Connect()); |
|
540 |
CleanupClosePushL(fs); |
|
541 |
||
542 |
TInt errfile =file.Replace(fs,_L("C:\\tcontacts_simlog.txt"), EFileWrite | EFileStreamText); |
|
543 |
file.Write(_L8("\n Starting logs")); |
|
544 |
file.Flush(); |
|
545 |
||
546 |
LoadService(); |
|
547 |
iErr = KErrNone; |
|
548 |
file.Write(_L8("\n Loaded service")); |
|
549 |
file.Flush(); |
|
550 |
||
551 |
// For Automation |
|
552 |
||
553 |
||
554 |
||
555 |
iCase = EImport; |
|
556 |
||
557 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL(); |
|
558 |
||
559 |
TInt pos = 0; |
|
560 |
||
561 |
pMap->InsertL(KDBUri, TLiwVariant( _L("sim://global_adn"))); |
|
562 |
||
563 |
pMap->InsertL(KSourceFileNameParam, TLiwVariant( _L("c:\\data\\Import.vcf"))); |
|
564 |
||
565 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact"))); |
|
566 |
const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); |
|
567 |
||
568 |
inList ->AppendL( paramContentType ); |
|
569 |
inList ->AppendL( paramAddData ); |
|
570 |
||
571 |
iIface->ExecuteCmdL(KCmdImport, *inList, *outList, KLiwOptASyncronous, this); |
|
572 |
||
573 |
file.Write(_L8("\n Import is called for autoamtion")); |
|
574 |
file.Flush(); |
|
575 |
||
576 |
||
577 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); |
|
578 |
TLiwVariant err = param->Value(); |
|
579 |
TInt code = err.AsTInt32(); |
|
580 |
TBuf8<20> errbuf; |
|
581 |
errbuf.Num(code); |
|
582 |
file.Write(_L8("\n Error for import ")); |
|
583 |
file.Write(errbuf); |
|
584 |
file.Flush(); |
|
585 |
errbuf.Zero(); |
|
586 |
||
587 |
if(code == SErrNone) |
|
588 |
{ |
|
589 |
CActiveScheduler::Start(); |
|
590 |
} |
|
591 |
errbuf.Num(iErr); |
|
592 |
file.Write(_L8("\n Error from callback for import ")); |
|
593 |
file.Write(errbuf); |
|
594 |
file.Flush(); |
|
595 |
errbuf.Zero(); |
|
596 |
||
597 |
||
598 |
inList->Reset(); |
|
599 |
outList->Reset(); |
|
600 |
pMap->DecRef(); |
|
601 |
||
602 |
||
603 |
if(iErr ==KErrNone) |
|
604 |
{ |
|
605 |
// Test case of getlist started |
|
606 |
iCase = EGetList; |
|
607 |
||
608 |
pos = 0; |
|
609 |
||
610 |
const TLiwGenericParam paramContentType1(KType, TLiwVariant( _L("Contact"))); |
|
611 |
||
612 |
inList->AppendL( paramContentType1 ); |
|
613 |
||
614 |
CLiwDefaultMap* map = CLiwDefaultMap :: NewL(); |
|
615 |
CleanupStack::PushL(map); |
|
616 |
map->InsertL(KDBUri, TLiwVariant(_L("sim://global_adn"))); |
|
617 |
||
618 |
const TLiwGenericParam paramDeleteData(KFilter, TLiwVariant(map)); |
|
619 |
inList ->AppendL( paramDeleteData ); |
|
620 |
||
621 |
||
622 |
iIface->ExecuteCmdL(KCmdGetList, *inList, *outList, KLiwOptASyncronous, this); |
|
623 |
||
624 |
const TLiwGenericParam* param1 = outList->FindFirst( pos, KExitCode ); |
|
625 |
||
626 |
TLiwVariant err1 = param1->Value(); |
|
627 |
TInt code1 = err1.AsTInt32(); |
|
628 |
TBuf8<225> error; |
|
629 |
error.Num(code1); |
|
630 |
file.Write(error); |
|
631 |
file.Flush(); |
|
632 |
if(code == SErrNone) |
|
633 |
{ |
|
634 |
CActiveScheduler::Start(); |
|
635 |
} |
|
636 |
err.Reset(); |
|
637 |
CleanupStack::Pop(map); |
|
638 |
map->DecRef(); |
|
639 |
||
640 |
inList->Reset(); |
|
641 |
outList->Reset(); |
|
642 |
error.Zero(); |
|
643 |
error.Num(iErr); |
|
644 |
file.Write(error); |
|
645 |
file.Flush(); |
|
646 |
} |
|
647 |
file.Close(); |
|
648 |
CleanupStack::PopAndDestroy(); |
|
649 |
||
650 |
return iErr; |
|
651 |
||
652 |
||
653 |
} |
|
654 |
||
655 |
// ----------------------------------------------------------------------------- |
|
656 |
// CContactsUT:getlisttest_searchL |
|
657 |
// Example test method function. |
|
658 |
// (other items were commented in a header). |
|
659 |
// ----------------------------------------------------------------------------- |
|
660 |
// |
|
661 |
||
662 |
TInt CContactsUT::getlisttest_searchL(CStifItemParser& aItem) |
|
663 |
{ |
|
664 |
// __UHEAP_MARK; |
|
665 |
||
666 |
RFs fs; |
|
667 |
RFile file; |
|
668 |
User::LeaveIfError(fs.Connect()); |
|
669 |
CleanupClosePushL(fs); |
|
670 |
||
671 |
TInt errfile =file.Replace(fs,_L("C:\\tcontacts_search.txt"), EFileWrite | EFileStreamText); |
|
672 |
file.Write(_L8("\n Starting logs")); |
|
673 |
file.Flush(); |
|
674 |
||
675 |
||
676 |
||
677 |
_LIT8(KFilter, "Filter"); |
|
678 |
_LIT8(KSearchVal, "SearchVal"); |
|
679 |
||
680 |
//_LIT8(KKeys, "Keys"); |
|
681 |
iErr = KErrGeneral; |
|
682 |
LoadService(); |
|
683 |
||
684 |
||
685 |
file.Write(_L8("\n Load Service Called")); |
|
686 |
file.Flush(); |
|
687 |
||
688 |
||
689 |
||
690 |
||
691 |
||
692 |
iCase = EImport; |
|
693 |
||
694 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL(); |
|
695 |
||
696 |
TInt pos = 0; |
|
697 |
||
698 |
pMap->InsertL(KDBUri, TLiwVariant( _L("sim://global_adn"))); |
|
699 |
||
700 |
pMap->InsertL(KSourceFileNameParam, TLiwVariant( _L("c:\\data\\Import1.vcf"))); |
|
701 |
||
702 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact"))); |
|
703 |
const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); |
|
704 |
||
705 |
inList ->AppendL( paramContentType ); |
|
706 |
inList ->AppendL( paramAddData ); |
|
707 |
||
708 |
iIface->ExecuteCmdL(KCmdImport, *inList, *outList, KLiwOptASyncronous, this); |
|
709 |
||
710 |
file.Write(_L8("\n Import is called for autoamtion")); |
|
711 |
file.Flush(); |
|
712 |
||
713 |
||
714 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); |
|
715 |
TLiwVariant err = param->Value(); |
|
716 |
TInt code = err.AsTInt32(); |
|
717 |
TBuf8<20> errbuf; |
|
718 |
errbuf.Num(code); |
|
719 |
file.Write(_L8("\n Error for import ")); |
|
720 |
file.Write(errbuf); |
|
721 |
file.Flush(); |
|
722 |
errbuf.Zero(); |
|
723 |
||
724 |
if(code == SErrNone) |
|
725 |
{ |
|
726 |
CActiveScheduler::Start(); |
|
727 |
} |
|
728 |
errbuf.Num(iErr); |
|
729 |
file.Write(_L8("\n Error from callback for import ")); |
|
730 |
file.Write(errbuf); |
|
731 |
file.Flush(); |
|
732 |
errbuf.Zero(); |
|
733 |
||
734 |
||
735 |
inList->Reset(); |
|
736 |
outList->Reset(); |
|
737 |
pMap->DecRef(); |
|
738 |
||
739 |
||
740 |
||
741 |
if(iErr == KErrNone) |
|
742 |
{ |
|
743 |
pos = 0; |
|
744 |
iCase = ESearch; |
|
745 |
||
746 |
||
747 |
const TLiwGenericParam paramContentType1(KType, TLiwVariant( _L("Contact"))); |
|
748 |
inList ->AppendL( paramContentType1 ); |
|
749 |
||
750 |
CLiwDefaultMap* map = CLiwDefaultMap :: NewL(); |
|
751 |
CleanupStack::PushL(map); |
|
752 |
map->InsertL(KSearchVal,TLiwVariant(_L("M"))); |
|
753 |
// map->InsertL(KKeys,TLiwVariant(KLastName)); |
|
754 |
map->InsertL(KDBUri, TLiwVariant(_L("sim://global_adn"))); |
|
755 |
||
756 |
const TLiwGenericParam paramData(KFilter, TLiwVariant(map)); |
|
757 |
inList ->AppendL( paramData ); |
|
758 |
||
759 |
||
760 |
||
761 |
||
762 |
iIface->ExecuteCmdL(KCmdGetList, *inList, *outList, KLiwOptASyncronous, this); |
|
763 |
||
764 |
file.Write(_L8("\n Executecmd is called")); |
|
765 |
file.Flush(); |
|
766 |
||
767 |
||
768 |
const TLiwGenericParam* param1 = outList->FindFirst( pos, KExitCode ); |
|
769 |
err.Reset(); |
|
770 |
err = param1->Value(); |
|
771 |
TInt code1 = err.AsTInt32(); |
|
772 |
||
773 |
TBuf8<50> buf; |
|
774 |
buf.Num(code1); |
|
775 |
file.Write(_L8("\n Error1 : ")); |
|
776 |
file.Write(buf); |
|
777 |
file.Flush(); |
|
778 |
buf.Zero(); |
|
779 |
||
780 |
if(code1 == SErrNone) |
|
781 |
{ |
|
782 |
CActiveScheduler::Start(); |
|
783 |
} |
|
784 |
||
785 |
||
786 |
||
787 |
CleanupStack::Pop(map); |
|
788 |
map->DecRef(); |
|
789 |
inList->Reset(); |
|
790 |
outList->Reset(); |
|
791 |
||
792 |
buf.Num(iErr); |
|
793 |
file.Write(_L8("\n Error2 : ")); |
|
794 |
file.Write(buf); |
|
795 |
file.Flush(); |
|
796 |
buf.Zero(); |
|
797 |
} |
|
798 |
file.Close(); |
|
799 |
CleanupStack::PopAndDestroy(); // closing rFs; |
|
800 |
||
801 |
//__UHEAP_MARKEND; |
|
802 |
return iErr; |
|
803 |
||
804 |
||
805 |
||
806 |
||
807 |
||
808 |
||
809 |
||
810 |
||
811 |
} |
|
812 |
||
813 |
// ----------------------------------------------------------------------------- |
|
814 |
// CContactsUT:deletetestL |
|
815 |
// Example test method function. |
|
816 |
// (other items were commented in a header). |
|
817 |
// ----------------------------------------------------------------------------- |
|
818 |
// |
|
819 |
TInt CContactsUT::deletetestL(CStifItemParser& aItem) |
|
820 |
{ |
|
821 |
||
822 |
iCase = EDeleteContact; |
|
823 |
iErr = KErrGeneral; |
|
824 |
LoadService(); |
|
825 |
||
826 |
//For Automation |
|
827 |
||
828 |
||
829 |
iCase = EImport; |
|
830 |
||
831 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL(); |
|
832 |
||
833 |
TInt pos = 0; |
|
834 |
||
835 |
pMap->InsertL(KDBUri, TLiwVariant( _L("sim://global_adn"))); |
|
836 |
||
837 |
pMap->InsertL(KSourceFileNameParam, TLiwVariant( _L("c:\\data\\Import.vcf"))); |
|
838 |
||
839 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact"))); |
|
840 |
const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); |
|
841 |
||
842 |
inList ->AppendL( paramContentType ); |
|
843 |
inList ->AppendL( paramAddData ); |
|
844 |
||
845 |
iIface->ExecuteCmdL(KCmdImport, *inList, *outList, KLiwOptASyncronous, this); |
|
846 |
||
847 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); |
|
848 |
TLiwVariant err = param->Value(); |
|
849 |
TInt code = err.AsTInt32(); |
|
850 |
||
851 |
if(code == SErrNone) |
|
852 |
{ |
|
853 |
CActiveScheduler::Start(); |
|
854 |
} |
|
855 |
inList->Reset(); |
|
856 |
outList->Reset(); |
|
857 |
pMap->DecRef(); |
|
858 |
||
859 |
||
860 |
if(iErr != KErrGeneral) |
|
861 |
return iErr; |
|
862 |
||
863 |
||
864 |
const TLiwGenericParam paramContentType1(KType, TLiwVariant( _L("Contact"))); |
|
865 |
inList->AppendL( paramContentType1 ); |
|
866 |
||
867 |
||
868 |
CLiwDefaultMap* map = CLiwDefaultMap :: NewL(); |
|
869 |
CleanupStack::PushL(map); |
|
870 |
map->InsertL(KDBUri, TLiwVariant(_L("sim://global_adn"))); |
|
871 |
||
872 |
const TLiwGenericParam paramDeleteData(KFilter, TLiwVariant(map)); |
|
873 |
inList ->AppendL( paramDeleteData ); |
|
874 |
||
875 |
iIface->ExecuteCmdL(KCmdGetList, *inList, *outList, KLiwOptASyncronous, this); |
|
876 |
||
877 |
pos = 0; |
|
878 |
const TLiwGenericParam* param1 = outList->FindFirst( pos, KExitCode ); |
|
879 |
TLiwVariant err1 = param1->Value(); |
|
880 |
TInt code1 = err1.AsTInt32(); |
|
881 |
||
882 |
inList->Reset(); |
|
883 |
outList->Reset(); |
|
884 |
||
885 |
CleanupStack::Pop(map); |
|
886 |
map->DecRef(); |
|
887 |
||
888 |
if(code1 == SErrNone) |
|
889 |
{ |
|
890 |
CActiveScheduler::Start(); |
|
891 |
||
892 |
} |
|
893 |
||
894 |
iCase = EDeleteCkh; |
|
895 |
||
896 |
const TLiwGenericParam paramContent2(KType, TLiwVariant( _L("Contact"))); |
|
897 |
inList ->AppendL( paramContent2 ); |
|
898 |
CLiwDefaultList* list = CLiwDefaultList :: NewL(); |
|
899 |
list->AppendL(TLiwVariant(*iCntID)); |
|
900 |
||
901 |
CLiwMap* mapContactId = CLiwDefaultMap::NewL(); |
|
902 |
mapContactId->InsertL(KDBUri, TLiwVariant(_L("sim://global_adn"))); |
|
903 |
mapContactId->InsertL(KList,TLiwVariant(list)); |
|
904 |
||
905 |
const TLiwGenericParam paramDeleteData1(KData, TLiwVariant(mapContactId)); |
|
906 |
inList ->AppendL( paramDeleteData1 ); |
|
907 |
iIface->ExecuteCmdL(KCmdDelete, *inList, *outList, KLiwOptASyncronous, this); |
|
908 |
||
909 |
||
910 |
param = outList->FindFirst( pos, KExitCode ); |
|
911 |
err = param->Value(); |
|
912 |
code = err.AsTInt32(); |
|
913 |
||
914 |
if(code == SErrNone) |
|
915 |
{ |
|
916 |
CActiveScheduler::Start(); |
|
917 |
} |
|
918 |
inList->Reset(); |
|
919 |
outList->Reset(); |
|
920 |
mapContactId->DecRef(); |
|
921 |
list->DecRef(); |
|
922 |
||
923 |
return iErr; |
|
924 |
||
925 |
||
926 |
} |
|
927 |
||
928 |
||
929 |
// ----------------------------------------------------------------------------- |
|
930 |
// CContactsUT:importL |
|
931 |
// Example test method function. |
|
932 |
// (other items were commented in a header). |
|
933 |
// ----------------------------------------------------------------------------- |
|
934 |
// |
|
935 |
TInt CContactsUT::importL(CStifItemParser& aItem) |
|
936 |
{ |
|
937 |
||
938 |
iErr = KErrGeneral; |
|
939 |
LoadService(); |
|
940 |
iCase = EImport; |
|
941 |
||
942 |
// __UHEAP_MARK; |
|
943 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL(); |
|
944 |
||
945 |
TInt pos = 0; |
|
946 |
||
947 |
pMap->InsertL(KDBUri, TLiwVariant( _L("sim://global_adn"))); |
|
948 |
||
949 |
pMap->InsertL(KSourceFileNameParam, TLiwVariant( _L("c:\\data\\Import.vcf"))); |
|
950 |
||
951 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact"))); |
|
952 |
const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); |
|
953 |
||
954 |
inList ->AppendL( paramContentType ); |
|
955 |
inList ->AppendL( paramAddData ); |
|
956 |
||
957 |
iIface->ExecuteCmdL(KCmdImport, *inList, *outList, KLiwOptASyncronous, this); |
|
958 |
||
959 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); |
|
960 |
TLiwVariant err = param->Value(); |
|
961 |
TInt code = err.AsTInt32(); |
|
962 |
||
963 |
if(code == SErrNone) |
|
964 |
{ |
|
965 |
CActiveScheduler::Start(); |
|
966 |
} |
|
967 |
inList->Reset(); |
|
968 |
outList->Reset(); |
|
969 |
pMap->DecRef(); |
|
970 |
||
971 |
// __UHEAP_MARKEND; |
|
972 |
||
973 |
return iErr; |
|
974 |
||
975 |
||
976 |
||
977 |
||
978 |
||
979 |
||
980 |
||
981 |
} |
|
982 |
||
983 |
// ----------------------------------------------------------------------------- |
|
984 |
// CContactsUT:exportL |
|
985 |
// Example test method function. |
|
986 |
// (other items were commented in a header). |
|
987 |
// ----------------------------------------------------------------------------- |
|
988 |
// |
|
989 |
TInt CContactsUT::exportL(CStifItemParser& aItem) |
|
990 |
{ |
|
991 |
||
992 |
RFs fs; |
|
993 |
RFile file; |
|
994 |
User::LeaveIfError(fs.Connect()); |
|
995 |
CleanupClosePushL(fs); |
|
996 |
||
997 |
TInt errfile =file.Replace(fs,_L("C:\\tcontacts_export.txt"), EFileWrite | EFileStreamText); |
|
998 |
file.Write(_L8("\n Starting logs")); |
|
999 |
file.Flush(); |
|
1000 |
||
1001 |
||
1002 |
||
1003 |
||
1004 |
||
1005 |
iErr = KErrNone; |
|
1006 |
LoadService(); |
|
1007 |
||
1008 |
//For Autoamtion |
|
1009 |
||
1010 |
||
1011 |
||
1012 |
iCase = EImport; |
|
1013 |
||
1014 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL(); |
|
1015 |
||
1016 |
TInt pos = 0; |
|
1017 |
||
1018 |
pMap->InsertL(KDBUri, TLiwVariant( _L("sim://global_adn"))); |
|
1019 |
||
1020 |
pMap->InsertL(KSourceFileNameParam, TLiwVariant( _L("c:\\data\\Import.vcf"))); |
|
1021 |
||
1022 |
const TLiwGenericParam paramContentType1(KType, TLiwVariant( _L("Contact"))); |
|
1023 |
const TLiwGenericParam paramAddData1(KData, TLiwVariant(pMap)); |
|
1024 |
||
1025 |
inList ->AppendL( paramContentType1 ); |
|
1026 |
inList ->AppendL( paramAddData1 ); |
|
1027 |
||
1028 |
iIface->ExecuteCmdL(KCmdImport, *inList, *outList, KLiwOptASyncronous, this); |
|
1029 |
||
1030 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); |
|
1031 |
TLiwVariant err = param->Value(); |
|
1032 |
TInt code = err.AsTInt32(); |
|
1033 |
||
1034 |
if(code == SErrNone) |
|
1035 |
{ |
|
1036 |
CActiveScheduler::Start(); |
|
1037 |
} |
|
1038 |
inList->Reset(); |
|
1039 |
outList->Reset(); |
|
1040 |
pMap->DecRef(); |
|
1041 |
||
1042 |
if(iErr == KErrNone) |
|
1043 |
{ |
|
1044 |
iCase = EExport; |
|
1045 |
pos = 0; |
|
1046 |
||
1047 |
||
1048 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact"))); |
|
1049 |
inList ->AppendL( paramContentType ); |
|
1050 |
||
1051 |
CLiwDefaultMap* map = CLiwDefaultMap :: NewL(); |
|
1052 |
CleanupStack::PushL(map); |
|
1053 |
map->InsertL(KDBUri, TLiwVariant(_L("sim://global_adn"))); |
|
1054 |
||
1055 |
const TLiwGenericParam paramDeleteData(KFilter, TLiwVariant(map)); |
|
1056 |
inList ->AppendL( paramDeleteData ); |
|
1057 |
||
1058 |
iIface->ExecuteCmdL(KCmdGetList, *inList, *outList, KLiwOptASyncronous, this); |
|
1059 |
||
1060 |
const TLiwGenericParam* param1 = outList->FindFirst( pos, KExitCode ); |
|
1061 |
err.Reset(); |
|
1062 |
err = param1->Value(); |
|
1063 |
TInt code1 = err.AsTInt32(); |
|
1064 |
||
1065 |
inList->Reset(); |
|
1066 |
outList->Reset(); |
|
1067 |
||
1068 |
CleanupStack::Pop(map); |
|
1069 |
map->DecRef(); |
|
1070 |
||
1071 |
TBuf8<255> buf; |
|
1072 |
file.Write(_L8("\n GetList called and return error is : ")); |
|
1073 |
buf.Num(code1); |
|
1074 |
file.Write(buf); |
|
1075 |
file.Flush(); |
|
1076 |
buf.Zero(); |
|
1077 |
||
1078 |
||
1079 |
||
1080 |
if(code1 == SErrNone) |
|
1081 |
{ |
|
1082 |
CActiveScheduler::Start(); |
|
1083 |
} |
|
1084 |
||
1085 |
iCase = EExportChk; |
|
1086 |
||
1087 |
||
1088 |
||
1089 |
||
1090 |
const TLiwGenericParam paramContent(KType, TLiwVariant( _L("Contact"))); |
|
1091 |
inList->AppendL( paramContent ); |
|
1092 |
||
1093 |
TBuf<255> cntIdunicode; |
|
1094 |
cntIdunicode.Copy(*iCntID); |
|
1095 |
buf.Copy(cntIdunicode); |
|
1096 |
||
1097 |
file.Write(_L8("\n Contact Id copied : ")); |
|
1098 |
file.Write(buf); |
|
1099 |
||
1100 |
file.Flush(); |
|
1101 |
buf.Zero(); |
|
1102 |
||
1103 |
||
1104 |
||
1105 |
CLiwMap* pMap1 = CLiwDefaultMap::NewL(); |
|
1106 |
pMap1->InsertL(KDBUri, TLiwVariant( _L("sim://global_adn"))); |
|
1107 |
pMap1->InsertL(KContactId, TLiwVariant(cntIdunicode)); |
|
1108 |
||
1109 |
pMap1->InsertL(KDestFileNameParam, TLiwVariant( _L("c:\\data\\Export.vcf"))); |
|
1110 |
||
1111 |
const TLiwGenericParam paramContentType2(KType, TLiwVariant( _L("Contact"))); |
|
1112 |
const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap1)); |
|
1113 |
||
1114 |
inList ->AppendL( paramContentType2 ); |
|
1115 |
inList ->AppendL( paramAddData ); |
|
1116 |
||
1117 |
iIface->ExecuteCmdL(KCmdExport, *inList, *outList, KLiwOptASyncronous, this); |
|
1118 |
||
1119 |
file.Write(_L8("\n Contact Id copied : ")); |
|
1120 |
file.Flush(); |
|
1121 |
||
1122 |
||
1123 |
||
1124 |
param = outList->FindFirst( pos, KExitCode ); |
|
1125 |
err.Reset(); |
|
1126 |
err = param->Value(); |
|
1127 |
TInt code2 = err.AsTInt32(); |
|
1128 |
||
1129 |
file.Write(_L8("\n Error code : ")); |
|
1130 |
buf.Num(code2); |
|
1131 |
file.Write(buf); |
|
1132 |
file.Flush(); |
|
1133 |
buf.Zero(); |
|
1134 |
||
1135 |
||
1136 |
if(code2 == SErrNone) |
|
1137 |
{ |
|
1138 |
CActiveScheduler::Start(); |
|
1139 |
} |
|
1140 |
inList->Reset(); |
|
1141 |
outList->Reset(); |
|
1142 |
pMap1->DecRef(); |
|
1143 |
||
1144 |
file.Write(_L8("\n Error code after retunring of call back iErr : ")); |
|
1145 |
buf.Num(iErr); |
|
1146 |
file.Write(buf); |
|
1147 |
file.Flush(); |
|
1148 |
buf.Zero(); |
|
1149 |
} |
|
1150 |
file.Close(); |
|
1151 |
CleanupStack::PopAndDestroy(); // rFs closing |
|
1152 |
||
1153 |
||
1154 |
// __UHEAP_MARKEND; |
|
1155 |
return iErr; |
|
1156 |
||
1157 |
||
1158 |
} |