author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Thu, 27 Aug 2009 07:43:07 +0300 | |
changeset 22 | fc9cf246af83 |
parent 19 | 989d2f495d90 |
child 33 | 50974a8b132e |
permissions | -rw-r--r-- |
19 | 1 |
/* |
2 |
* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: ?Description |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
// INCLUDE FILES |
|
22 |
#include <e32svr.h> |
|
23 |
#include <StifParser.h> |
|
24 |
#include <Stiftestinterface.h> |
|
25 |
#include "tContact_organise.h" |
|
26 |
||
27 |
||
28 |
TInt handleiter_cnt; |
|
29 |
||
30 |
||
31 |
CSingleContact* myContact=NULL; |
|
32 |
TBuf<25> KCompare ; |
|
33 |
TBuf8<100> contactid ; |
|
34 |
enum flag {GROUP = 1,CONTACT }status; |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
35 |
void CContactCallback::HandleReturnArray( const TInt& aError, RPointerArray<HBufC8>& aArray, TInt aTransId ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
36 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
37 |
CActiveScheduler::Stop(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
38 |
iError= aError ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
39 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
40 |
void CContactCallback::HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
41 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
42 |
CActiveScheduler::Stop(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
43 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
44 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
45 |
|
19 | 46 |
|
47 |
void CContactCallback::HandleReturnValue( TOperationEvent aEventId, const TInt& aError, TInt aTransId ) |
|
48 |
{ |
|
49 |
iError= aError; |
|
50 |
CActiveScheduler::Stop(); |
|
51 |
} |
|
52 |
||
53 |
||
54 |
void CContactCallback:: HandleReturnIter( const TInt& aError, CContactIter* aIter, TInt aTransId ) |
|
55 |
{ |
|
56 |
||
57 |
CActiveScheduler::Stop(); |
|
58 |
||
59 |
CSingleContactField* field = NULL; |
|
60 |
HBufC8* buf = NULL; |
|
61 |
TPtrC8 buf1; |
|
62 |
TPtrC buf2; |
|
63 |
TPtrC buf3; |
|
64 |
TInt count=0 ; |
|
65 |
HBufC8* tmpid; |
|
66 |
RPointerArray<TDesC8> idarray ; |
|
67 |
TPtrC grouplabel; |
|
68 |
||
69 |
if(aError==KErrNone) |
|
70 |
{ |
|
71 |
aIter->NextL(myContact,tmpid); |
|
72 |
||
73 |
while(myContact) |
|
74 |
{ |
|
75 |
if(myContact) |
|
76 |
{ |
|
77 |
contactid = *tmpid ; |
|
78 |
CleanupStack::PushL(myContact); |
|
79 |
//CleanupStack::PushL(tmpid); |
|
80 |
||
81 |
// count++; |
|
82 |
TInt len,i ; |
|
83 |
len=myContact->FieldCount(); |
|
84 |
// *contactid = myContact->GetContactId() ; |
|
85 |
for(i=0;i<len;i++) |
|
86 |
{ |
|
87 |
field = myContact->FieldAt(i); |
|
88 |
if(field!=NULL) |
|
89 |
{ |
|
90 |
if(status==GROUP) |
|
91 |
{ |
|
92 |
field->GetFieldDataL(grouplabel,idarray); |
|
93 |
if(grouplabel.Compare(KCompare)==0) break; |
|
94 |
} |
|
95 |
else |
|
96 |
{ |
|
97 |
field->GetFieldDataL(buf1,buf2,buf3); |
|
98 |
} |
|
99 |
} |
|
100 |
||
101 |
} //for |
|
102 |
||
103 |
// CleanupStack::PopAndDestroy(tmpid); |
|
104 |
CleanupStack::PopAndDestroy(myContact); |
|
105 |
||
106 |
} |
|
107 |
||
108 |
if(grouplabel.Compare(KCompare)==0) break; |
|
109 |
aIter->NextL(myContact,tmpid); |
|
110 |
||
111 |
||
112 |
} //while |
|
113 |
} //if |
|
114 |
||
115 |
delete aIter ; |
|
116 |
||
117 |
} |
|
118 |
||
119 |
// EXTERNAL DATA STRUCTURES |
|
120 |
//extern ?external_data; |
|
121 |
||
122 |
// EXTERNAL FUNCTION PROTOTYPES |
|
123 |
//extern ?external_function( ?arg_type,?arg_type ); |
|
124 |
||
125 |
// CONSTANTS |
|
126 |
//const ?type ?constant_var = ?constant; |
|
127 |
||
128 |
// MACROS |
|
129 |
//#define ?macro ?macro_def |
|
130 |
||
131 |
// LOCAL CONSTANTS AND MACROS |
|
132 |
//const ?type ?constant_var = ?constant; |
|
133 |
//#define ?macro_name ?macro_def |
|
134 |
||
135 |
// MODULE DATA STRUCTURES |
|
136 |
//enum ?declaration |
|
137 |
//typedef ?declaration |
|
138 |
||
139 |
// LOCAL FUNCTION PROTOTYPES |
|
140 |
//?type ?function_name( ?arg_type, ?arg_type ); |
|
141 |
||
142 |
// FORWARD DECLARATIONS |
|
143 |
//class ?FORWARD_CLASSNAME; |
|
144 |
||
145 |
// ============================= LOCAL FUNCTIONS =============================== |
|
146 |
||
147 |
// ----------------------------------------------------------------------------- |
|
148 |
// ?function_name ?description. |
|
149 |
// ?description |
|
150 |
// Returns: ?value_1: ?description |
|
151 |
// ?value_n: ?description_line1 |
|
152 |
// ?description_line2 |
|
153 |
// ----------------------------------------------------------------------------- |
|
154 |
// |
|
155 |
/* |
|
156 |
?type ?function_name( |
|
157 |
?arg_type arg, // ?description |
|
158 |
?arg_type arg) // ?description |
|
159 |
{ |
|
160 |
||
161 |
?code // ?comment |
|
162 |
||
163 |
// ?comment |
|
164 |
?code |
|
165 |
} |
|
166 |
*/ |
|
167 |
||
168 |
// ============================ MEMBER FUNCTIONS =============================== |
|
169 |
||
170 |
// ----------------------------------------------------------------------------- |
|
171 |
// Ctmanualother::Delete |
|
172 |
// Delete here all resources allocated and opened from test methods. |
|
173 |
// Called from destructor. |
|
174 |
// ----------------------------------------------------------------------------- |
|
175 |
// |
|
176 |
void Ctmanualother:: Delete() |
|
177 |
{ } |
|
178 |
||
179 |
// ----------------------------------------------------------------------------- |
|
180 |
// Ctmanualother::RunMethodL |
|
181 |
// Run specified method. Contains also table of test mothods and their names. |
|
182 |
// ----------------------------------------------------------------------------- |
|
183 |
// |
|
184 |
TInt Ctmanualother::RunMethodL( |
|
185 |
CStifItemParser& aItem ) |
|
186 |
{ |
|
187 |
||
188 |
static TStifFunctionInfo const KFunctions[] = |
|
189 |
{ |
|
190 |
// Copy this line for every implemented function. |
|
191 |
// First string is the function name used in TestScripter script file. |
|
192 |
// Second is the actual implementation member function. |
|
193 |
ENTRY( "Add_to_group1", Ctmanualother::Add_to_group1L ), |
|
194 |
ENTRY( "Add_to_group2", Ctmanualother::Add_to_group2L ), |
|
195 |
ENTRY( "Add_to_group3", Ctmanualother::Add_to_group3L ), |
|
196 |
ENTRY( "Delete_from_group2", Ctmanualother::Delete_from_group2L ), |
|
197 |
ENTRY( "Delete_from_group3", Ctmanualother::Delete_from_group3L ), |
|
198 |
ENTRY( "Delete_from_group4", Ctmanualother::Delete_from_group4L ), |
|
199 |
||
200 |
}; |
|
201 |
||
202 |
const TInt count = sizeof( KFunctions ) / |
|
203 |
sizeof( TStifFunctionInfo ); |
|
204 |
||
205 |
return RunInternalL( KFunctions, count, aItem ); |
|
206 |
||
207 |
} |
|
208 |
||
209 |
// ----------------------------------------------------------------------------- |
|
210 |
// Ctmanualother::ExampleL |
|
211 |
// Example test method function. |
|
212 |
// (other items were commented in a header). |
|
213 |
// ----------------------------------------------------------------------------- |
|
214 |
// |
|
215 |
||
216 |
/*Adding a contact to the group */ |
|
217 |
TInt Ctmanualother::Add_to_group1L( CStifItemParser& aItem ) |
|
218 |
{ |
|
219 |
||
220 |
_LIT( Ktsapicontacts, "torganise"); |
|
221 |
_LIT( KExample, "In GetList_Test1L" ); |
|
222 |
TestModuleIf().Printf( 0, Ktsapicontacts, KExample ); |
|
223 |
// Print to log file |
|
224 |
iLog->Log( KExample ); |
|
225 |
||
226 |
TInt count= KErrGeneral; |
|
227 |
RPointerArray<TDesC8> ptr; |
|
228 |
_LIT(KGroup,"GroupA") ; |
|
229 |
_LIT(KNull,"*****") ; |
|
230 |
||
231 |
aItem.GetNextInt(count) ; |
|
232 |
||
233 |
/* add group4 to phonebook */ |
|
234 |
icontactservice->AddL(icallback,0,NULL,KNullDesC8,KGroup); |
|
235 |
CActiveScheduler::Start(); |
|
236 |
||
237 |
status = GROUP ; |
|
238 |
KCompare=KGroup ; |
|
239 |
||
240 |
/* get contactid of groupA ,store it in cid*/ |
|
241 |
icontactservice->GetListL(icallback,1,EGroups); |
|
242 |
CActiveScheduler::Start(); |
|
243 |
||
244 |
// HBufC8* cid =HBufC8 :: NewL(30); |
|
245 |
||
246 |
TBuf8<100> groupid = contactid ; |
|
247 |
||
248 |
status=CONTACT ; |
|
249 |
KCompare = KNull; |
|
250 |
||
251 |
/* get the contactid of any contact */ |
|
252 |
icontactservice->GetListL(icallback,2,EContacts); |
|
253 |
CActiveScheduler::Start(); |
|
254 |
||
255 |
||
256 |
||
257 |
HBufC8* contactId1 = contactid.AllocLC(); |
|
258 |
CleanupStack::Pop(); |
|
259 |
/* Append the contactid to ptr */ |
|
260 |
ptr.AppendL(contactId1); |
|
261 |
||
262 |
||
263 |
||
264 |
||
265 |
/* Add 2 contacts,1 valid ,1 invalid contact from the group4 */ |
|
266 |
icontactservice->OrganiseGroupsL(icallback,3,groupid,ptr,ETrue); |
|
267 |
CActiveScheduler::Start(); |
|
268 |
||
269 |
if(count == icallback->iError ) |
|
270 |
return KErrNone ; |
|
271 |
||
272 |
return KErrGeneral ; |
|
273 |
||
274 |
||
275 |
||
276 |
} |
|
277 |
||
278 |
||
279 |
||
280 |
/*Add 2 contacts to group, 1 existing,other non existing */ |
|
281 |
TInt Ctmanualother::Add_to_group2L( CStifItemParser& aItem ) |
|
282 |
{ |
|
283 |
||
284 |
_LIT( Ktsapicontacts, "torganise"); |
|
285 |
_LIT( KExample, "In GetList_Test1L" ); |
|
286 |
TestModuleIf().Printf( 0, Ktsapicontacts, KExample ); |
|
287 |
// Print to log file |
|
288 |
iLog->Log( KExample ); |
|
289 |
||
290 |
TInt count= KErrGeneral; |
|
291 |
RPointerArray<TDesC8> ptr ; |
|
292 |
_LIT(KGroup,"Group4") ; |
|
293 |
_LIT(KNull,"*****") ; |
|
294 |
||
295 |
aItem.GetNextInt(count) ; |
|
296 |
||
297 |
||
298 |
_LIT8(KFirstName,"FirstName"); |
|
299 |
_LIT(KName,"Bill"); |
|
300 |
//instantiate service class object |
|
301 |
||
302 |
/* create contactitem to add */ |
|
303 |
CSingleContact* singleContact = CSingleContact::NewL(); |
|
304 |
CSingleContactField* singleContactField = CSingleContactField::NewL(); |
|
305 |
||
306 |
||
307 |
singleContactField->SetFieldParamsL(KFirstName,KNullDesC,KName); |
|
308 |
singleContact->AddFieldToContactL(singleContactField); |
|
309 |
||
310 |
||
311 |
/* Add the contactitem */ |
|
312 |
icontactservice->AddL(icallback,0,singleContact); |
|
313 |
CActiveScheduler::Start(); |
|
314 |
||
315 |
/* Add the contactitem */ |
|
316 |
icontactservice->AddL(icallback,0,singleContact); |
|
317 |
CActiveScheduler::Start(); |
|
318 |
||
319 |
/* add group4 to phonebook */ |
|
320 |
icontactservice->AddL(icallback,0,NULL,KNullDesC8,KGroup); |
|
321 |
CActiveScheduler::Start(); |
|
322 |
||
323 |
status = GROUP ; |
|
324 |
KCompare=KGroup ; |
|
325 |
||
326 |
/* get contactid of group4 ,store it in cid*/ |
|
327 |
icontactservice->GetListL(icallback,1,EGroups); |
|
328 |
CActiveScheduler::Start(); |
|
329 |
||
330 |
// HBufC8* cid =HBufC8 :: NewL(30); |
|
331 |
||
332 |
TBuf8<100> groupid = contactid ; |
|
333 |
||
334 |
status=CONTACT ; |
|
335 |
KCompare = KNull; |
|
336 |
||
337 |
/* get the contactid of any contact */ |
|
338 |
icontactservice->GetListL(icallback,2,EContacts); |
|
339 |
CActiveScheduler::Start(); |
|
340 |
||
341 |
||
342 |
||
343 |
HBufC8* contactId1 = contactid.AllocLC(); |
|
344 |
CleanupStack::Pop(); |
|
345 |
/* Append the contactid to ptr */ |
|
346 |
TRAPD(err1,ptr.AppendL(contactId1)); |
|
347 |
||
348 |
||
349 |
||
350 |
/* delete that contact from phonebook*/ |
|
351 |
icontactservice->DeleteL(icallback,2,ptr); |
|
352 |
CActiveScheduler::Start(); |
|
353 |
||
354 |
||
355 |
/* get the contactid of any other contact */ |
|
356 |
icontactservice->GetListL(icallback,2,EContacts); |
|
357 |
CActiveScheduler::Start(); |
|
358 |
||
359 |
ptr.Reset(); |
|
360 |
/* append one more contactid to ptr */ |
|
361 |
HBufC8* contactId2 = contactid.AllocLC(); |
|
362 |
CleanupStack::Pop(); |
|
363 |
/* Append the contactid to ptr */ |
|
364 |
TRAPD(err2,ptr.AppendL(contactId2)); |
|
365 |
||
366 |
||
367 |
/* Add 2 contacts,1 valid ,1 invalid contact from the group4 */ |
|
368 |
icontactservice->OrganiseGroupsL(icallback,3,groupid,ptr,ETrue); |
|
369 |
CActiveScheduler::Start(); |
|
370 |
||
371 |
if(!icallback->iError ) |
|
372 |
return KErrNone ; |
|
373 |
||
374 |
return KErrGeneral ; |
|
375 |
||
376 |
||
377 |
||
378 |
} |
|
379 |
/* Add 1 nonexitent contact to group 5 */ |
|
380 |
TInt Ctmanualother::Add_to_group3L( CStifItemParser& aItem ) |
|
381 |
{ |
|
382 |
||
383 |
_LIT( Ktsapicontacts, "torganise"); |
|
384 |
_LIT( KExample, "In GetList_Test1L" ); |
|
385 |
TestModuleIf().Printf( 0, Ktsapicontacts, KExample ); |
|
386 |
// Print to log file |
|
387 |
iLog->Log( KExample ); |
|
388 |
||
389 |
TInt count= KErrGeneral; |
|
390 |
RPointerArray<TDesC8> ptr ; |
|
391 |
_LIT(KGroup,"Group5") ; |
|
392 |
_LIT(KNull,"*****") ; |
|
393 |
||
394 |
aItem.GetNextInt(count) ; |
|
395 |
||
396 |
/* add group5 to phonebook */ |
|
397 |
icontactservice->AddL(icallback,0,NULL,KNullDesC8,KGroup); |
|
398 |
CActiveScheduler::Start(); |
|
399 |
||
400 |
status = GROUP ; |
|
401 |
KCompare=KGroup ; |
|
402 |
||
403 |
/* get contactid of group5 ,store it in cid*/ |
|
404 |
icontactservice->GetListL(icallback,1,EGroups); |
|
405 |
CActiveScheduler::Start(); |
|
406 |
||
407 |
||
408 |
TBuf8<100> groupid = contactid ; |
|
409 |
||
410 |
||
411 |
status = CONTACT ; |
|
412 |
KCompare = KNull ; |
|
413 |
||
414 |
/* get the contactid of any contact */ |
|
415 |
icontactservice->GetListL(icallback,2,EContacts); |
|
416 |
CActiveScheduler::Start(); |
|
417 |
||
418 |
||
419 |
TBuf8<100> cid = contactid ; |
|
420 |
||
421 |
HBufC8* contactId1 = contactid.AllocLC(); |
|
422 |
CleanupStack::Pop(); |
|
423 |
/* Append the contactid to ptr */ |
|
424 |
TRAPD(err1,ptr.AppendL(contactId1)); |
|
425 |
||
426 |
||
427 |
/* delete that contact from phonebook*/ |
|
428 |
icontactservice->DeleteL(icallback,3,ptr); |
|
429 |
CActiveScheduler::Start(); |
|
430 |
||
431 |
/* Add that contact to group5 */ |
|
432 |
icontactservice->OrganiseGroupsL(icallback,4,groupid,ptr,ETrue); |
|
433 |
CActiveScheduler::Start(); |
|
434 |
||
435 |
if(count == icallback->iError ) |
|
436 |
return KErrNone ; |
|
437 |
||
438 |
return KErrGeneral ; |
|
439 |
||
440 |
||
441 |
} |
|
442 |
||
443 |
||
444 |
||
445 |
||
446 |
/* disassociate a contact from group */ |
|
447 |
TInt Ctmanualother::Delete_from_group2L( CStifItemParser& aItem ) |
|
448 |
{ |
|
449 |
||
450 |
||
451 |
// Print to UI |
|
452 |
_LIT( Ktsapicontacts, "torganise" ); |
|
453 |
_LIT( KExample, "In GetList_Test1L" ); |
|
454 |
TestModuleIf().Printf( 0, Ktsapicontacts, KExample ); |
|
455 |
// Print to log file |
|
456 |
iLog->Log( KExample ); |
|
457 |
||
458 |
TInt count= KErrGeneral; |
|
459 |
RPointerArray<TDesC8> ptr ; |
|
460 |
_LIT(KGroup,"Group3") ; |
|
461 |
_LIT(KNull,"*****") ; |
|
462 |
||
463 |
aItem.GetNextInt(count) ; |
|
464 |
||
465 |
status = GROUP; |
|
466 |
KCompare = KGroup ; |
|
467 |
||
468 |
/* add group3 to phonebook */ |
|
469 |
icontactservice->AddL(icallback,0,NULL,KNullDesC8,KGroup); |
|
470 |
CActiveScheduler::Start(); |
|
471 |
||
472 |
/* get contactid of group3 ,store it in cid*/ |
|
473 |
icontactservice->GetListL(icallback,1,EGroups); |
|
474 |
CActiveScheduler::Start(); |
|
475 |
||
476 |
TBuf8<100> groupid = contactid ; |
|
477 |
||
478 |
status = CONTACT ; |
|
479 |
KCompare = KNull ; |
|
480 |
||
481 |
/* get the contactid of any contact */ |
|
482 |
icontactservice->GetListL(icallback,2,EContacts); |
|
483 |
CActiveScheduler::Start(); |
|
484 |
||
485 |
||
486 |
||
487 |
HBufC8* contactId1 = contactid.AllocLC(); |
|
488 |
CleanupStack::Pop(); |
|
489 |
/* Append the contactid to ptr */ |
|
490 |
TRAPD(err1,ptr.AppendL(contactId1)); |
|
491 |
||
492 |
||
493 |
/* Add the contact to the group */ |
|
494 |
icontactservice->OrganiseGroupsL(icallback,3,groupid,ptr,ETrue); |
|
495 |
CActiveScheduler::Start(); |
|
496 |
||
497 |
/* delete the contact from group */ |
|
498 |
icontactservice->OrganiseGroupsL(icallback,4,groupid,ptr,EFalse); |
|
499 |
CActiveScheduler::Start(); |
|
500 |
||
501 |
if(count == icallback->iError ) |
|
502 |
return KErrNone ; |
|
503 |
||
504 |
return KErrGeneral ; |
|
505 |
||
506 |
} |
|
507 |
||
508 |
/* disassociate the same contact from group twice */ |
|
509 |
TInt Ctmanualother::Delete_from_group3L( CStifItemParser& aItem ) |
|
510 |
{ |
|
511 |
||
512 |
||
513 |
// Print to UI |
|
514 |
_LIT( Ktsapicontacts, "torganise" ); |
|
515 |
_LIT( KExample, "In GetList_Test1L" ); |
|
516 |
TestModuleIf().Printf( 0, Ktsapicontacts, KExample ); |
|
517 |
// Print to log file |
|
518 |
iLog->Log( KExample ); |
|
519 |
||
520 |
TInt count= KErrGeneral; |
|
521 |
RPointerArray<TDesC8> ptr ; |
|
522 |
_LIT(KGroup,"Group6") ; |
|
523 |
_LIT(KNull,"*****") ; |
|
524 |
||
525 |
aItem.GetNextInt(count) ; |
|
526 |
||
527 |
status = GROUP; |
|
528 |
KCompare = KGroup ; |
|
529 |
||
530 |
/* add group6 to phonebook */ |
|
531 |
icontactservice->AddL(icallback,0,NULL,KNullDesC8,KGroup); |
|
532 |
CActiveScheduler::Start(); |
|
533 |
||
534 |
/* get contactid of group6 ,store it in cid*/ |
|
535 |
icontactservice->GetListL(icallback,1,EGroups); |
|
536 |
CActiveScheduler::Start(); |
|
537 |
||
538 |
||
539 |
TBuf8<100> groupid = contactid ; |
|
540 |
||
541 |
status = CONTACT ; |
|
542 |
KCompare = KNull ; |
|
543 |
||
544 |
||
545 |
/* get the contactid of any contact */ |
|
546 |
icontactservice->GetListL(icallback,2,EContacts); |
|
547 |
CActiveScheduler::Start(); |
|
548 |
||
549 |
HBufC8* contactId1 = contactid.AllocLC(); |
|
550 |
CleanupStack::Pop(); |
|
551 |
/* Append the contactid to ptr */ |
|
552 |
TRAPD(err1,ptr.AppendL(contactId1)); |
|
553 |
||
554 |
/* Add the contact to the group */ |
|
555 |
icontactservice->OrganiseGroupsL(icallback,3,groupid,ptr,ETrue); |
|
556 |
CActiveScheduler::Start(); |
|
557 |
||
558 |
/* delete the contact from group */ |
|
559 |
icontactservice->OrganiseGroupsL(icallback,4,groupid,ptr,EFalse); |
|
560 |
CActiveScheduler::Start(); |
|
561 |
||
562 |
/* delete the same contact from group */ |
|
563 |
icontactservice->OrganiseGroupsL(icallback,5,groupid,ptr,EFalse); |
|
564 |
CActiveScheduler::Start(); |
|
565 |
||
566 |
if(count == icallback->iError ) |
|
567 |
return KErrNone ; |
|
568 |
||
569 |
return KErrGeneral ; |
|
570 |
||
571 |
||
572 |
} |
|
573 |
||
574 |
/* dissociate non existent contact from group */ |
|
575 |
TInt Ctmanualother::Delete_from_group4L( CStifItemParser& aItem ) |
|
576 |
{ |
|
577 |
||
578 |
_LIT( Ktsapicontacts, "torganise"); |
|
579 |
_LIT( KExample, "In GetList_Test1L" ); |
|
580 |
TestModuleIf().Printf( 0, Ktsapicontacts, KExample ); |
|
581 |
// Print to log file |
|
582 |
iLog->Log( KExample ); |
|
583 |
||
584 |
TInt count= KErrGeneral; |
|
585 |
RPointerArray<TDesC8> ptr ; |
|
586 |
_LIT(KGroup,"Group7") ; |
|
587 |
_LIT(KNull,"*****") ; |
|
588 |
||
589 |
aItem.GetNextInt(count) ; |
|
590 |
||
591 |
/* add group7 to phonebook */ |
|
592 |
icontactservice->AddL(icallback,0,NULL,KNullDesC8,KGroup); |
|
593 |
CActiveScheduler::Start(); |
|
594 |
||
595 |
status = GROUP; |
|
596 |
KCompare = KGroup ; |
|
597 |
||
598 |
/* get contactid of group7 ,store it in cid*/ |
|
599 |
icontactservice->GetListL(icallback,1,EGroups); |
|
600 |
CActiveScheduler::Start(); |
|
601 |
||
602 |
TBuf8<100> groupid = contactid ; |
|
603 |
||
604 |
status = CONTACT ; |
|
605 |
KCompare = KNull ; |
|
606 |
||
607 |
/* get the contactid of any contact */ |
|
608 |
icontactservice->GetListL(icallback,2,EContacts); |
|
609 |
CActiveScheduler::Start(); |
|
610 |
||
611 |
HBufC8* contactId1 = contactid.AllocLC(); |
|
612 |
CleanupStack::Pop(); |
|
613 |
/* Append the contactid to ptr */ |
|
614 |
TRAPD(err1,ptr.AppendL(contactId1)); |
|
615 |
||
616 |
/* delete that contact from phonebook*/ |
|
617 |
icontactservice->DeleteL(icallback,3,ptr); |
|
618 |
CActiveScheduler::Start(); |
|
619 |
||
620 |
/* Delete that contact to group7 */ |
|
621 |
icontactservice->OrganiseGroupsL(icallback,4,groupid,ptr,EFalse); |
|
622 |
CActiveScheduler::Start(); |
|
623 |
||
624 |
if(count == icallback->iError ) |
|
625 |
return KErrNone ; |
|
626 |
||
627 |
return KErrGeneral ; |
|
628 |
||
629 |
} |
|
630 |
||
631 |
||
632 |
||
633 |
||
634 |
||
635 |
||
636 |
||
637 |
||
638 |
||
639 |
||
640 |
||
641 |
||
642 |
||
643 |
||
644 |
||
645 |
||
646 |
||
647 |
||
648 |
||
649 |
||
650 |
||
651 |
// ----------------------------------------------------------------------------- |
|
652 |
// Ctmanualother::?member_function |
|
653 |
// ?implementation_description |
|
654 |
// (other items were commented in a header). |
|
655 |
// ----------------------------------------------------------------------------- |
|
656 |
// |
|
657 |
/* |
|
658 |
TInt Ctmanualother::?member_function( |
|
659 |
CItemParser& aItem ) |
|
660 |
{ |
|
661 |
||
662 |
?code |
|
663 |
||
664 |
} |
|
665 |
*/ |
|
666 |
||
667 |
// ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
668 |
// None |
|
669 |
||
670 |
// End of File |