33 CContactIter* CContactService::GetListL(Ttype atype, |
33 CContactIter* CContactService::GetListL(Ttype atype, |
34 const TDesC8& aContactId, |
34 const TDesC8& aContactId, |
35 const TDesC& aSearchVal, |
35 const TDesC& aSearchVal, |
36 CSearchFields* aSearchFields, |
36 CSearchFields* aSearchFields, |
37 TOrder aSortOrder, |
37 TOrder aSortOrder, |
38 const TDesC& aStoreUri) |
38 const TDesC& aStoreUri, |
|
39 TCmdType aval) |
39 { |
40 { |
40 //create the callback object internally |
41 //create the callback object internally |
41 CContactSyncCallback* callback = new(ELeave) CContactSyncCallback(); |
42 CContactSyncCallback* callback = new(ELeave) CContactSyncCallback(); |
42 CleanupStack::PushL(callback); |
43 CleanupStack::PushL(callback); |
43 //create the wait scheduler instance |
44 //create the wait scheduler instance |
75 CleanupStack::PopAndDestroy(callback); |
77 CleanupStack::PopAndDestroy(callback); |
76 return tempIter; |
78 return tempIter; |
77 } |
79 } |
78 |
80 |
79 |
81 |
80 |
82 /* |
|
83 ----------------------------------------------------------------------------- |
|
84 CContactService :: GetIdsL |
|
85 Description : synchronous implementation of GetIds api. |
|
86 Return values : RPointerArray<HBufC8>& |
|
87 ----------------------------------------------------------------------------- |
|
88 */ |
|
89 |
|
90 EXPORT_C |
|
91 RPointerArray<HBufC8>& CContactService::GetIdsL(Ttype atype, |
|
92 const TDesC& aSearchVal, |
|
93 CSearchFields* aSearchFields, |
|
94 TOrder aSortOrder, |
|
95 const TDesC& aStoreUri, |
|
96 TCmdType aval) |
|
97 { |
|
98 //create the callback object internally |
|
99 CContactSyncCallback* callback = new(ELeave) CContactSyncCallback(); |
|
100 CleanupStack::PushL(callback); |
|
101 //create the wait scheduler instance |
|
102 CActiveSchedulerWait* waitScheduler = new(ELeave) CActiveSchedulerWait(); |
|
103 CleanupStack::PushL(waitScheduler); |
|
104 //needed to stop the scheduler by the callback instance |
|
105 callback->SetWaitScheduler(waitScheduler); |
|
106 //call the asynch sapi with all the params |
|
107 TRAPD(err,GetListL(callback, |
|
108 0, |
|
109 atype, |
|
110 KNullDesC8, |
|
111 aSearchVal, |
|
112 aSearchFields, |
|
113 aSortOrder, |
|
114 aStoreUri, |
|
115 aval)); |
|
116 //TRAP harness is used to unset the sync flag in leaving condition |
|
117 //since we r using the same async apis for sync implementation |
|
118 if(KErrNone != err) |
|
119 { |
|
120 User::Leave(err); |
|
121 } |
|
122 //start the wait scheduler and wait untill the operation finishes |
|
123 waitScheduler->Start(); |
|
124 //Unset the callbak pointer |
|
125 callback->SetWaitScheduler(NULL); |
|
126 //check for any errors |
|
127 TInt error = callback->GetErrorCode(); |
|
128 if(KErrNone != error) |
|
129 { |
|
130 User::Leave(error); |
|
131 } |
|
132 RPointerArray<HBufC8>* tempArray = new (ELeave) RPointerArray<HBufC8>; |
|
133 //get the array of ids of contacts/groups |
|
134 callback->GetArray(tempArray); |
|
135 CleanupStack::PopAndDestroy(waitScheduler); |
|
136 CleanupStack::PopAndDestroy(callback); |
|
137 return *tempArray; |
|
138 } |
81 /* |
139 /* |
82 ----------------------------------------------------------------------------- |
140 ----------------------------------------------------------------------------- |
83 CContactService :: AddL |
141 CContactService :: AddL |
84 Description : synchronous implementation of AddL api. |
142 Description : synchronous implementation of AddL api. |
85 Return values : CContactIter* |
143 Return values : CContactIter* |
86 ----------------------------------------------------------------------------- |
144 ----------------------------------------------------------------------------- |
87 */ |
145 */ |
88 |
146 |
89 EXPORT_C |
147 EXPORT_C |
90 void CContactService:: AddL( CSingleContact* aContact, |
148 HBufC8* CContactService:: AddL( CSingleContact* aContact, |
91 const TDesC8& aGroupId, |
149 const TDesC8& aGroupId, |
92 const TDesC& aGroupLabel, |
150 const TDesC& aGroupLabel, |
93 const TDesC& aStoreUri) |
151 const TDesC& aStoreUri) |
94 { |
152 { |
95 iErrKey = 0; |
153 iErrKey = 0; |