5
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: ?Description
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
// INCLUDE FILES
|
|
22 |
#include <e32svr.h>
|
|
23 |
#include <StifParser.h>
|
|
24 |
#include <Stiftestinterface.h>
|
|
25 |
|
|
26 |
#include <LiwServiceHandler.h>
|
|
27 |
#include <LiwCommon.h>
|
|
28 |
|
|
29 |
#include <VPbkEng.rsg>
|
|
30 |
#include <e32def.h>
|
|
31 |
|
|
32 |
#include <MVPbkContactFieldTextData.h>
|
|
33 |
#include <MVPbkContactStoreList.h>
|
|
34 |
#include <MVPbkContactOperationBase.h>
|
|
35 |
#include <MVPbkContactLink.h>
|
|
36 |
#include <CVPbkContactLinkArray.h>
|
|
37 |
#include <MVPbkContactGroup.h>
|
|
38 |
#include <CVPbkContactManager.h>
|
|
39 |
#include <MVPbkContactStoreList.h>
|
|
40 |
#include <MVPbkContactStore.h>
|
|
41 |
#include <TVPbkContactStoreUriPtr.h>
|
|
42 |
#include <CVPbkFieldTypeRefsList.h>
|
|
43 |
#include <MVPbkContactFieldTextData.h>
|
|
44 |
#include<f32file.h>
|
|
45 |
|
|
46 |
#include "Tcomplugin.h"
|
|
47 |
|
|
48 |
_LIT(LogFileName , "C:\\Notifications.txt") ;
|
|
49 |
|
|
50 |
_LIT(KError,"Error code is");
|
|
51 |
_LIT(KSuccess,"Successful");
|
|
52 |
_LIT(KNewLine,"\n");
|
|
53 |
_LIT(KServiceOpen,"Service handle created");
|
|
54 |
_LIT(KServiceClose,"Service handle deleted");
|
|
55 |
_LIT(KPhoneNumber,"9886431364");
|
|
56 |
_LIT(KGroup1,"Test1");
|
|
57 |
|
|
58 |
_LIT8( KIDataSource,"IDataSource" );
|
|
59 |
_LIT8( KExitCode, "ErrorCode" );
|
|
60 |
_LIT8( KService, "Service.Contact" );
|
|
61 |
|
|
62 |
//commands that can be performed on the contacts database.
|
|
63 |
_LIT8( KCmdImport, "Import" );
|
|
64 |
_LIT8( KCmdExport, "Export" );
|
|
65 |
_LIT8( KCmdGetList, "GetList");
|
|
66 |
_LIT8( KCmdAdd, "Add" );
|
|
67 |
_LIT8( KCmdDelete, "Delete" );
|
|
68 |
_LIT8( KCmdOrganiseGroups, "Organise" );
|
|
69 |
|
|
70 |
_LIT8( KCancel, "Cancel" );
|
|
71 |
|
|
72 |
// Constant for the appending Error code
|
|
73 |
_LIT8( KErrorCode, "ErrorCode" );
|
|
74 |
|
|
75 |
// Constant for the appending TransactionID
|
|
76 |
_LIT8( KTransactionID, "TransactionID" );
|
|
77 |
|
|
78 |
//Constant for appending Iterator
|
|
79 |
_LIT8( KReturnValue, "ReturnValue");
|
|
80 |
|
|
81 |
_LIT8(KSourceFileNameParam, "SourceFile");
|
|
82 |
_LIT8(KDestFileNameParam, "DestinationFile");
|
|
83 |
_LIT8(KGroupId,"id");
|
|
84 |
|
|
85 |
|
|
86 |
_LIT8(KFieldLabel, "Label");
|
|
87 |
_LIT8(KFieldValue, "Value");
|
|
88 |
_LIT8(KFieldNext, "Next");
|
|
89 |
_LIT8(KGroupLabel, "GroupLabel");
|
|
90 |
_LIT8(KContents, "Contents");
|
|
91 |
_LIT8(KContactId, "id");
|
|
92 |
|
|
93 |
_LIT8(KList, "IdList");
|
|
94 |
_LIT8(KContact, "Contact");
|
|
95 |
_LIT8(KGroup, "Group");
|
|
96 |
_LIT8(KDatabase, "Database");
|
|
97 |
|
|
98 |
_LIT8(KDBUri, "DBUri");
|
|
99 |
_LIT8(KSearchVal, "SearchVal");
|
|
100 |
|
|
101 |
_LIT8(KType, "Type");
|
|
102 |
_LIT8(KFilter, "Filter");
|
|
103 |
_LIT8(KSort, "Sort");
|
|
104 |
_LIT8(KOrder, "Order");
|
|
105 |
_LIT8(KData, "Data");
|
|
106 |
_LIT8(KOperationType, "OperationType");
|
|
107 |
|
|
108 |
_LIT(KAssociate, "Associate");
|
|
109 |
_LIT(KDissociate, "Disassociate");
|
|
110 |
_LIT(KAscending, "Ascending");
|
|
111 |
_LIT(KDescending, "Descending");
|
|
112 |
|
|
113 |
//Field Keys
|
|
114 |
_LIT8(KSync, "Sync");
|
|
115 |
_LIT8(KLastName, "LastName");
|
|
116 |
_LIT8(KLastNameReading, "LastNameReading");
|
|
117 |
_LIT8(KFirstName, "FirstName");
|
|
118 |
_LIT8(KFirstNameReading, "FirstNameReading");
|
|
119 |
_LIT8(KPrefix, "Prefix");
|
|
120 |
_LIT8(KSuffix, "Suffix");
|
|
121 |
_LIT8(KSecondName, "SecondName");
|
|
122 |
_LIT8(KLandPhoneHome, "LandPhoneHome");
|
|
123 |
_LIT8(KMobilePhoneHome, "MobilePhoneHome");
|
|
124 |
_LIT8(KVideoNumberHome, "VideoNumberHome");
|
|
125 |
_LIT8(KFaxNumberHome, "FaxNumberHome");
|
|
126 |
_LIT8(KVoipHome, "VoipHome");
|
|
127 |
_LIT8(KEmailHome, "EmailHome");
|
|
128 |
_LIT8(KURLHome, "URLHome");
|
|
129 |
_LIT8(KAddrLabelHome, "AddrLabelHome");
|
|
130 |
_LIT8(KAddrPOHome, "AddrPOHome");
|
|
131 |
_LIT8(KAddrEXTHome, "AddrEXTHome");
|
|
132 |
_LIT8(KAddrStreetHome, "AddrStreetHome");
|
|
133 |
_LIT8(KAddrLocalHome, "AddrLocalHome");
|
|
134 |
_LIT8(KAddrRegionHome, "AddrRegionHome");
|
|
135 |
_LIT8(KAddrPostCodeHome, "AddrPostCodeHome");
|
|
136 |
_LIT8(KAddrCountryHome, "AddrCountryHome");
|
|
137 |
_LIT8(KJobTitle, "JobTitle");
|
|
138 |
_LIT8(KCompanyName,"CompanyName");
|
|
139 |
_LIT8(KLandPhoneWork, "LandPhoneWork");
|
|
140 |
_LIT8(KMobilePhoneWork, "MobilePhoneWork");
|
|
141 |
_LIT8(KVideoNumberWork, "VideoNumberWork");
|
|
142 |
_LIT8(KFaxNumberWork, "FaxNumberWork");
|
|
143 |
_LIT8(KVoipWork, "VoipWork");
|
|
144 |
_LIT8(KEmailWork, "EmailWork");
|
|
145 |
_LIT8(KURLWork, "URLWork");
|
|
146 |
_LIT8(KAddrLabelWork, "AddrLabelWork");
|
|
147 |
_LIT8(KAddrPOWork, "AddrPOWork");
|
|
148 |
_LIT8(KAddrEXTWork, "AddrEXTWork");
|
|
149 |
_LIT8(KAddrStreetWork, "AddrStreetWork");
|
|
150 |
_LIT8(KAddrLocalWork, "AddrLocalWork");
|
|
151 |
_LIT8(KAddrRegionWork, "AddrRegionWork");
|
|
152 |
_LIT8(KAddrPostCodeWork, "AddrPostCodeWork");
|
|
153 |
_LIT8(KAddrCountryWork, "AddrCountryWork");
|
|
154 |
_LIT8(KLandPhoneGen, "LandPhoneGen");
|
|
155 |
_LIT8(KMobilePhoneGen, "MobilePhoneGen");
|
|
156 |
_LIT8(KVideoNumberGen, "VideoNumberGen");
|
|
157 |
_LIT8(KFaxNumberGen, "FaxNumberGen");
|
|
158 |
_LIT8(KVOIPGen, "VOIPGen");
|
|
159 |
_LIT8(KPOC, "POC");
|
|
160 |
_LIT8(KSWIS, "SWIS");
|
|
161 |
_LIT8(KSIP, "SIP");
|
|
162 |
_LIT8(KEmailGen, "EmailGen");
|
|
163 |
_LIT8(KURLGen, "URLGen");
|
|
164 |
_LIT8(KAddrLabelGen, "AddrLabelGen");
|
|
165 |
_LIT8(KAddrPOGen, "AddrPOGen");
|
|
166 |
_LIT8(KAddrExtGen, "AddrExtGen");
|
|
167 |
_LIT8(KAddrStreetGen, "AddrStreetGen");
|
|
168 |
_LIT8(KAddrLocalGen, "AddrLocalGen");
|
|
169 |
_LIT8(KAddrRegionGen, "AddrRegionGen");
|
|
170 |
_LIT8(KAddrPostCodeGen, "AddrPostCodeGen");
|
|
171 |
_LIT8(KAddrCountryGen, "AddrCountryGen");
|
|
172 |
_LIT8(KPageNumber, "PageNumber");
|
|
173 |
_LIT8(KDTMFString, "DTMFString");
|
|
174 |
_LIT8(KWVAddress, "WVAddress");
|
|
175 |
_LIT8(KDate, "Date");
|
|
176 |
_LIT8(KNote, "Note");
|
|
177 |
_LIT8(KThumbNailPic, "ThumbNailPic");
|
|
178 |
_LIT8(KRingtone, "Ringtone");
|
|
179 |
_LIT8(KCallerObjImg, "CallerObjImg");
|
|
180 |
_LIT8(KCallerObjText, "CallerObjText");
|
|
181 |
_LIT8(KMiddleName, "MiddleName");
|
|
182 |
_LIT8(KDepartment, "Department");
|
|
183 |
_LIT8(KAsstName, "AsstName");
|
|
184 |
_LIT8(KSpouse, "Spouse");
|
|
185 |
_LIT8(KChildren, "Children");
|
|
186 |
_LIT8(KAsstPhone, "AsstPhone");
|
|
187 |
_LIT8(KCarPhone, "CarPhone");
|
|
188 |
_LIT8(KAnniversary, "Anniversary");
|
|
189 |
_LIT8(KSyncClass, "SyncClass");
|
|
190 |
_LIT8(KLOCPrivacy, "LOCPrivacy");
|
|
191 |
_LIT8(KGenLabel, "GenLabel");
|
|
192 |
|
|
193 |
|
|
194 |
//----------------------------------------------------------------------------
|
|
195 |
// CTestProvider :: Delete()
|
|
196 |
//----------------------------------------------------------------------------
|
|
197 |
void CTestProvider::Delete()
|
|
198 |
{
|
|
199 |
iIface->Close();
|
|
200 |
iCriteriaArray.Close();
|
|
201 |
delete iServiceHandler;
|
|
202 |
delete iInparams;
|
|
203 |
delete iOutparams;
|
|
204 |
delete iCriteria;
|
|
205 |
delete inList;
|
|
206 |
delete outList;
|
|
207 |
iIdArrayList.ResetAndDestroy();
|
|
208 |
delete iCntID;
|
|
209 |
}
|
|
210 |
|
|
211 |
// -----------------------------------------------------------------------------
|
|
212 |
// CTestProvider::RunMethodL
|
|
213 |
// Run specified method. Contains also table of test mothods and their names.
|
|
214 |
// -----------------------------------------------------------------------------
|
|
215 |
//
|
|
216 |
TInt CTestProvider::RunMethodL(
|
|
217 |
CStifItemParser& aItem )
|
|
218 |
{
|
|
219 |
|
|
220 |
static TStifFunctionInfo const KFunctions[] =
|
|
221 |
{
|
|
222 |
// Copy this line for every implemented function.
|
|
223 |
// First string is the function name used in TestScripter script file.
|
|
224 |
// Second is the actual implementation member function.
|
|
225 |
|
|
226 |
ENTRY("GetContactALL" , CTestProvider :: GetContactALL),
|
|
227 |
ENTRY("GetContactSearch" , CTestProvider :: GetContactSearch),
|
|
228 |
ENTRY("GetGroup" , CTestProvider :: GetGroup),
|
|
229 |
ENTRY("GetDatabase" , CTestProvider :: GetDatabase),
|
|
230 |
ENTRY("AddContact" , CTestProvider :: AddContact),
|
|
231 |
ENTRY("DeleteContact" , CTestProvider :: DeleteContact),
|
|
232 |
ENTRY("AddGroup" , CTestProvider :: AddGroup),
|
|
233 |
ENTRY("OrganiseAdd" , CTestProvider :: OrganiseAdd),
|
|
234 |
ENTRY("OrganiseDelete" , CTestProvider:: OrganiseDelete),
|
|
235 |
ENTRY("Export" , CTestProvider:: ExportL),
|
|
236 |
ENTRY("Import" , CTestProvider:: ImportL),
|
|
237 |
ENTRY("ModifyContact" , CTestProvider:: ModifyContact),
|
|
238 |
ENTRY("ModifyGroup" , CTestProvider:: ModifyGroup),
|
|
239 |
ENTRY("GetContactALLPosBased" , CTestProvider:: GetContactALLPosBased),
|
|
240 |
ENTRY("GetContactSearchPosBased" , CTestProvider:: GetContactSearchPosBased),
|
|
241 |
ENTRY("GetGroupPosBased" , CTestProvider:: GetGroupPosBased),
|
|
242 |
ENTRY("GetDatabasePosBased" , CTestProvider:: GetDatabasePosBased),
|
|
243 |
ENTRY("AddContactPosBased" , CTestProvider:: AddContactPosBased),
|
|
244 |
ENTRY("AddGroupPosBased" , CTestProvider:: AddGroupPosBased),
|
|
245 |
ENTRY("DeleteContactPosBased" , CTestProvider:: DeleteContactPosBased),
|
|
246 |
ENTRY("OrganiseAddPosBased" , CTestProvider :: OrganiseAddPosBased ),
|
|
247 |
ENTRY("OrganiseDeletePosbased" , CTestProvider :: OrganiseDeletePosbased),
|
|
248 |
ENTRY("ModifyContactPosBased" , CTestProvider :: ModifyContactPosBased),
|
|
249 |
ENTRY("ModifyGroupPosBased" , CTestProvider :: ModifyGroupPosBased),
|
|
250 |
ENTRY("ExportPosBased" , CTestProvider :: ExportPosBased),
|
|
251 |
ENTRY("ImportPosBased" , CTestProvider :: ImportPosBased),
|
|
252 |
ENTRY("CancelGetList" , CTestProvider :: CancelGetList),
|
|
253 |
ENTRY("CancelAddContact" , CTestProvider :: CancelAddContact),
|
|
254 |
ENTRY("CancelOrganiseAdd" , CTestProvider :: CancelOrganiseAdd),
|
|
255 |
ENTRY("CancelDeleteContact" , CTestProvider :: CancelDeleteContact),
|
|
256 |
ENTRY("CancelExport" , CTestProvider :: CancelExportL),
|
|
257 |
ENTRY("CancelImport" , CTestProvider :: CancelImportL)
|
|
258 |
|
|
259 |
};
|
|
260 |
|
|
261 |
const TInt count = sizeof( KFunctions ) /
|
|
262 |
sizeof( TStifFunctionInfo );
|
|
263 |
|
|
264 |
return RunInternalL( KFunctions, count, aItem );
|
|
265 |
|
|
266 |
}
|
|
267 |
|
|
268 |
TInt CTestProvider :: HandleNotifyL(TInt aCmdId,
|
|
269 |
TInt aEventId,
|
|
270 |
CLiwGenericParamList& aEventParamList,
|
|
271 |
const CLiwGenericParamList& aInParamList)
|
|
272 |
|
|
273 |
{
|
|
274 |
|
|
275 |
if (iCancelled != 1)
|
|
276 |
{
|
|
277 |
CActiveScheduler::Stop();
|
|
278 |
iCancelled = 0;
|
|
279 |
}
|
|
280 |
|
|
281 |
TInt pos = 0;
|
|
282 |
const TLiwGenericParam* param;
|
|
283 |
|
|
284 |
param = aEventParamList.FindFirst( pos, KExitCode );
|
|
285 |
|
|
286 |
TLiwVariant err = param->Value();
|
|
287 |
|
|
288 |
TInt code = err.AsTInt32();
|
|
289 |
|
|
290 |
if(iCase == EModifyContactComplete)
|
|
291 |
{
|
|
292 |
//call the get list once again to check whether the contact is modified
|
|
293 |
CStifItemParser* stiff;
|
|
294 |
iCase = EModifyContactVerify;
|
|
295 |
//this time call the getlist with the contact id to get only the modified contact
|
|
296 |
GetContactALL(*stiff);
|
|
297 |
}
|
|
298 |
else if(iCase == EGetAllContacts ||iCase == EDeleteContact
|
|
299 |
|| iCase == EOrganizeAddcntid || iCase == EVerifyImport
|
|
300 |
|| iCase == EModifyContact || iCase == EModifyContactVerify)
|
|
301 |
{
|
|
302 |
|
|
303 |
if (aEventId == KLiwEventCanceled)
|
|
304 |
{
|
|
305 |
iResult = KErrNone;
|
|
306 |
}
|
|
307 |
else
|
|
308 |
{
|
|
309 |
pos = 0;
|
|
310 |
TBool tResult = EFalse;
|
|
311 |
TBool bResult = EFalse;
|
|
312 |
TBool findResult = EFalse;
|
|
313 |
TBuf<255> firstName;
|
|
314 |
TLiwVariant cntId;
|
|
315 |
TLiwVariant mapfield;
|
|
316 |
TLiwVariant firstname;
|
|
317 |
TLiwVariant entry;
|
|
318 |
const CLiwMap* map = NULL;
|
|
319 |
const CLiwMap* mapField = NULL;
|
|
320 |
|
|
321 |
param = aEventParamList.FindFirst(pos, KReturnValue);
|
|
322 |
TLiwVariant iterator = param->Value();
|
|
323 |
CLiwIterable* iter = iterator.AsIterable();
|
|
324 |
while(iter->NextL(entry))
|
|
325 |
{
|
|
326 |
map = entry.AsMap();
|
|
327 |
TInt count1 = map->Count();
|
|
328 |
map->FindL(KContactId, cntId);
|
|
329 |
TPtrC ptr = cntId.AsDes();
|
|
330 |
if(iCase == EDeleteContact)
|
|
331 |
{
|
|
332 |
*iCntID = ptr;
|
|
333 |
break;
|
|
334 |
}
|
|
335 |
if(iCase == EOrganizeAddcntid)
|
|
336 |
{
|
|
337 |
TDesC* ptrtoCntId;
|
|
338 |
TInt count = iIdArrayList.Count();
|
|
339 |
for(TInt i = 0; i<count ; i++)
|
|
340 |
{
|
|
341 |
ptrtoCntId = iIdArrayList[i];
|
|
342 |
if( *ptrtoCntId == ptr )
|
|
343 |
{
|
|
344 |
findResult = ETrue;
|
|
345 |
break;
|
|
346 |
}
|
|
347 |
}
|
|
348 |
if(findResult)
|
|
349 |
{
|
|
350 |
findResult = EFalse;
|
|
351 |
continue;
|
|
352 |
}
|
|
353 |
else
|
|
354 |
{
|
|
355 |
*iCntID = ptr;
|
|
356 |
break;
|
|
357 |
}
|
|
358 |
}
|
|
359 |
if(map->FindL(KFirstName,mapfield))
|
|
360 |
mapField = mapfield.AsMap();
|
|
361 |
|
|
362 |
TInt count = mapField->Count();
|
|
363 |
mapField->FindL(KFieldValue,firstname);
|
|
364 |
firstName = firstname.AsDes();
|
|
365 |
if(iCase == EModifyContact )
|
|
366 |
{
|
|
367 |
if((firstName.CompareF(_L("Arnold")) == 0))
|
|
368 |
{
|
|
369 |
*iCntID=ptr;
|
|
370 |
break;
|
|
371 |
}
|
|
372 |
else
|
|
373 |
{
|
|
374 |
continue;
|
|
375 |
}
|
|
376 |
}
|
|
377 |
if(iCase == EModifyContactVerify )
|
|
378 |
{
|
|
379 |
if((firstName.CompareF(_L("Modified Arnold")) == 0))
|
|
380 |
{
|
|
381 |
iResult = KErrNone;
|
|
382 |
break;
|
|
383 |
}
|
|
384 |
else
|
|
385 |
{
|
|
386 |
continue;
|
|
387 |
}
|
|
388 |
}
|
|
389 |
if(iCase == EVerifyImport )
|
|
390 |
{
|
|
391 |
if((firstName.CompareF(_L("Monica Bellucci")) == 0) || (firstName.CompareF(_L("Kate Winslet")) == 0))
|
|
392 |
{
|
|
393 |
iResult = KErrNone;
|
|
394 |
break;
|
|
395 |
}
|
|
396 |
else
|
|
397 |
{
|
|
398 |
continue;
|
|
399 |
}
|
|
400 |
}
|
|
401 |
if(firstName.CompareF(_L("Johnny")) == 0)
|
|
402 |
{
|
|
403 |
tResult = ETrue;
|
|
404 |
}
|
|
405 |
if(firstName.CompareF(_L("Arnold")) == 0)
|
|
406 |
{
|
|
407 |
bResult = ETrue;
|
|
408 |
}
|
|
409 |
}
|
|
410 |
if(tResult && bResult)
|
|
411 |
{
|
|
412 |
iResult = KErrNone;
|
|
413 |
}
|
|
414 |
if( iCase == EDeleteContact )
|
|
415 |
{
|
|
416 |
iCase = EDeleteVerify;
|
|
417 |
}
|
|
418 |
|
|
419 |
iterator.Reset();
|
|
420 |
|
|
421 |
}
|
|
422 |
|
|
423 |
}
|
|
424 |
else if(iCase == EGetContactSearch)
|
|
425 |
{
|
|
426 |
pos = 0;
|
|
427 |
TBuf<255> firstName;
|
|
428 |
TLiwVariant cntId;
|
|
429 |
TLiwVariant mapfield;
|
|
430 |
TLiwVariant firstname;
|
|
431 |
TLiwVariant entry;
|
|
432 |
const CLiwMap* map = NULL;
|
|
433 |
const CLiwMap* mapField = NULL;
|
|
434 |
|
|
435 |
param = aEventParamList.FindFirst(pos, KReturnValue);
|
|
436 |
TLiwVariant iterator = param->Value();
|
|
437 |
CLiwIterable* iter = iterator.AsIterable();
|
|
438 |
while(1)
|
|
439 |
{
|
|
440 |
if(iter->NextL(entry))
|
|
441 |
{
|
|
442 |
map = entry.AsMap();
|
|
443 |
TInt count1 = map->Count();
|
|
444 |
map->FindL(KContactId, cntId);
|
|
445 |
TPtrC8 ptr = cntId.AsData();
|
|
446 |
if(map->FindL(KFirstName,mapfield))
|
|
447 |
mapField = mapfield.AsMap();
|
|
448 |
|
|
449 |
TInt count = mapField->Count();
|
|
450 |
firstname.Reset();
|
|
451 |
mapField->FindL(KFieldValue,firstname);
|
|
452 |
firstName = firstname.AsDes();
|
|
453 |
if(firstName.CompareF(_L("Johnny")) == 0)
|
|
454 |
{
|
|
455 |
iResult = KErrNone;
|
|
456 |
}
|
|
457 |
}
|
|
458 |
else
|
|
459 |
{
|
|
460 |
break;
|
|
461 |
}
|
|
462 |
}
|
|
463 |
|
|
464 |
}
|
|
465 |
else if(iCase == EDeleteVerify)
|
|
466 |
{
|
|
467 |
if (aEventId == KLiwEventCanceled)
|
|
468 |
{
|
|
469 |
iResult = KErrNone;
|
|
470 |
}
|
|
471 |
else if(aEventId == KLiwEventCompleted && code == KErrNone)//KLiwEventCompleted
|
|
472 |
{
|
|
473 |
iResult = KErrNone;
|
|
474 |
}
|
|
475 |
else
|
|
476 |
{
|
|
477 |
iResult = code;
|
|
478 |
}
|
|
479 |
}
|
|
480 |
else if(iCase == EGetGroup || iCase == EVerifyGroupAdd || iCase == EVerifyOrganizeDelete)
|
|
481 |
{
|
|
482 |
pos = 0;
|
|
483 |
|
|
484 |
TBuf<255> groupName;
|
|
485 |
TLiwVariant cntId;
|
|
486 |
TLiwVariant groupLabel;
|
|
487 |
TLiwVariant contents;
|
|
488 |
TLiwVariant entry;
|
|
489 |
const CLiwMap* map = NULL;
|
|
490 |
const CLiwList* list =NULL;
|
|
491 |
|
|
492 |
param = aEventParamList.FindFirst(pos, KReturnValue);
|
|
493 |
TLiwVariant iterator = param->Value();
|
|
494 |
CLiwIterable* iter = iterator.AsIterable();
|
|
495 |
while(iter->NextL(entry))
|
|
496 |
{
|
|
497 |
map = entry.AsMap();
|
|
498 |
TInt count1 = map->Count();
|
|
499 |
|
|
500 |
map->FindL(KGroupId, cntId);
|
|
501 |
TPtrC ptr = cntId.AsDes();
|
|
502 |
if(map->FindL(KGroupLabel,groupLabel))
|
|
503 |
{
|
|
504 |
groupName = groupLabel.AsDes();
|
|
505 |
iGrpID.Set(ptr);
|
|
506 |
}
|
|
507 |
if(groupName == _L("Test"))
|
|
508 |
{
|
|
509 |
if(map->FindL(KContents,contents))
|
|
510 |
{
|
|
511 |
iResult = KErrNone;
|
|
512 |
list = contents.AsList();
|
|
513 |
TInt count = list->Count();
|
|
514 |
for(TInt i=0; i<count ; i++)
|
|
515 |
{
|
|
516 |
TLiwVariant cntId;
|
|
517 |
list->AtL(i, cntId) ;
|
|
518 |
TPtrC cntid = cntId.AsDes() ;
|
|
519 |
HBufC* cnt = HBufC::NewL(cntid.Length());
|
|
520 |
*cnt = cntid;
|
|
521 |
iIdArrayList.AppendL(cnt);
|
|
522 |
}
|
|
523 |
|
|
524 |
}
|
|
525 |
if(iCase == EVerifyGroupAdd)
|
|
526 |
{
|
|
527 |
TInt count = iIdArrayList.Count();
|
|
528 |
for(TInt i = 0; i<count; i++)
|
|
529 |
{
|
|
530 |
if(*iCntID == *(iIdArrayList[i]))
|
|
531 |
{
|
|
532 |
iResult = KErrNone;
|
|
533 |
break;
|
|
534 |
}
|
|
535 |
}
|
|
536 |
}
|
|
537 |
if(iCase == EVerifyOrganizeDelete)
|
|
538 |
{
|
|
539 |
iResult = KErrNone;
|
|
540 |
TInt count = iIdArrayList.Count();
|
|
541 |
for(TInt i = 0; i<count; i++)
|
|
542 |
{
|
|
543 |
if(*iCntID == *(iIdArrayList[i]))
|
|
544 |
{
|
|
545 |
iResult = KErrGeneral;
|
|
546 |
break;
|
|
547 |
}
|
|
548 |
}
|
|
549 |
}
|
|
550 |
break;
|
|
551 |
}
|
|
552 |
|
|
553 |
}
|
|
554 |
|
|
555 |
|
|
556 |
}
|
|
557 |
else if(iCase == EAddGroup )
|
|
558 |
{
|
|
559 |
if(aEventId == KLiwEventCompleted && code == KErrNone )
|
|
560 |
{
|
|
561 |
iResult = KErrNone;
|
|
562 |
}
|
|
563 |
}
|
|
564 |
else if(iCase == EOrganizeAdd )
|
|
565 |
{
|
|
566 |
|
|
567 |
if (aEventId == KLiwEventCanceled)
|
|
568 |
{
|
|
569 |
iResult = KErrNone;
|
|
570 |
}
|
|
571 |
else if(aEventId == KLiwEventCompleted && code == KErrNone )
|
|
572 |
{
|
|
573 |
iCase = EVerifyGroupAdd;
|
|
574 |
CStifItemParser* stiff;
|
|
575 |
iIdArrayList.ResetAndDestroy();
|
|
576 |
GetGroup(*stiff);
|
|
577 |
}
|
|
578 |
else
|
|
579 |
{
|
|
580 |
iResult = code;
|
|
581 |
}
|
|
582 |
}
|
|
583 |
else if(iCase == EExportVcard )
|
|
584 |
{
|
|
585 |
if (aEventId == KLiwEventCanceled)
|
|
586 |
{
|
|
587 |
iResult = KErrNone;
|
|
588 |
}
|
|
589 |
else if(aEventId == KLiwEventCompleted && code == KErrNone )
|
|
590 |
{
|
|
591 |
iResult = KErrNone;
|
|
592 |
}
|
|
593 |
else
|
|
594 |
{
|
|
595 |
iResult = code;
|
|
596 |
}
|
|
597 |
}
|
|
598 |
|
|
599 |
else if(iCase == EImportVcard)
|
|
600 |
{
|
|
601 |
if (aEventId == KLiwEventCanceled)
|
|
602 |
{
|
|
603 |
iResult = KErrNone;
|
|
604 |
}
|
|
605 |
else if(aEventId == KLiwEventCompleted && code == KErrNone )
|
|
606 |
{
|
|
607 |
iCase = EVerifyImport;
|
|
608 |
CStifItemParser* stiff;
|
|
609 |
GetContactALL(*stiff);
|
|
610 |
}
|
|
611 |
else
|
|
612 |
{
|
|
613 |
iResult = code;
|
|
614 |
}
|
|
615 |
}
|
|
616 |
else if( iCase == EOrganizeDelete )
|
|
617 |
{
|
|
618 |
if(aEventId == KLiwEventCompleted && code == KErrNone )
|
|
619 |
{
|
|
620 |
iCase = EVerifyOrganizeDelete;
|
|
621 |
CStifItemParser* stiff;
|
|
622 |
iIdArrayList.ResetAndDestroy();
|
|
623 |
GetGroup(*stiff);
|
|
624 |
}
|
|
625 |
else
|
|
626 |
{
|
|
627 |
iResult = code;
|
|
628 |
}
|
|
629 |
}
|
|
630 |
else if( iCase == EAddContact )
|
|
631 |
{
|
|
632 |
if (aEventId == KLiwEventCanceled)
|
|
633 |
{
|
|
634 |
iResult = KErrNone;
|
|
635 |
}
|
|
636 |
else if(aEventId == KLiwEventCompleted && code == KErrNone )
|
|
637 |
{
|
|
638 |
iResult = KErrNone;
|
|
639 |
}
|
|
640 |
else
|
|
641 |
{
|
|
642 |
iResult = code;
|
|
643 |
}
|
|
644 |
}
|
|
645 |
}
|
|
646 |
|
|
647 |
void CTestProvider::LoadService()
|
|
648 |
{
|
|
649 |
TInt pos = 0;
|
|
650 |
iCntID = HBufC::NewL(255);
|
|
651 |
inList = CLiwGenericParamList::NewL();
|
|
652 |
outList = CLiwGenericParamList::NewL();
|
|
653 |
|
|
654 |
iServiceHandler = CLiwServiceHandler::NewL();
|
|
655 |
|
|
656 |
iInparams = &(iServiceHandler->InParamListL());
|
|
657 |
iOutparams = &(iServiceHandler->OutParamListL());
|
|
658 |
|
|
659 |
iCriteria = CLiwCriteriaItem::NewL( 1, KIDataSource, KService );
|
|
660 |
iCriteria->SetServiceClass(TUid::Uid( KLiwClassBase ));
|
|
661 |
|
|
662 |
iCriteriaArray.AppendL( iCriteria );
|
|
663 |
iServiceHandler->AttachL( iCriteriaArray );
|
|
664 |
|
|
665 |
iServiceHandler->ExecuteServiceCmdL( *iCriteria, *iInparams, *iOutparams );
|
|
666 |
|
|
667 |
iOutparams->FindFirst( pos, KIDataSource );
|
|
668 |
if(pos != KErrNotFound)
|
|
669 |
{
|
|
670 |
//LogMessage(_L8("Service Loaded\n"));
|
|
671 |
iIface = ( *iOutparams )[pos].Value().AsInterface();
|
|
672 |
}
|
|
673 |
else
|
|
674 |
{
|
|
675 |
//LogMessage(_L8("Service Not found\n"));
|
|
676 |
}
|
|
677 |
if( iInparams )
|
|
678 |
{
|
|
679 |
iInparams->Reset();
|
|
680 |
iInparams = NULL;
|
|
681 |
}
|
|
682 |
if( iOutparams )
|
|
683 |
{
|
|
684 |
iOutparams->Reset();
|
|
685 |
iOutparams = NULL; }
|
|
686 |
if( iCriteria )
|
|
687 |
{
|
|
688 |
delete iCriteria;
|
|
689 |
iCriteria = NULL;
|
|
690 |
}
|
|
691 |
}
|
|
692 |
|
|
693 |
|
|
694 |
|
|
695 |
void CTestProvider::HandleError( const TInt& aError,TInt /*aTransId*/ )
|
|
696 |
{
|
|
697 |
CActiveScheduler::Stop();
|
|
698 |
_LIT(KFunc,"In Handle Error\n");
|
|
699 |
iLog->Log(KFunc);
|
|
700 |
iErr = aError;
|
|
701 |
TBuf<5> buf;
|
|
702 |
buf.Num(aError);
|
|
703 |
iLog->Log(KError);
|
|
704 |
iLog->Log(buf);
|
|
705 |
iLog->Log(KNewLine);
|
|
706 |
}
|
|
707 |
|
|
708 |
void CTestProvider::HandleRetrieveContact( MVPbkStoreContact* /*aStoreContact*/, TInt /*aTransId*/ )
|
|
709 |
{
|
|
710 |
CActiveScheduler::Stop();
|
|
711 |
_LIT(KFunc,"In Handle Retrieve Contact\n");
|
|
712 |
iLog->Log(KFunc);
|
|
713 |
}
|
|
714 |
|
|
715 |
void CTestProvider::ContactOperationCompleted(TContactOpResult aResult)
|
|
716 |
{
|
|
717 |
CActiveScheduler::Stop();
|
|
718 |
_LIT(KFunc,"In ContactOperationCompleted \n");
|
|
719 |
iLog->Log(KFunc);
|
|
720 |
TBuf<5> buf;
|
|
721 |
buf.Num(aResult.iOpCode);
|
|
722 |
iLog->Log(KSuccess);
|
|
723 |
iLog->Log(buf);
|
|
724 |
iLog->Log(KNewLine);
|
|
725 |
}
|
|
726 |
|
|
727 |
void CTestProvider::ContactOperationFailed
|
|
728 |
(TContactOp /*aOpCode*/, TInt aErrorCode, TBool /*aErrorNotified*/)
|
|
729 |
{
|
|
730 |
CActiveScheduler::Stop();
|
|
731 |
_LIT(KFunc,"In ContactOperationFailed \n");
|
|
732 |
iLog->Log(KFunc);
|
|
733 |
TBuf<5> buf;
|
|
734 |
buf.Num(aErrorCode);
|
|
735 |
iLog->Log(KError);
|
|
736 |
iLog->Log(buf);
|
|
737 |
iLog->Log(KNewLine);
|
|
738 |
}
|
|
739 |
|
|
740 |
void CTestProvider::FindCompleteL( MVPbkContactLinkArray* aResults )
|
|
741 |
{
|
|
742 |
CActiveScheduler::Stop();
|
|
743 |
_LIT(KFunc,"In FindCompleteL \n");
|
|
744 |
iLog->Log(KFunc);
|
|
745 |
// iFindResults = aResults;
|
|
746 |
delete iFindResults;
|
|
747 |
iFindResults = aResults;
|
|
748 |
iLog->Log(KSuccess);
|
|
749 |
}
|
|
750 |
void CTestProvider::FindFailed( TInt aError )
|
|
751 |
{
|
|
752 |
CActiveScheduler::Stop();
|
|
753 |
_LIT(KFunc,"In FindFailed \n");
|
|
754 |
iLog->Log(KFunc);
|
|
755 |
iErr = aError;
|
|
756 |
TBuf<5> buf;
|
|
757 |
buf.Num(aError);
|
|
758 |
iLog->Log(KError);
|
|
759 |
iLog->Log(buf);
|
|
760 |
iLog->Log(KNewLine);
|
|
761 |
}
|
|
762 |
|
|
763 |
void CTestProvider::VPbkSingleContactOperationComplete(
|
|
764 |
MVPbkContactOperationBase& aOperation,
|
|
765 |
MVPbkStoreContact* aContact )
|
|
766 |
{
|
|
767 |
CActiveScheduler::Stop();
|
|
768 |
_LIT(KFunc,"In VPbkSingleContactOperationComplete \n");
|
|
769 |
iLog->Log(KFunc);
|
|
770 |
iLog->Log(KSuccess);
|
|
771 |
}
|
|
772 |
|
|
773 |
|
|
774 |
void CTestProvider::VPbkSingleContactOperationFailed(
|
|
775 |
MVPbkContactOperationBase& aOperation,
|
|
776 |
TInt aError )
|
|
777 |
{
|
|
778 |
CActiveScheduler::Stop();
|
|
779 |
_LIT(KFunc,"In VPbkSingleContactOperationFailed \n");
|
|
780 |
iLog->Log(KFunc);
|
|
781 |
TBuf<5> buf;
|
|
782 |
buf.Num(aError);
|
|
783 |
iLog->Log(KError);
|
|
784 |
iLog->Log(buf);
|
|
785 |
iLog->Log(KNewLine);
|
|
786 |
}
|
|
787 |
|
|
788 |
void CTestProvider::StepComplete(
|
|
789 |
MVPbkContactOperationBase& /*aOperation*/,
|
|
790 |
TInt /*aStepSize*/ )
|
|
791 |
{
|
|
792 |
_LIT(KFunc,"In StepComplete \n");
|
|
793 |
iLog->Log(KFunc);
|
|
794 |
iLog->Log(KSuccess);
|
|
795 |
iLog->Log(KNewLine);
|
|
796 |
}
|
|
797 |
|
|
798 |
TBool CTestProvider::StepFailed(
|
|
799 |
MVPbkContactOperationBase& /*aOperation*/,
|
|
800 |
TInt /*aStepSize*/, TInt /*aError*/ )
|
|
801 |
{
|
|
802 |
_LIT(KFunc,"In StepFailed \n");
|
|
803 |
iLog->Log(KFunc);
|
|
804 |
return EFalse;
|
|
805 |
}
|
|
806 |
|
|
807 |
void CTestProvider::OperationComplete(
|
|
808 |
MVPbkContactOperationBase& /*aOperation*/ )
|
|
809 |
{
|
|
810 |
CActiveScheduler::Stop();
|
|
811 |
_LIT(KFunc,"In OperationComplete \n");
|
|
812 |
iLog->Log(KFunc);
|
|
813 |
iErr = KErrNone;
|
|
814 |
iLog->Log(KSuccess);
|
|
815 |
iLog->Log(KNewLine);
|
|
816 |
}
|
|
817 |
|
|
818 |
|
|
819 |
void CTestProvider::AddOneContactL(const TDesC& aName)
|
|
820 |
{
|
|
821 |
// Print to UI
|
|
822 |
_LIT( KContactsTest, "ContactsUT" );
|
|
823 |
_LIT( KExample, "In AddOneContactL" );
|
|
824 |
TestModuleIf().Printf( 0, KContactsTest, KExample );
|
|
825 |
// Print to log file
|
|
826 |
iLog->Log( KExample );
|
|
827 |
|
|
828 |
//__UHEAP_MARK;
|
|
829 |
CVPbkFieldTypeRefsList* fieldTypeRefList = CVPbkFieldTypeRefsList::NewL();
|
|
830 |
CleanupStack::PushL(fieldTypeRefList);
|
|
831 |
|
|
832 |
fieldTypeRefList->AppendL(
|
|
833 |
*iContactManager->FieldTypes().Find( R_VPBK_FIELD_TYPE_FIRSTNAME ) );
|
|
834 |
fieldTypeRefList->AppendL(
|
|
835 |
*iContactManager->FieldTypes().Find( R_VPBK_FIELD_TYPE_MOBILEPHONEGEN ) );
|
|
836 |
|
|
837 |
// Create first contact
|
|
838 |
iStoreContact = iStore->CreateNewContactLC();
|
|
839 |
|
|
840 |
// Create contact field for contact
|
|
841 |
MVPbkStoreContactField* field = iStoreContact->CreateFieldLC( fieldTypeRefList->FieldTypeAt( 0 ) );
|
|
842 |
// Set contact field data
|
|
843 |
(MVPbkContactFieldTextData::Cast(field->FieldData())).SetTextL( aName );
|
|
844 |
// Add the contact field to contact
|
|
845 |
iStoreContact->AddFieldL( field );
|
|
846 |
CleanupStack::Pop(); // field
|
|
847 |
|
|
848 |
// Create contact field for contact
|
|
849 |
field = iStoreContact->CreateFieldLC( fieldTypeRefList->FieldTypeAt( 1 ) );
|
|
850 |
// Set contact field data
|
|
851 |
(MVPbkContactFieldTextData::Cast(field->FieldData())).SetTextL( KPhoneNumber );
|
|
852 |
// Add the contact field to contact
|
|
853 |
iStoreContact->AddFieldL( field );
|
|
854 |
CleanupStack::Pop(); // field
|
|
855 |
|
|
856 |
// Commit the new created contact to contact store
|
|
857 |
iStoreContact->CommitL( *this );
|
|
858 |
CActiveScheduler::Start();
|
|
859 |
CleanupStack::PopAndDestroy(); // iStoreContact
|
|
860 |
CleanupStack::PopAndDestroy(fieldTypeRefList);
|
|
861 |
//__UHEAP_MARKEND;
|
|
862 |
|
|
863 |
}
|
|
864 |
|
|
865 |
void CTestProvider::AddOneGroupL(const TDesC& aName)
|
|
866 |
{
|
|
867 |
// Print to UI
|
|
868 |
_LIT( KContactsTest, "ContactsUT" );
|
|
869 |
_LIT( KExample, "In AddOneGroupL" );
|
|
870 |
TestModuleIf().Printf( 0, KContactsTest, KExample );
|
|
871 |
// Print to log file
|
|
872 |
iLog->Log( KExample );
|
|
873 |
|
|
874 |
// __UHEAP_MARK;
|
|
875 |
iGroup = iStore->CreateNewContactGroupLC();
|
|
876 |
iGroup->SetGroupLabelL(aName);
|
|
877 |
iGroup->CommitL(*this);
|
|
878 |
CActiveScheduler::Start();
|
|
879 |
CleanupStack::Pop();
|
|
880 |
delete iGroup;
|
|
881 |
iGroup = NULL;
|
|
882 |
// __UHEAP_MARKEND;
|
|
883 |
}
|
|
884 |
|
|
885 |
TInt CTestProvider :: GetContactALL(CStifItemParser& /*aItem */)
|
|
886 |
{
|
|
887 |
AddOneContactL(_L("Arnold"));
|
|
888 |
AddOneContactL(_L("Johnny"));
|
|
889 |
CLiwDefaultMap* map = CLiwDefaultMap :: NewL();
|
|
890 |
if(inList && inList->Count())
|
|
891 |
inList->Reset();
|
|
892 |
|
|
893 |
//__UHEAP_MARK;
|
|
894 |
iResult = KErrGeneral;
|
|
895 |
if(iCase != EOrganizeAddcntid && iCase != EDeleteContact
|
|
896 |
&& iCase != EVerifyImport && iCase != EModifyContact && iCase != EModifyContactVerify)
|
|
897 |
{
|
|
898 |
LoadService();
|
|
899 |
iCase = EGetAllContacts;
|
|
900 |
}
|
|
901 |
|
|
902 |
TInt pos = 0;
|
|
903 |
if(iCase == EModifyContactVerify)
|
|
904 |
{
|
|
905 |
map = CLiwDefaultMap :: NewL();
|
|
906 |
CleanupStack::PushL(map);
|
|
907 |
map->InsertL( KContactId,*iCntID );
|
|
908 |
const TLiwGenericParam paramGetlistData(KFilter, TLiwVariant(map));
|
|
909 |
inList->AppendL( paramGetlistData );
|
|
910 |
}
|
|
911 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact")));
|
|
912 |
inList->AppendL( paramContentType );
|
|
913 |
iIface->ExecuteCmdL(KCmdGetList, *inList, *outList, KLiwOptASyncronous, this);
|
|
914 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
915 |
TLiwVariant err = param->Value();
|
|
916 |
TInt code = err.AsTInt32();
|
|
917 |
|
|
918 |
if(code == SErrNone)
|
|
919 |
{
|
|
920 |
CActiveScheduler::Start();
|
|
921 |
}
|
|
922 |
|
|
923 |
inList->Reset();
|
|
924 |
outList->Reset();
|
|
925 |
if(iCase == EModifyContactVerify)
|
|
926 |
{
|
|
927 |
CleanupStack::Pop(map);
|
|
928 |
map->DecRef();
|
|
929 |
}
|
|
930 |
//__UHEAP_MARKEND;
|
|
931 |
return iResult;
|
|
932 |
}
|
|
933 |
|
|
934 |
|
|
935 |
TInt CTestProvider :: GetContactSearch(CStifItemParser& /*aItem */)
|
|
936 |
{
|
|
937 |
AddOneContactL(_L("Johnny"));
|
|
938 |
_LIT8(KFilter, "Filter");
|
|
939 |
_LIT8(KSearchVal, "SearchVal");
|
|
940 |
iResult = KErrGeneral;
|
|
941 |
LoadService();
|
|
942 |
TInt pos = 0;
|
|
943 |
iCase = EGetContactSearch;
|
|
944 |
|
|
945 |
//const TLiwGenericParam paramGetListSortOrder;
|
|
946 |
|
|
947 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact")));
|
|
948 |
inList ->AppendL( paramContentType );
|
|
949 |
|
|
950 |
CLiwDefaultMap* map = CLiwDefaultMap :: NewL();
|
|
951 |
CleanupStack::PushL(map);
|
|
952 |
map->InsertL(KSearchVal,_L("j"));
|
|
953 |
|
|
954 |
const TLiwGenericParam paramData(KFilter, TLiwVariant(map));
|
|
955 |
inList ->AppendL( paramData );
|
|
956 |
|
|
957 |
iIface->ExecuteCmdL(KCmdGetList, *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 |
|
|
968 |
CleanupStack::Pop(map);
|
|
969 |
map->DecRef();
|
|
970 |
inList->Reset();
|
|
971 |
outList->Reset();
|
|
972 |
return iResult;
|
|
973 |
}
|
|
974 |
|
|
975 |
|
|
976 |
TInt CTestProvider :: AddContact(CStifItemParser& /*aItem */)
|
|
977 |
{
|
|
978 |
|
|
979 |
iResult = KErrGeneral;
|
|
980 |
iCase = EAddContact;
|
|
981 |
LoadService();
|
|
982 |
|
|
983 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
|
|
984 |
|
|
985 |
CLiwDefaultMap* fieldMap = CLiwDefaultMap::NewL();
|
|
986 |
TInt pos = 0;
|
|
987 |
fieldMap->InsertL(KFieldLabel,TLiwVariant(_L("firstname")));
|
|
988 |
|
|
989 |
fieldMap->InsertL(KFieldValue,TLiwVariant(_L("Johnny")));
|
|
990 |
//pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb")));
|
|
991 |
|
|
992 |
|
|
993 |
pMap->InsertL(KContactId, TLiwVariant( _L("")));
|
|
994 |
pMap->InsertL(KFirstName, TLiwVariant(fieldMap));
|
|
995 |
|
|
996 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact")));
|
|
997 |
const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); ;
|
|
998 |
|
|
999 |
inList ->AppendL( paramContentType );
|
|
1000 |
inList ->AppendL( paramAddData );
|
|
1001 |
|
|
1002 |
iIface->ExecuteCmdL(KCmdAdd, *inList, *outList, KLiwOptASyncronous, this);
|
|
1003 |
|
|
1004 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1005 |
TLiwVariant err = param->Value();
|
|
1006 |
TInt code = err.AsTInt32();
|
|
1007 |
|
|
1008 |
if(code == SErrNone)
|
|
1009 |
{
|
|
1010 |
CActiveScheduler::Start();
|
|
1011 |
}
|
|
1012 |
pMap->DecRef();
|
|
1013 |
fieldMap->DecRef();
|
|
1014 |
fieldMap->DecRef();
|
|
1015 |
|
|
1016 |
inList->Reset();
|
|
1017 |
outList->Reset();
|
|
1018 |
|
|
1019 |
return iResult;
|
|
1020 |
}
|
|
1021 |
|
|
1022 |
|
|
1023 |
TInt CTestProvider :: OrganiseAdd(CStifItemParser& /*aItem */)
|
|
1024 |
{
|
|
1025 |
CStifItemParser* astiff = NULL;
|
|
1026 |
|
|
1027 |
//LoadService();
|
|
1028 |
iResult = KErrGeneral;
|
|
1029 |
iCase = EGetGroup;
|
|
1030 |
|
|
1031 |
GetGroup(*astiff);
|
|
1032 |
iCase = EOrganizeAddcntid;
|
|
1033 |
|
|
1034 |
GetContactALL(*astiff);
|
|
1035 |
|
|
1036 |
iCase = EOrganizeAdd;
|
|
1037 |
|
|
1038 |
|
|
1039 |
//LoadService();
|
|
1040 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
|
|
1041 |
CLiwDefaultList* list = CLiwDefaultList::NewL();
|
|
1042 |
|
|
1043 |
list->AppendL(TLiwVariant(*iCntID));
|
|
1044 |
|
|
1045 |
TInt pos = 0;
|
|
1046 |
|
|
1047 |
//pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb")));
|
|
1048 |
pMap->InsertL(KGroupId, TLiwVariant(iGrpID));
|
|
1049 |
pMap->InsertL(KList, TLiwVariant(list));
|
|
1050 |
|
|
1051 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Group")));
|
|
1052 |
|
|
1053 |
const TLiwGenericParam paramOperationType(KOperationType, TLiwVariant( _L("Associate")));
|
|
1054 |
const TLiwGenericParam paramOrganizeData(KData, TLiwVariant(pMap));
|
|
1055 |
|
|
1056 |
inList ->AppendL( paramContentType );
|
|
1057 |
inList ->AppendL( paramOperationType );
|
|
1058 |
inList ->AppendL( paramOrganizeData );
|
|
1059 |
|
|
1060 |
iIface->ExecuteCmdL(KCmdOrganiseGroups, *inList, *outList, KLiwOptASyncronous, this);
|
|
1061 |
|
|
1062 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1063 |
TLiwVariant err = param->Value();
|
|
1064 |
TInt code = err.AsTInt32();
|
|
1065 |
|
|
1066 |
if(code == SErrNone)
|
|
1067 |
{
|
|
1068 |
CActiveScheduler::Start();
|
|
1069 |
}
|
|
1070 |
|
|
1071 |
pMap->DecRef();
|
|
1072 |
list->DecRef();
|
|
1073 |
list->DecRef();
|
|
1074 |
|
|
1075 |
inList->Reset();
|
|
1076 |
outList->Reset();
|
|
1077 |
return iResult;
|
|
1078 |
}
|
|
1079 |
|
|
1080 |
TInt CTestProvider :: OrganiseDelete(CStifItemParser& /*aItem */)
|
|
1081 |
{
|
|
1082 |
CStifItemParser* astiff = NULL ;
|
|
1083 |
|
|
1084 |
//LoadService();
|
|
1085 |
iResult = KErrGeneral;
|
|
1086 |
iCase = EGetGroup;
|
|
1087 |
|
|
1088 |
GetGroup(*astiff);
|
|
1089 |
iCase = EOrganizeDelete;
|
|
1090 |
|
|
1091 |
|
|
1092 |
|
|
1093 |
//LoadService();
|
|
1094 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
|
|
1095 |
CLiwDefaultList* list = CLiwDefaultList::NewL();
|
|
1096 |
if(iIdArrayList.Count()>0)
|
|
1097 |
*iCntID = *iIdArrayList[0];
|
|
1098 |
|
|
1099 |
list->AppendL(TLiwVariant(*iCntID));
|
|
1100 |
|
|
1101 |
TInt pos = 0;
|
|
1102 |
|
|
1103 |
//pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb")));
|
|
1104 |
pMap->InsertL(KGroupId, TLiwVariant(iGrpID));
|
|
1105 |
pMap->InsertL(KList, TLiwVariant(list));
|
|
1106 |
|
|
1107 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Group")));
|
|
1108 |
|
|
1109 |
const TLiwGenericParam paramOperationType(KOperationType, TLiwVariant(KDissociate));
|
|
1110 |
const TLiwGenericParam paramOrganizeData(KData, TLiwVariant(pMap));
|
|
1111 |
|
|
1112 |
inList ->AppendL( paramContentType );
|
|
1113 |
inList ->AppendL( paramOperationType );
|
|
1114 |
inList ->AppendL( paramOrganizeData );
|
|
1115 |
|
|
1116 |
iIface->ExecuteCmdL(KCmdOrganiseGroups, *inList, *outList, KLiwOptASyncronous, this);
|
|
1117 |
|
|
1118 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1119 |
TLiwVariant err = param->Value();
|
|
1120 |
TInt code = err.AsTInt32();
|
|
1121 |
|
|
1122 |
if(code == SErrNone)
|
|
1123 |
{
|
|
1124 |
CActiveScheduler::Start();
|
|
1125 |
}
|
|
1126 |
inList->Reset();
|
|
1127 |
outList->Reset();
|
|
1128 |
pMap->DecRef();
|
|
1129 |
return iResult;
|
|
1130 |
}
|
|
1131 |
|
|
1132 |
|
|
1133 |
TInt CTestProvider :: ModifyContact(CStifItemParser& aItem )
|
|
1134 |
{
|
|
1135 |
/**The testing logic goes this way first load the contact service.
|
|
1136 |
*Then,get one contact id by using getlist api, this call GetContactALL(aItem); does that.
|
|
1137 |
*change the first name and add it again(do operatoin for edit).
|
|
1138 |
*call the getlist api using the same contact id this time.
|
|
1139 |
*check for the changed first name.
|
|
1140 |
*/
|
|
1141 |
//load the service
|
|
1142 |
LoadService();
|
|
1143 |
iCase = EModifyContact;
|
|
1144 |
//get the contact to be modified the contact is retrieved in the callback HandleNotifyL
|
|
1145 |
GetContactALL(aItem);
|
|
1146 |
//get the contact to be modified the contact is retrieved in the callback HandleNotifyL
|
|
1147 |
iResult = KErrGeneral;
|
|
1148 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
|
|
1149 |
|
|
1150 |
CLiwDefaultMap* fieldMap = CLiwDefaultMap::NewL();
|
|
1151 |
TInt pos = 0;
|
|
1152 |
fieldMap->InsertL(KFieldLabel,TLiwVariant(_L("firstname")));
|
|
1153 |
|
|
1154 |
fieldMap->InsertL(KFieldValue,TLiwVariant(_L("Modified Arnold")));
|
|
1155 |
//pMap->InsertL(KDBUri, TLiwVariant( _L("")));
|
|
1156 |
|
|
1157 |
|
|
1158 |
pMap->InsertL(KContactId, TLiwVariant(iCntID));
|
|
1159 |
pMap->InsertL(KFirstName, TLiwVariant(fieldMap));
|
|
1160 |
|
|
1161 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact")));
|
|
1162 |
const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); ;
|
|
1163 |
|
|
1164 |
inList ->AppendL( paramContentType );
|
|
1165 |
inList ->AppendL( paramAddData );
|
|
1166 |
|
|
1167 |
|
|
1168 |
iIface->ExecuteCmdL(KCmdAdd, *inList, *outList, KLiwOptASyncronous, this);
|
|
1169 |
|
|
1170 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1171 |
TLiwVariant err = param->Value();
|
|
1172 |
TInt code = err.AsTInt32();
|
|
1173 |
//change the case to verify the operation.
|
|
1174 |
iCase = EModifyContactComplete;
|
|
1175 |
if(code == SErrNone)
|
|
1176 |
{
|
|
1177 |
CActiveScheduler::Start();
|
|
1178 |
}
|
|
1179 |
pMap->DecRef();
|
|
1180 |
fieldMap->DecRef();
|
|
1181 |
fieldMap->DecRef();
|
|
1182 |
|
|
1183 |
inList->Reset();
|
|
1184 |
outList->Reset();
|
|
1185 |
|
|
1186 |
return iResult;
|
|
1187 |
}
|
|
1188 |
|
|
1189 |
|
|
1190 |
|
|
1191 |
TInt CTestProvider :: GetGroup(CStifItemParser & /*aItem */)
|
|
1192 |
{
|
|
1193 |
AddOneGroupL(_L("Test"));
|
|
1194 |
iResult = KErrGeneral;
|
|
1195 |
iIdArrayList.ResetAndDestroy();
|
|
1196 |
if(iCase != EVerifyGroupAdd && iCase != EVerifyOrganizeDelete)
|
|
1197 |
{
|
|
1198 |
LoadService();
|
|
1199 |
iCase = EGetGroup;
|
|
1200 |
}
|
|
1201 |
|
|
1202 |
TInt pos = 0;
|
|
1203 |
inList->Reset();
|
|
1204 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Group")));
|
|
1205 |
inList ->AppendL( paramContentType );
|
|
1206 |
iIface->ExecuteCmdL(KCmdGetList, *inList, *outList, KLiwOptASyncronous, this);
|
|
1207 |
|
|
1208 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1209 |
TLiwVariant err = param->Value();
|
|
1210 |
TInt code = err.AsTInt32();
|
|
1211 |
|
|
1212 |
inList->Reset();
|
|
1213 |
outList->Reset();
|
|
1214 |
|
|
1215 |
if(code == SErrNone)
|
|
1216 |
{
|
|
1217 |
CActiveScheduler::Start();
|
|
1218 |
}
|
|
1219 |
return iResult;
|
|
1220 |
}
|
|
1221 |
|
|
1222 |
|
|
1223 |
TInt CTestProvider :: GetDatabase(CStifItemParser& /*aItem*/)
|
|
1224 |
{
|
|
1225 |
iResult = KErrGeneral;
|
|
1226 |
LoadService();
|
|
1227 |
TInt pos = 0;
|
|
1228 |
iCase = EGetDatabase;
|
|
1229 |
|
|
1230 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Database")));
|
|
1231 |
inList ->AppendL( paramContentType );
|
|
1232 |
|
|
1233 |
iIface->ExecuteCmdL(KCmdGetList, *inList, *outList, KLiwOptASyncronous, this);
|
|
1234 |
|
|
1235 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1236 |
TLiwVariant err = param->Value();
|
|
1237 |
TInt code = err.AsTInt32();
|
|
1238 |
|
|
1239 |
pos = 0;
|
|
1240 |
TLiwVariant dbname;
|
|
1241 |
TLiwVariant entry;
|
|
1242 |
const CLiwMap* map = NULL;
|
|
1243 |
|
|
1244 |
param = outList->FindFirst(pos, KReturnValue);
|
|
1245 |
TLiwVariant iterator = param->Value();
|
|
1246 |
CLiwIterable* iter = iterator.AsIterable();
|
|
1247 |
|
|
1248 |
while(iter->NextL(entry))
|
|
1249 |
{
|
|
1250 |
map = entry.AsMap();
|
|
1251 |
|
|
1252 |
map->FindL(KDBUri, dbname);
|
|
1253 |
TPtrC dbNmae = dbname.AsDes();
|
|
1254 |
if(dbNmae == _L("cntdb://c:contacts.cdb"))
|
|
1255 |
{
|
|
1256 |
iResult = KErrNone;
|
|
1257 |
break;
|
|
1258 |
}
|
|
1259 |
|
|
1260 |
}
|
|
1261 |
|
|
1262 |
|
|
1263 |
inList->Reset();
|
|
1264 |
outList->Reset();
|
|
1265 |
|
|
1266 |
return iResult ;
|
|
1267 |
}
|
|
1268 |
|
|
1269 |
TInt CTestProvider :: ModifyGroup(CStifItemParser& /*aItem*/)
|
|
1270 |
{
|
|
1271 |
}
|
|
1272 |
|
|
1273 |
TInt CTestProvider :: ExportL( CStifItemParser& aItem )
|
|
1274 |
{
|
|
1275 |
iCase = EDeleteContact;
|
|
1276 |
|
|
1277 |
iResult = KErrGeneral;
|
|
1278 |
LoadService();
|
|
1279 |
GetContactALL(aItem);
|
|
1280 |
|
|
1281 |
iCase = EExportVcard;
|
|
1282 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
|
|
1283 |
|
|
1284 |
TInt ferr = iFileHandle.Open(iFSession,_L("c:\\vcardExport.vcf"),EFileRead | EFileWrite );
|
|
1285 |
|
|
1286 |
if( KErrNone == ferr )
|
|
1287 |
{
|
|
1288 |
iFileHandle.Close();
|
|
1289 |
|
|
1290 |
iFSession.Delete(_L("c:\\vcardExport.vcf"));
|
|
1291 |
}
|
|
1292 |
TInt pos = 0;
|
|
1293 |
TBuf<255> cntIdunicode;
|
|
1294 |
cntIdunicode.Copy(*iCntID);
|
|
1295 |
pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb")));
|
|
1296 |
pMap->InsertL(KContactId, TLiwVariant(cntIdunicode));
|
|
1297 |
|
|
1298 |
pMap->InsertL(KDestFileNameParam, TLiwVariant( _L("c:\\vcardExport.vcf")));
|
|
1299 |
|
|
1300 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact")));
|
|
1301 |
const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap));
|
|
1302 |
|
|
1303 |
inList ->AppendL( paramContentType );
|
|
1304 |
inList ->AppendL( paramAddData );
|
|
1305 |
|
|
1306 |
iIface->ExecuteCmdL(KCmdExport, *inList, *outList, KLiwOptASyncronous, this);
|
|
1307 |
|
|
1308 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1309 |
TLiwVariant err = param->Value();
|
|
1310 |
TInt code = err.AsTInt32();
|
|
1311 |
|
|
1312 |
if(code == SErrNone)
|
|
1313 |
{
|
|
1314 |
CActiveScheduler::Start();
|
|
1315 |
}
|
|
1316 |
inList->Reset();
|
|
1317 |
outList->Reset();
|
|
1318 |
pMap->DecRef();
|
|
1319 |
return iResult;
|
|
1320 |
|
|
1321 |
|
|
1322 |
}
|
|
1323 |
TInt CTestProvider :: ImportL(CStifItemParser& /*aItem*/)
|
|
1324 |
{
|
|
1325 |
iResult = KErrGeneral;
|
|
1326 |
LoadService();
|
|
1327 |
iCase = EImportVcard;
|
|
1328 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
|
|
1329 |
|
|
1330 |
TInt pos = 0;
|
|
1331 |
|
|
1332 |
pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb")));
|
|
1333 |
|
|
1334 |
pMap->InsertL(KSourceFileNameParam, TLiwVariant( _L("c:\\vcardimport.vcf")));
|
|
1335 |
|
|
1336 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact")));
|
|
1337 |
const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap));
|
|
1338 |
|
|
1339 |
inList ->AppendL( paramContentType );
|
|
1340 |
inList ->AppendL( paramAddData );
|
|
1341 |
|
|
1342 |
iIface->ExecuteCmdL(KCmdImport, *inList, *outList, KLiwOptASyncronous, this);
|
|
1343 |
|
|
1344 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1345 |
TLiwVariant err = param->Value();
|
|
1346 |
TInt code = err.AsTInt32();
|
|
1347 |
|
|
1348 |
if(code == SErrNone)
|
|
1349 |
{
|
|
1350 |
CActiveScheduler::Start();
|
|
1351 |
}
|
|
1352 |
inList->Reset();
|
|
1353 |
outList->Reset();
|
|
1354 |
pMap->DecRef();
|
|
1355 |
return iResult;
|
|
1356 |
}
|
|
1357 |
|
|
1358 |
TInt CTestProvider :: DeleteContact(CStifItemParser& /*aItem*/)
|
|
1359 |
{
|
|
1360 |
iCase = EDeleteContact;
|
|
1361 |
LoadService();
|
|
1362 |
TInt pos = 0;
|
|
1363 |
CLiwMap* mapContactId = CLiwDefaultMap::NewL();
|
|
1364 |
//iCase = EGetAllContacts;
|
|
1365 |
//const TLiwGenericParam paramGetListSortOrder;
|
|
1366 |
|
|
1367 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact")));
|
|
1368 |
inList ->AppendL( paramContentType );
|
|
1369 |
iIface->ExecuteCmdL(KCmdGetList, *inList, *outList, KLiwOptASyncronous, this);
|
|
1370 |
|
|
1371 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1372 |
TLiwVariant err = param->Value();
|
|
1373 |
TInt code = err.AsTInt32();
|
|
1374 |
|
|
1375 |
inList->Reset();
|
|
1376 |
outList->Reset();
|
|
1377 |
|
|
1378 |
if(code == SErrNone)
|
|
1379 |
{
|
|
1380 |
CActiveScheduler::Start();
|
|
1381 |
}
|
|
1382 |
const TLiwGenericParam paramContent(KType, TLiwVariant( _L("Contact")));
|
|
1383 |
inList ->AppendL( paramContent );
|
|
1384 |
CLiwDefaultList* list = CLiwDefaultList :: NewL();
|
|
1385 |
list->AppendL(TLiwVariant(*iCntID));
|
|
1386 |
mapContactId->InsertL(KDBUri, TLiwVariant(_L("cntdb://c:contacts.cdb")));
|
|
1387 |
mapContactId->InsertL(KList,TLiwVariant(list));
|
|
1388 |
const TLiwGenericParam paramDeleteData(KData, TLiwVariant(mapContactId));
|
|
1389 |
inList ->AppendL( paramDeleteData );
|
|
1390 |
iIface->ExecuteCmdL(KCmdDelete, *inList, *outList, KLiwOptASyncronous, this);
|
|
1391 |
|
|
1392 |
pos = 0;
|
|
1393 |
param = outList->FindFirst( pos, KExitCode );
|
|
1394 |
err = param->Value();
|
|
1395 |
code = err.AsTInt32();
|
|
1396 |
|
|
1397 |
if(code == SErrNone)
|
|
1398 |
{
|
|
1399 |
CActiveScheduler::Start();
|
|
1400 |
}
|
|
1401 |
inList->Reset();
|
|
1402 |
outList->Reset();
|
|
1403 |
mapContactId->DecRef();
|
|
1404 |
list->DecRef();
|
|
1405 |
return iResult;
|
|
1406 |
}
|
|
1407 |
|
|
1408 |
/*
|
|
1409 |
* This is a manual test case were the service was available when the
|
|
1410 |
* request was made and then Lost the service (Contact to location servier lost
|
|
1411 |
*/
|
|
1412 |
|
|
1413 |
|
|
1414 |
TInt CTestProvider :: AddGroup(CStifItemParser& /*aItem*/)
|
|
1415 |
{
|
|
1416 |
LoadService();
|
|
1417 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
|
|
1418 |
iCase = EAddGroup;
|
|
1419 |
TInt pos = 0;
|
|
1420 |
|
|
1421 |
pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb")));
|
|
1422 |
pMap->InsertL(KGroupId, TLiwVariant(_L8("")));
|
|
1423 |
pMap->InsertL(KGroupLabel, TLiwVariant(_L("Test")));
|
|
1424 |
|
|
1425 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Group")));
|
|
1426 |
const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); ;
|
|
1427 |
|
|
1428 |
inList ->AppendL( paramContentType );
|
|
1429 |
inList ->AppendL( paramAddData );
|
|
1430 |
iIface->ExecuteCmdL(KCmdAdd, *inList, *outList, KLiwOptASyncronous, this);
|
|
1431 |
|
|
1432 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1433 |
TLiwVariant err = param->Value();
|
|
1434 |
TInt code = err.AsTInt32();
|
|
1435 |
|
|
1436 |
inList->Reset();
|
|
1437 |
outList->Reset();
|
|
1438 |
|
|
1439 |
if(code == SErrNone)
|
|
1440 |
{
|
|
1441 |
CActiveScheduler::Start();
|
|
1442 |
}
|
|
1443 |
pMap->DecRef();
|
|
1444 |
return iResult;
|
|
1445 |
}
|
|
1446 |
|
|
1447 |
|
|
1448 |
/**
|
|
1449 |
*Cancel test, to test cancel functionality
|
|
1450 |
*/
|
|
1451 |
TInt CTestProvider :: GetContactALLPosBased(CStifItemParser& /*aItem*/)
|
|
1452 |
{
|
|
1453 |
AddOneContactL(_L("Arnold"));
|
|
1454 |
AddOneContactL(_L("Johnny"));
|
|
1455 |
iResult = KErrGeneral;
|
|
1456 |
if(iCase != EOrganizeAddcntid && iCase != EDeleteContact && iCase != EVerifyImport)
|
|
1457 |
{
|
|
1458 |
LoadService();
|
|
1459 |
iCase = EGetAllContacts;
|
|
1460 |
}
|
|
1461 |
|
|
1462 |
TInt pos = 0;
|
|
1463 |
|
|
1464 |
//const TLiwGenericParam paramGetListSortOrder;
|
|
1465 |
|
|
1466 |
const TLiwGenericParam paramContentType(_L8(""), TLiwVariant( _L("Contact")));
|
|
1467 |
inList ->AppendL( paramContentType );
|
|
1468 |
iIface->ExecuteCmdL(KCmdGetList, *inList, *outList, KLiwOptASyncronous, this);
|
|
1469 |
|
|
1470 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1471 |
TLiwVariant err = param->Value();
|
|
1472 |
TInt code = err.AsTInt32();
|
|
1473 |
|
|
1474 |
if(code == SErrNone)
|
|
1475 |
{
|
|
1476 |
CActiveScheduler::Start();
|
|
1477 |
}
|
|
1478 |
inList->Reset();
|
|
1479 |
outList->Reset();
|
|
1480 |
|
|
1481 |
return iResult;
|
|
1482 |
}
|
|
1483 |
|
|
1484 |
TInt CTestProvider :: GetContactSearchPosBased(CStifItemParser& /*aItem*/)
|
|
1485 |
{
|
|
1486 |
AddOneContactL(_L("Johnny"));
|
|
1487 |
_LIT8(KFilter, "Filter");
|
|
1488 |
_LIT8(KSearchVal, "SearchVal");
|
|
1489 |
iResult = KErrGeneral;
|
|
1490 |
LoadService();
|
|
1491 |
TInt pos = 0;
|
|
1492 |
iCase = EGetContactSearch;
|
|
1493 |
|
|
1494 |
//const TLiwGenericParam paramGetListSortOrder;
|
|
1495 |
|
|
1496 |
const TLiwGenericParam paramContentType(_L8(""), TLiwVariant( _L("Contact")));
|
|
1497 |
inList ->AppendL( paramContentType );
|
|
1498 |
|
|
1499 |
CLiwDefaultMap* map = CLiwDefaultMap :: NewL();
|
|
1500 |
CleanupStack::PushL(map);
|
|
1501 |
map->InsertL(KSearchVal,_L("j"));
|
|
1502 |
|
|
1503 |
const TLiwGenericParam paramData(_L8(""), TLiwVariant(map));
|
|
1504 |
inList ->AppendL( paramData );
|
|
1505 |
TInt count = inList->Count();
|
|
1506 |
iIface->ExecuteCmdL(KCmdGetList, *inList, *outList, KLiwOptASyncronous, this);
|
|
1507 |
|
|
1508 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1509 |
TLiwVariant err = param->Value();
|
|
1510 |
TInt code = err.AsTInt32();
|
|
1511 |
|
|
1512 |
if(code == SErrNone)
|
|
1513 |
{
|
|
1514 |
CActiveScheduler::Start();
|
|
1515 |
}
|
|
1516 |
inList->Reset();
|
|
1517 |
outList->Reset();
|
|
1518 |
CleanupStack::Pop(map);
|
|
1519 |
map->DecRef();
|
|
1520 |
return iResult;
|
|
1521 |
}
|
|
1522 |
/**
|
|
1523 |
*Cancel test, to test cancel functionality
|
|
1524 |
*/
|
|
1525 |
TInt CTestProvider :: GetGroupPosBased(CStifItemParser& /*aItem*/)
|
|
1526 |
{
|
|
1527 |
AddOneGroupL(_L("Test"));
|
|
1528 |
iResult = KErrGeneral;
|
|
1529 |
if(iCase != EVerifyGroupAdd && iCase != EVerifyOrganizeDelete)
|
|
1530 |
{
|
|
1531 |
LoadService();
|
|
1532 |
iCase = EGetGroup;
|
|
1533 |
}
|
|
1534 |
|
|
1535 |
TInt pos = 0;
|
|
1536 |
|
|
1537 |
const TLiwGenericParam paramContentType(_L8(""), TLiwVariant( _L("Group")));
|
|
1538 |
inList ->AppendL( paramContentType );
|
|
1539 |
iIface->ExecuteCmdL(KCmdGetList, *inList, *outList, KLiwOptASyncronous, this);
|
|
1540 |
|
|
1541 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1542 |
TLiwVariant err = param->Value();
|
|
1543 |
TInt code = err.AsTInt32();
|
|
1544 |
|
|
1545 |
inList->Reset();
|
|
1546 |
outList->Reset();
|
|
1547 |
|
|
1548 |
if(code == SErrNone)
|
|
1549 |
{
|
|
1550 |
CActiveScheduler::Start();
|
|
1551 |
}
|
|
1552 |
return iResult;
|
|
1553 |
}
|
|
1554 |
|
|
1555 |
/**
|
|
1556 |
*Cancel test, with wrong notification
|
|
1557 |
*/
|
|
1558 |
TInt CTestProvider :: GetDatabasePosBased(CStifItemParser& /*aItem*/)
|
|
1559 |
{
|
|
1560 |
iResult = KErrGeneral;
|
|
1561 |
LoadService();
|
|
1562 |
TInt pos = 0;
|
|
1563 |
iCase = EGetDatabase;
|
|
1564 |
|
|
1565 |
const TLiwGenericParam paramContentType(_L8(""), TLiwVariant( _L("Database")));
|
|
1566 |
inList ->AppendL( paramContentType );
|
|
1567 |
|
|
1568 |
iIface->ExecuteCmdL(KCmdGetList, *inList, *outList, KLiwOptASyncronous, this);
|
|
1569 |
|
|
1570 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1571 |
TLiwVariant err = param->Value();
|
|
1572 |
TInt code = err.AsTInt32();
|
|
1573 |
|
|
1574 |
pos = 0;
|
|
1575 |
TLiwVariant dbname;
|
|
1576 |
TLiwVariant entry;
|
|
1577 |
const CLiwMap* map = NULL;
|
|
1578 |
|
|
1579 |
param = outList->FindFirst(pos, KReturnValue);
|
|
1580 |
TLiwVariant iterator = param->Value();
|
|
1581 |
CLiwIterable* iter = iterator.AsIterable();
|
|
1582 |
|
|
1583 |
while(iter->NextL(entry))
|
|
1584 |
{
|
|
1585 |
map = entry.AsMap();
|
|
1586 |
|
|
1587 |
map->FindL(KDBUri, dbname);
|
|
1588 |
TPtrC dbNmae = dbname.AsDes();
|
|
1589 |
if(dbNmae == _L("cntdb://c:contacts.cdb"))
|
|
1590 |
{
|
|
1591 |
iResult = KErrNone;
|
|
1592 |
break;
|
|
1593 |
}
|
|
1594 |
|
|
1595 |
}
|
|
1596 |
|
|
1597 |
inList->Reset();
|
|
1598 |
outList->Reset();
|
|
1599 |
|
|
1600 |
return iResult ;
|
|
1601 |
|
|
1602 |
}
|
|
1603 |
|
|
1604 |
|
|
1605 |
|
|
1606 |
/**
|
|
1607 |
*Cancel test, with wrong notification issues a Trace request and then calls for getlocation
|
|
1608 |
* cancellation
|
|
1609 |
*/
|
|
1610 |
TInt CTestProvider :: AddContactPosBased(CStifItemParser& /*aItem*/)
|
|
1611 |
{
|
|
1612 |
iResult = KErrGeneral;
|
|
1613 |
iCase = EAddContact;
|
|
1614 |
LoadService();
|
|
1615 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
|
|
1616 |
CLiwDefaultMap* fieldMap = CLiwDefaultMap::NewL();
|
|
1617 |
TInt pos = 0;
|
|
1618 |
fieldMap->InsertL(KFieldLabel,TLiwVariant(_L("firstname")));
|
|
1619 |
fieldMap->InsertL(KFieldValue,TLiwVariant(_L("Arnold")));
|
|
1620 |
pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb")));
|
|
1621 |
|
|
1622 |
pMap->InsertL(KContactId, TLiwVariant( _L("")));
|
|
1623 |
pMap->InsertL(KFirstName, TLiwVariant(fieldMap));
|
|
1624 |
|
|
1625 |
const TLiwGenericParam paramContentType(_L8(""), TLiwVariant( _L("Contact")));
|
|
1626 |
const TLiwGenericParam paramAddData(_L8(""), TLiwVariant(pMap)); ;
|
|
1627 |
|
|
1628 |
inList ->AppendL( paramContentType );
|
|
1629 |
inList ->AppendL( paramAddData );
|
|
1630 |
iIface->ExecuteCmdL(KCmdAdd, *inList, *outList, KLiwOptASyncronous, this);
|
|
1631 |
|
|
1632 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1633 |
TLiwVariant err = param->Value();
|
|
1634 |
TInt code = err.AsTInt32();
|
|
1635 |
|
|
1636 |
if(code == SErrNone)
|
|
1637 |
{
|
|
1638 |
|
|
1639 |
CActiveScheduler::Start();
|
|
1640 |
}
|
|
1641 |
inList->Reset();
|
|
1642 |
outList->Reset();
|
|
1643 |
pMap->DecRef();
|
|
1644 |
fieldMap->DecRef();
|
|
1645 |
return iResult;
|
|
1646 |
}
|
|
1647 |
|
|
1648 |
|
|
1649 |
TInt CTestProvider :: AddGroupPosBased(CStifItemParser& /*aItem*/)
|
|
1650 |
{
|
|
1651 |
LoadService();
|
|
1652 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
|
|
1653 |
iCase = EAddGroup;
|
|
1654 |
TInt pos = 0;
|
|
1655 |
|
|
1656 |
pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb")));
|
|
1657 |
pMap->InsertL(KGroupId, TLiwVariant(_L8("")));
|
|
1658 |
pMap->InsertL(KGroupLabel, TLiwVariant(_L("Test")));
|
|
1659 |
|
|
1660 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Group")));
|
|
1661 |
const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); ;
|
|
1662 |
|
|
1663 |
inList ->AppendL( paramContentType );
|
|
1664 |
inList ->AppendL( paramAddData );
|
|
1665 |
iIface->ExecuteCmdL(KCmdAdd, *inList, *outList, KLiwOptASyncronous, this);
|
|
1666 |
|
|
1667 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1668 |
TLiwVariant err = param->Value();
|
|
1669 |
TInt code = err.AsTInt32();
|
|
1670 |
|
|
1671 |
inList->Reset();
|
|
1672 |
outList->Reset();
|
|
1673 |
|
|
1674 |
if(code == SErrNone)
|
|
1675 |
{
|
|
1676 |
CActiveScheduler::Start();
|
|
1677 |
}
|
|
1678 |
pMap->DecRef();
|
|
1679 |
return iResult;
|
|
1680 |
}
|
|
1681 |
|
|
1682 |
/**
|
|
1683 |
*Cancel test, Normal cancel test for getlocation
|
|
1684 |
*/
|
|
1685 |
TInt CTestProvider :: DeleteContactPosBased(CStifItemParser& /*aItem*/)
|
|
1686 |
{
|
|
1687 |
iCase = EDeleteContact;
|
|
1688 |
LoadService();
|
|
1689 |
TInt pos = 0;
|
|
1690 |
CLiwMap* mapContactId = CLiwDefaultMap::NewL();
|
|
1691 |
//iCase = EGetAllContacts;
|
|
1692 |
//const TLiwGenericParam paramGetListSortOrder;
|
|
1693 |
|
|
1694 |
const TLiwGenericParam paramContentType(_L8(""), TLiwVariant( _L("Contact")));
|
|
1695 |
inList ->AppendL( paramContentType );
|
|
1696 |
iIface->ExecuteCmdL(KCmdGetList, *inList, *outList, KLiwOptASyncronous, this);
|
|
1697 |
|
|
1698 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1699 |
TLiwVariant err = param->Value();
|
|
1700 |
TInt code = err.AsTInt32();
|
|
1701 |
|
|
1702 |
inList->Reset();
|
|
1703 |
outList->Reset();
|
|
1704 |
|
|
1705 |
if(code == SErrNone)
|
|
1706 |
{
|
|
1707 |
CActiveScheduler::Start();
|
|
1708 |
}
|
|
1709 |
const TLiwGenericParam paramContent(_L8(""), TLiwVariant( _L("Contact")));
|
|
1710 |
inList ->AppendL( paramContent );
|
|
1711 |
CLiwDefaultList* list = CLiwDefaultList :: NewL();
|
|
1712 |
list->AppendL(TLiwVariant(*iCntID));
|
|
1713 |
mapContactId->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb")));
|
|
1714 |
mapContactId->InsertL(KList,TLiwVariant(list));
|
|
1715 |
const TLiwGenericParam paramDeleteData(_L8(""), TLiwVariant(mapContactId));
|
|
1716 |
inList ->AppendL( paramDeleteData );
|
|
1717 |
|
|
1718 |
iIface->ExecuteCmdL(KCmdDelete, *inList, *outList, KLiwOptASyncronous, this);
|
|
1719 |
|
|
1720 |
pos = 0;
|
|
1721 |
param = outList->FindFirst( pos, KExitCode );
|
|
1722 |
err = param->Value();
|
|
1723 |
code = err.AsTInt32();
|
|
1724 |
|
|
1725 |
if(code == SErrNone)
|
|
1726 |
{
|
|
1727 |
CActiveScheduler::Start();
|
|
1728 |
}
|
|
1729 |
mapContactId->DecRef();
|
|
1730 |
inList->Reset();
|
|
1731 |
outList->Reset();
|
|
1732 |
list->DecRef();
|
|
1733 |
return iResult;
|
|
1734 |
}
|
|
1735 |
|
|
1736 |
/**
|
|
1737 |
* GetLocation Timeout
|
|
1738 |
*/
|
|
1739 |
TInt CTestProvider :: OrganiseAddPosBased(CStifItemParser& /*aItem*/)
|
|
1740 |
{
|
|
1741 |
AddOneContactL(_L("Arnold"));
|
|
1742 |
AddOneContactL(_L("Johnny"));
|
|
1743 |
|
|
1744 |
AddOneGroupL(_L("Test"));
|
|
1745 |
|
|
1746 |
CStifItemParser* astiff = NULL ;
|
|
1747 |
|
|
1748 |
//LoadService();
|
|
1749 |
iResult = KErrGeneral;
|
|
1750 |
iCase = EGetGroup;
|
|
1751 |
|
|
1752 |
GetGroup(*astiff);
|
|
1753 |
iCase = EOrganizeAddcntid;
|
|
1754 |
|
|
1755 |
GetContactALL(*astiff);
|
|
1756 |
|
|
1757 |
iCase = EOrganizeAdd;
|
|
1758 |
|
|
1759 |
|
|
1760 |
//LoadService();
|
|
1761 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
|
|
1762 |
CLiwDefaultList* list = CLiwDefaultList::NewL();
|
|
1763 |
|
|
1764 |
list->AppendL(TLiwVariant(*iCntID));
|
|
1765 |
|
|
1766 |
TInt pos = 0;
|
|
1767 |
|
|
1768 |
//pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb")));
|
|
1769 |
pMap->InsertL(KGroupId, TLiwVariant(iGrpID));
|
|
1770 |
pMap->InsertL(KList, TLiwVariant(list));
|
|
1771 |
|
|
1772 |
const TLiwGenericParam paramContentType(_L8(""), TLiwVariant( _L("Group")));
|
|
1773 |
|
|
1774 |
const TLiwGenericParam paramOperationType(_L8(""), TLiwVariant( _L("Associate")));
|
|
1775 |
const TLiwGenericParam paramOrganizeData(_L8(""), TLiwVariant(pMap));
|
|
1776 |
|
|
1777 |
inList ->AppendL( paramContentType );
|
|
1778 |
inList ->AppendL( paramOrganizeData );
|
|
1779 |
inList ->AppendL( paramOperationType );
|
|
1780 |
|
|
1781 |
|
|
1782 |
iIface->ExecuteCmdL(KCmdOrganiseGroups, *inList, *outList, KLiwOptASyncronous, this);
|
|
1783 |
|
|
1784 |
|
|
1785 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1786 |
TLiwVariant err = param->Value();
|
|
1787 |
TInt code = err.AsTInt32();
|
|
1788 |
|
|
1789 |
if(code == SErrNone)
|
|
1790 |
{
|
|
1791 |
CActiveScheduler::Start();
|
|
1792 |
}
|
|
1793 |
pMap->DecRef();
|
|
1794 |
list->DecRef();
|
|
1795 |
list->DecRef();
|
|
1796 |
|
|
1797 |
inList->Reset();
|
|
1798 |
outList->Reset();
|
|
1799 |
return iResult;
|
|
1800 |
}
|
|
1801 |
|
|
1802 |
/**
|
|
1803 |
*Normal Trace cancell test.
|
|
1804 |
*/
|
|
1805 |
TInt CTestProvider :: OrganiseDeletePosbased(CStifItemParser& /*aItem*/)
|
|
1806 |
{
|
|
1807 |
AddOneGroupL(_L("Test"));
|
|
1808 |
CStifItemParser* astiff = NULL ;
|
|
1809 |
|
|
1810 |
//LoadService();
|
|
1811 |
iResult = KErrGeneral;
|
|
1812 |
iCase = EGetGroup;
|
|
1813 |
|
|
1814 |
GetGroup(*astiff);
|
|
1815 |
iCase = EOrganizeDelete;
|
|
1816 |
|
|
1817 |
|
|
1818 |
|
|
1819 |
//LoadService();
|
|
1820 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
|
|
1821 |
CLiwDefaultList* list = CLiwDefaultList::NewL();
|
|
1822 |
if(iIdArrayList.Count()>0)
|
|
1823 |
*iCntID = *iIdArrayList[0];
|
|
1824 |
|
|
1825 |
list->AppendL(TLiwVariant(*iCntID));
|
|
1826 |
|
|
1827 |
TInt pos = 0;
|
|
1828 |
|
|
1829 |
//pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb")));
|
|
1830 |
pMap->InsertL(KGroupId, TLiwVariant(iGrpID));
|
|
1831 |
pMap->InsertL(KList, TLiwVariant(list));
|
|
1832 |
|
|
1833 |
const TLiwGenericParam paramContentType(_L8(""), TLiwVariant( _L("Group")));
|
|
1834 |
|
|
1835 |
const TLiwGenericParam paramOperationType(_L8(""), TLiwVariant(KDissociate));
|
|
1836 |
const TLiwGenericParam paramOrganizeData(_L8(""), TLiwVariant(pMap));
|
|
1837 |
|
|
1838 |
inList ->AppendL( paramContentType );
|
|
1839 |
inList ->AppendL( paramOrganizeData );
|
|
1840 |
inList ->AppendL( paramOperationType );
|
|
1841 |
|
|
1842 |
|
|
1843 |
iIface->ExecuteCmdL(KCmdOrganiseGroups, *inList, *outList, KLiwOptASyncronous, this);
|
|
1844 |
|
|
1845 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1846 |
TLiwVariant err = param->Value();
|
|
1847 |
TInt code = err.AsTInt32();
|
|
1848 |
|
|
1849 |
if(code == SErrNone)
|
|
1850 |
{
|
|
1851 |
CActiveScheduler::Start();
|
|
1852 |
}
|
|
1853 |
inList->Reset();
|
|
1854 |
outList->Reset();
|
|
1855 |
pMap->DecRef();
|
|
1856 |
list->DecRef();
|
|
1857 |
return iResult;
|
|
1858 |
}
|
|
1859 |
|
|
1860 |
/**
|
|
1861 |
*Math Operation Find distance : Position based parameter
|
|
1862 |
*/
|
|
1863 |
TInt CTestProvider :: ModifyContactPosBased(CStifItemParser& /*aItem*/)
|
|
1864 |
{
|
|
1865 |
|
|
1866 |
}
|
|
1867 |
/**
|
|
1868 |
* Math operation BearingTo Test
|
|
1869 |
*/
|
|
1870 |
|
|
1871 |
TInt CTestProvider ::ModifyGroupPosBased(CStifItemParser& /*aItem*/)
|
|
1872 |
{
|
|
1873 |
}
|
|
1874 |
|
|
1875 |
TInt CTestProvider :: ExportPosBased(CStifItemParser& aItem)
|
|
1876 |
{
|
|
1877 |
AddOneContactL(_L("Arnold"));
|
|
1878 |
AddOneContactL(_L("Johnny"));
|
|
1879 |
iCase = EDeleteContact;
|
|
1880 |
|
|
1881 |
iResult = KErrGeneral;
|
|
1882 |
LoadService();
|
|
1883 |
GetContactALL(aItem);
|
|
1884 |
|
|
1885 |
TInt ferr = iFileHandle.Open(iFSession,_L("c:\\vcardExportposbased.vcf"),EFileRead | EFileWrite );
|
|
1886 |
|
|
1887 |
if( KErrNone == ferr )
|
|
1888 |
{
|
|
1889 |
iFileHandle.Close();
|
|
1890 |
|
|
1891 |
iFSession.Delete(_L("c:\\vcardExportposbased.vcf"));
|
|
1892 |
}
|
|
1893 |
|
|
1894 |
iCase = EExportVcard;
|
|
1895 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
|
|
1896 |
|
|
1897 |
TInt pos = 0;
|
|
1898 |
|
|
1899 |
pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb")));
|
|
1900 |
pMap->InsertL(KContactId, TLiwVariant(*iCntID));
|
|
1901 |
|
|
1902 |
pMap->InsertL(KDestFileNameParam, TLiwVariant( _L("c:\\vcardExportposbased.vcf")));
|
|
1903 |
|
|
1904 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact")));
|
|
1905 |
const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap));
|
|
1906 |
|
|
1907 |
inList ->AppendL( paramContentType );
|
|
1908 |
inList ->AppendL( paramAddData );
|
|
1909 |
|
|
1910 |
iIface->ExecuteCmdL(KCmdExport, *inList, *outList, KLiwOptASyncronous, this);
|
|
1911 |
|
|
1912 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1913 |
TLiwVariant err = param->Value();
|
|
1914 |
TInt code = err.AsTInt32();
|
|
1915 |
|
|
1916 |
if(code == SErrNone)
|
|
1917 |
{
|
|
1918 |
CActiveScheduler::Start();
|
|
1919 |
}
|
|
1920 |
inList->Reset();
|
|
1921 |
outList->Reset();
|
|
1922 |
pMap->DecRef();
|
|
1923 |
return iResult;
|
|
1924 |
}
|
|
1925 |
/**
|
|
1926 |
* Math operation BearingTo Test
|
|
1927 |
*/
|
|
1928 |
|
|
1929 |
TInt CTestProvider ::ImportPosBased(CStifItemParser& /*aItem*/)
|
|
1930 |
{
|
|
1931 |
iIdArrayList.ResetAndDestroy();
|
|
1932 |
iResult = KErrGeneral;
|
|
1933 |
LoadService();
|
|
1934 |
iCase = EImportVcard;
|
|
1935 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
|
|
1936 |
|
|
1937 |
TInt pos = 0;
|
|
1938 |
|
|
1939 |
pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb")));
|
|
1940 |
|
|
1941 |
pMap->InsertL(KSourceFileNameParam, TLiwVariant( _L("c:\\vcardimport.vcf")));
|
|
1942 |
|
|
1943 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact")));
|
|
1944 |
const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap));
|
|
1945 |
|
|
1946 |
inList ->AppendL( paramContentType );
|
|
1947 |
inList ->AppendL( paramAddData );
|
|
1948 |
|
|
1949 |
iIface->ExecuteCmdL(KCmdImport, *inList, *outList, KLiwOptASyncronous, this);
|
|
1950 |
|
|
1951 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1952 |
TLiwVariant err = param->Value();
|
|
1953 |
TInt code = err.AsTInt32();
|
|
1954 |
|
|
1955 |
if(code == SErrNone)
|
|
1956 |
{
|
|
1957 |
CActiveScheduler::Start();
|
|
1958 |
}
|
|
1959 |
inList->Reset();
|
|
1960 |
outList->Reset();
|
|
1961 |
pMap->DecRef();
|
|
1962 |
return iResult;
|
|
1963 |
|
|
1964 |
|
|
1965 |
}
|
|
1966 |
|
|
1967 |
|
|
1968 |
|
|
1969 |
TInt CTestProvider ::CancelGetList(CStifItemParser& /*aItem*/)
|
|
1970 |
{
|
|
1971 |
AddOneContactL(_L("Arnold"));
|
|
1972 |
AddOneContactL(_L("Johnny"));
|
|
1973 |
iResult = KErrGeneral;
|
|
1974 |
if(iCase != EOrganizeAddcntid && iCase != EDeleteContact && iCase != EVerifyImport)
|
|
1975 |
{
|
|
1976 |
LoadService();
|
|
1977 |
iCase = EGetAllContacts;
|
|
1978 |
}
|
|
1979 |
|
|
1980 |
TInt pos = 0;
|
|
1981 |
|
|
1982 |
//const TLiwGenericParam paramGetListSortOrder;
|
|
1983 |
|
|
1984 |
const TLiwGenericParam paramContentType(_L8(""), TLiwVariant( _L("Contact")));
|
|
1985 |
inList ->AppendL( paramContentType );
|
|
1986 |
iIface->ExecuteCmdL(KCmdGetList, *inList, *outList, KLiwOptASyncronous, this);
|
|
1987 |
|
|
1988 |
|
|
1989 |
|
|
1990 |
// const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
1991 |
//TLiwVariant err = param->Value();
|
|
1992 |
//TInt code = err.AsTInt32();
|
|
1993 |
|
|
1994 |
// if(code == SErrNone)
|
|
1995 |
|
|
1996 |
const TLiwGenericParam* param = outList->FindFirst(pos, KTransactionID);
|
|
1997 |
|
|
1998 |
inList->Reset();
|
|
1999 |
outList->Reset();
|
|
2000 |
|
|
2001 |
if (param)
|
|
2002 |
{
|
|
2003 |
TInt32 transid = param->Value().AsTInt32();
|
|
2004 |
|
|
2005 |
TLiwGenericParam paramtransactionId(KTransactionID, TLiwVariant(transid));
|
|
2006 |
|
|
2007 |
|
|
2008 |
inList->AppendL( paramtransactionId );
|
|
2009 |
|
|
2010 |
iCancelled = 1;
|
|
2011 |
iIface->ExecuteCmdL(KCancel, *inList, *outList,KLiwOptCancel, this);
|
|
2012 |
paramtransactionId.Reset();
|
|
2013 |
|
|
2014 |
|
|
2015 |
inList->Reset();
|
|
2016 |
outList->Reset();
|
|
2017 |
|
|
2018 |
// CActiveScheduler::Start();
|
|
2019 |
|
|
2020 |
|
|
2021 |
}
|
|
2022 |
inList->Reset();
|
|
2023 |
outList->Reset();
|
|
2024 |
|
|
2025 |
return iResult;
|
|
2026 |
}
|
|
2027 |
|
|
2028 |
|
|
2029 |
TInt CTestProvider ::CancelAddContact(CStifItemParser& /*aItem*/)
|
|
2030 |
{
|
|
2031 |
// iResult = KErrNone;
|
|
2032 |
iCase = EAddContact;
|
|
2033 |
LoadService();
|
|
2034 |
|
|
2035 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
|
|
2036 |
|
|
2037 |
CLiwDefaultMap* fieldMap = CLiwDefaultMap::NewL();
|
|
2038 |
TInt pos = 0;
|
|
2039 |
fieldMap->InsertL(KFieldLabel,TLiwVariant(_L("firstname")));
|
|
2040 |
|
|
2041 |
fieldMap->InsertL(KFieldValue,TLiwVariant(_L("Johnny")));
|
|
2042 |
//pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb")));
|
|
2043 |
|
|
2044 |
|
|
2045 |
pMap->InsertL(KContactId, TLiwVariant( _L("")));
|
|
2046 |
pMap->InsertL(KFirstName, TLiwVariant(fieldMap));
|
|
2047 |
|
|
2048 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact")));
|
|
2049 |
const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); ;
|
|
2050 |
|
|
2051 |
inList ->AppendL( paramContentType );
|
|
2052 |
inList ->AppendL( paramAddData );
|
|
2053 |
|
|
2054 |
iIface->ExecuteCmdL(KCmdAdd, *inList, *outList, KLiwOptASyncronous, this);
|
|
2055 |
|
|
2056 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
2057 |
TLiwVariant err = param->Value();
|
|
2058 |
TInt code = err.AsTInt32();
|
|
2059 |
|
|
2060 |
if(code == SErrNone)
|
|
2061 |
{
|
|
2062 |
pos = 0;
|
|
2063 |
param = outList->FindFirst(pos, KTransactionID);
|
|
2064 |
if (param)
|
|
2065 |
{
|
|
2066 |
inList->Reset();
|
|
2067 |
outList->Reset();
|
|
2068 |
|
|
2069 |
TInt32 transid = param->Value().AsTInt32();
|
|
2070 |
|
|
2071 |
TLiwGenericParam paramtransactionId(KTransactionID, TLiwVariant(transid));
|
|
2072 |
|
|
2073 |
|
|
2074 |
inList->AppendL( paramtransactionId );
|
|
2075 |
|
|
2076 |
iCancelled = 1;
|
|
2077 |
iIface->ExecuteCmdL(KCancel, *inList, *outList,KLiwOptCancel, this);
|
|
2078 |
paramtransactionId.Reset();
|
|
2079 |
|
|
2080 |
|
|
2081 |
inList->Reset();
|
|
2082 |
outList->Reset();
|
|
2083 |
}
|
|
2084 |
else
|
|
2085 |
{
|
|
2086 |
|
|
2087 |
}
|
|
2088 |
}
|
|
2089 |
pMap->DecRef();
|
|
2090 |
fieldMap->DecRef();
|
|
2091 |
fieldMap->DecRef();
|
|
2092 |
|
|
2093 |
inList->Reset();
|
|
2094 |
outList->Reset();
|
|
2095 |
|
|
2096 |
return iResult;
|
|
2097 |
}
|
|
2098 |
|
|
2099 |
|
|
2100 |
|
|
2101 |
TInt CTestProvider :: CancelOrganiseAdd(CStifItemParser& /*aItem */)
|
|
2102 |
{
|
|
2103 |
CStifItemParser* astiff = NULL;
|
|
2104 |
|
|
2105 |
//LoadService();
|
|
2106 |
iResult = KErrGeneral;
|
|
2107 |
iCase = EGetGroup;
|
|
2108 |
|
|
2109 |
GetGroup(*astiff);
|
|
2110 |
iCase = EOrganizeAddcntid;
|
|
2111 |
|
|
2112 |
GetContactALL(*astiff);
|
|
2113 |
|
|
2114 |
iCase = EOrganizeAdd;
|
|
2115 |
|
|
2116 |
|
|
2117 |
//LoadService();
|
|
2118 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
|
|
2119 |
CLiwDefaultList* list = CLiwDefaultList::NewL();
|
|
2120 |
|
|
2121 |
list->AppendL(TLiwVariant(*iCntID));
|
|
2122 |
|
|
2123 |
TInt pos = 0;
|
|
2124 |
|
|
2125 |
//pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb")));
|
|
2126 |
pMap->InsertL(KGroupId, TLiwVariant(iGrpID));
|
|
2127 |
pMap->InsertL(KList, TLiwVariant(list));
|
|
2128 |
|
|
2129 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Group")));
|
|
2130 |
|
|
2131 |
const TLiwGenericParam paramOperationType(KOperationType, TLiwVariant( _L("Associate")));
|
|
2132 |
const TLiwGenericParam paramOrganizeData(KData, TLiwVariant(pMap));
|
|
2133 |
|
|
2134 |
inList ->AppendL( paramContentType );
|
|
2135 |
inList ->AppendL( paramOperationType );
|
|
2136 |
inList ->AppendL( paramOrganizeData );
|
|
2137 |
|
|
2138 |
iIface->ExecuteCmdL(KCmdOrganiseGroups, *inList, *outList, KLiwOptASyncronous, this);
|
|
2139 |
|
|
2140 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
2141 |
TLiwVariant err = param->Value();
|
|
2142 |
TInt code = err.AsTInt32();
|
|
2143 |
|
|
2144 |
if(code == SErrNone)
|
|
2145 |
{
|
|
2146 |
pos = 0;
|
|
2147 |
param = outList->FindFirst(pos, KTransactionID);
|
|
2148 |
if (param)
|
|
2149 |
{
|
|
2150 |
inList->Reset();
|
|
2151 |
outList->Reset();
|
|
2152 |
|
|
2153 |
TInt32 transid = param->Value().AsTInt32();
|
|
2154 |
|
|
2155 |
TLiwGenericParam paramtransactionId(KTransactionID, TLiwVariant(transid));
|
|
2156 |
|
|
2157 |
|
|
2158 |
inList->AppendL( paramtransactionId );
|
|
2159 |
|
|
2160 |
iCancelled = 1;
|
|
2161 |
iIface->ExecuteCmdL(KCancel, *inList, *outList,KLiwOptCancel, this);
|
|
2162 |
|
|
2163 |
paramtransactionId.Reset();
|
|
2164 |
|
|
2165 |
|
|
2166 |
inList->Reset();
|
|
2167 |
outList->Reset();
|
|
2168 |
}
|
|
2169 |
else
|
|
2170 |
{
|
|
2171 |
|
|
2172 |
}
|
|
2173 |
}
|
|
2174 |
|
|
2175 |
pMap->DecRef();
|
|
2176 |
list->DecRef();
|
|
2177 |
list->DecRef();
|
|
2178 |
|
|
2179 |
inList->Reset();
|
|
2180 |
outList->Reset();
|
|
2181 |
return iResult;
|
|
2182 |
}
|
|
2183 |
|
|
2184 |
TInt CTestProvider :: CancelExportL( CStifItemParser& aItem )
|
|
2185 |
{
|
|
2186 |
iCase = EDeleteContact;
|
|
2187 |
|
|
2188 |
iResult = KErrGeneral;
|
|
2189 |
LoadService();
|
|
2190 |
GetContactALL(aItem);
|
|
2191 |
|
|
2192 |
iCase = EExportVcard;
|
|
2193 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
|
|
2194 |
|
|
2195 |
TInt ferr = iFileHandle.Open(iFSession,_L("c:\\vcardExport.vcf"),EFileRead | EFileWrite );
|
|
2196 |
|
|
2197 |
if( KErrNone == ferr )
|
|
2198 |
{
|
|
2199 |
iFileHandle.Close();
|
|
2200 |
|
|
2201 |
iFSession.Delete(_L("c:\\vcardExport.vcf"));
|
|
2202 |
}
|
|
2203 |
TInt pos = 0;
|
|
2204 |
TBuf<255> cntIdunicode;
|
|
2205 |
cntIdunicode.Copy(*iCntID);
|
|
2206 |
pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb")));
|
|
2207 |
pMap->InsertL(KContactId, TLiwVariant(cntIdunicode));
|
|
2208 |
|
|
2209 |
pMap->InsertL(KDestFileNameParam, TLiwVariant( _L("c:\\vcardExport.vcf")));
|
|
2210 |
|
|
2211 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact")));
|
|
2212 |
const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap));
|
|
2213 |
|
|
2214 |
inList ->AppendL( paramContentType );
|
|
2215 |
inList ->AppendL( paramAddData );
|
|
2216 |
|
|
2217 |
iIface->ExecuteCmdL(KCmdExport, *inList, *outList, KLiwOptASyncronous, this);
|
|
2218 |
|
|
2219 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
2220 |
TLiwVariant err = param->Value();
|
|
2221 |
TInt code = err.AsTInt32();
|
|
2222 |
|
|
2223 |
if(code == SErrNone)
|
|
2224 |
{
|
|
2225 |
pos = 0;
|
|
2226 |
param = outList->FindFirst(pos, KTransactionID);
|
|
2227 |
if (param)
|
|
2228 |
{
|
|
2229 |
inList->Reset();
|
|
2230 |
outList->Reset();
|
|
2231 |
|
|
2232 |
TInt32 transid = param->Value().AsTInt32();
|
|
2233 |
|
|
2234 |
TLiwGenericParam paramtransactionId(KTransactionID, TLiwVariant(transid));
|
|
2235 |
|
|
2236 |
|
|
2237 |
inList->AppendL( paramtransactionId );
|
|
2238 |
|
|
2239 |
iCancelled = 1;
|
|
2240 |
iIface->ExecuteCmdL(KCancel, *inList, *outList,KLiwOptCancel, this);
|
|
2241 |
|
|
2242 |
paramtransactionId.Reset();
|
|
2243 |
|
|
2244 |
|
|
2245 |
inList->Reset();
|
|
2246 |
outList->Reset();
|
|
2247 |
}
|
|
2248 |
else
|
|
2249 |
{
|
|
2250 |
|
|
2251 |
}
|
|
2252 |
}
|
|
2253 |
inList->Reset();
|
|
2254 |
outList->Reset();
|
|
2255 |
pMap->DecRef();
|
|
2256 |
return iResult;
|
|
2257 |
|
|
2258 |
|
|
2259 |
}
|
|
2260 |
|
|
2261 |
TInt CTestProvider :: CancelImportL(CStifItemParser& /*aItem*/)
|
|
2262 |
{
|
|
2263 |
iResult = KErrGeneral;
|
|
2264 |
LoadService();
|
|
2265 |
iCase = EImportVcard;
|
|
2266 |
CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
|
|
2267 |
|
|
2268 |
TInt pos = 0;
|
|
2269 |
|
|
2270 |
pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb")));
|
|
2271 |
|
|
2272 |
pMap->InsertL(KSourceFileNameParam, TLiwVariant( _L("c:\\vcardimport.vcf")));
|
|
2273 |
|
|
2274 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact")));
|
|
2275 |
const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap));
|
|
2276 |
|
|
2277 |
inList ->AppendL( paramContentType );
|
|
2278 |
inList ->AppendL( paramAddData );
|
|
2279 |
|
|
2280 |
iIface->ExecuteCmdL(KCmdImport, *inList, *outList, KLiwOptASyncronous, this);
|
|
2281 |
|
|
2282 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
2283 |
TLiwVariant err = param->Value();
|
|
2284 |
TInt code = err.AsTInt32();
|
|
2285 |
|
|
2286 |
if(code == SErrNone)
|
|
2287 |
{
|
|
2288 |
pos = 0;
|
|
2289 |
param = outList->FindFirst(pos, KTransactionID);
|
|
2290 |
if (param)
|
|
2291 |
{
|
|
2292 |
inList->Reset();
|
|
2293 |
outList->Reset();
|
|
2294 |
|
|
2295 |
TInt32 transid = param->Value().AsTInt32();
|
|
2296 |
|
|
2297 |
TLiwGenericParam paramtransactionId(KTransactionID, TLiwVariant(transid));
|
|
2298 |
|
|
2299 |
|
|
2300 |
inList->AppendL( paramtransactionId );
|
|
2301 |
|
|
2302 |
iCancelled = 1;
|
|
2303 |
iIface->ExecuteCmdL(KCancel, *inList, *outList,KLiwOptCancel, this);
|
|
2304 |
|
|
2305 |
paramtransactionId.Reset();
|
|
2306 |
|
|
2307 |
|
|
2308 |
inList->Reset();
|
|
2309 |
outList->Reset();
|
|
2310 |
}
|
|
2311 |
else
|
|
2312 |
{
|
|
2313 |
|
|
2314 |
}
|
|
2315 |
}
|
|
2316 |
inList->Reset();
|
|
2317 |
outList->Reset();
|
|
2318 |
pMap->DecRef();
|
|
2319 |
return iResult;
|
|
2320 |
}
|
|
2321 |
|
|
2322 |
|
|
2323 |
|
|
2324 |
|
|
2325 |
TInt CTestProvider :: CancelDeleteContact(CStifItemParser& /*aItem*/)
|
|
2326 |
{
|
|
2327 |
iCase = EDeleteContact;
|
|
2328 |
LoadService();
|
|
2329 |
TInt pos = 0;
|
|
2330 |
CLiwMap* mapContactId = CLiwDefaultMap::NewL();
|
|
2331 |
//iCase = EGetAllContacts;
|
|
2332 |
//const TLiwGenericParam paramGetListSortOrder;
|
|
2333 |
|
|
2334 |
const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact")));
|
|
2335 |
inList ->AppendL( paramContentType );
|
|
2336 |
iIface->ExecuteCmdL(KCmdGetList, *inList, *outList, KLiwOptASyncronous, this);
|
|
2337 |
|
|
2338 |
const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode );
|
|
2339 |
TLiwVariant err = param->Value();
|
|
2340 |
TInt code = err.AsTInt32();
|
|
2341 |
|
|
2342 |
inList->Reset();
|
|
2343 |
outList->Reset();
|
|
2344 |
|
|
2345 |
if(code == SErrNone)
|
|
2346 |
{
|
|
2347 |
CActiveScheduler::Start();
|
|
2348 |
}
|
|
2349 |
const TLiwGenericParam paramContent(KType, TLiwVariant( _L("Contact")));
|
|
2350 |
inList ->AppendL( paramContent );
|
|
2351 |
CLiwDefaultList* list = CLiwDefaultList :: NewL();
|
|
2352 |
list->AppendL(TLiwVariant(*iCntID));
|
|
2353 |
mapContactId->InsertL(KDBUri, TLiwVariant(_L("cntdb://c:contacts.cdb")));
|
|
2354 |
mapContactId->InsertL(KList,TLiwVariant(list));
|
|
2355 |
const TLiwGenericParam paramDeleteData(KData, TLiwVariant(mapContactId));
|
|
2356 |
inList ->AppendL( paramDeleteData );
|
|
2357 |
iIface->ExecuteCmdL(KCmdDelete, *inList, *outList, KLiwOptASyncronous, this);
|
|
2358 |
|
|
2359 |
|
|
2360 |
pos = 0;
|
|
2361 |
|
|
2362 |
param = outList->FindFirst( pos, KExitCode );
|
|
2363 |
err = param->Value();
|
|
2364 |
code = err.AsTInt32();
|
|
2365 |
|
|
2366 |
if(code == SErrNone)
|
|
2367 |
{
|
|
2368 |
pos = 0;
|
|
2369 |
param = outList->FindFirst(pos, KTransactionID);
|
|
2370 |
if (param)
|
|
2371 |
{
|
|
2372 |
inList->Reset();
|
|
2373 |
outList->Reset();
|
|
2374 |
|
|
2375 |
TInt32 transid = param->Value().AsTInt32();
|
|
2376 |
|
|
2377 |
TLiwGenericParam paramtransactionId(KTransactionID, TLiwVariant(transid));
|
|
2378 |
|
|
2379 |
|
|
2380 |
inList->AppendL( paramtransactionId );
|
|
2381 |
|
|
2382 |
iCancelled = 1;
|
|
2383 |
iIface->ExecuteCmdL(KCancel, *inList, *outList,KLiwOptCancel, this);
|
|
2384 |
|
|
2385 |
paramtransactionId.Reset();
|
|
2386 |
|
|
2387 |
|
|
2388 |
inList->Reset();
|
|
2389 |
outList->Reset();
|
|
2390 |
}
|
|
2391 |
else
|
|
2392 |
{
|
|
2393 |
|
|
2394 |
}
|
|
2395 |
}
|
|
2396 |
inList->Reset();
|
|
2397 |
outList->Reset();
|
|
2398 |
mapContactId->DecRef();
|
|
2399 |
list->DecRef();
|
|
2400 |
return iResult;
|
|
2401 |
}
|
|
2402 |
|
|
2403 |
|
|
2404 |
|
|
2405 |
|
|
2406 |
|
|
2407 |
|
|
2408 |
|
|
2409 |
|
|
2410 |
|