author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 24 Nov 2009 08:56:33 +0200 | |
changeset 33 | 50974a8b132e |
parent 22 | fc9cf246af83 |
permissions | -rw-r--r-- |
19 | 1 |
/* |
2 |
* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: Implements the contact callback interface. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
19 |
#include <liwcommon.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
20 |
#include <liwgenericparam.h> |
19 | 21 |
|
22 |
// User Includes |
|
23 |
#include "contactinterfacecallback.h" |
|
24 |
#include "contactinterface.h" |
|
25 |
#include "contacterrormessage.hrh" |
|
26 |
#include "../../inc/serviceerrno.h" |
|
27 |
#include "searchfields.h" |
|
28 |
||
29 |
//_LIT8(KResponse,"ReturnValue"); |
|
30 |
//_LIT(KAddFieldKeyNotSupported,"Contacts : Add :Field Key Not Supported on this Database: "); |
|
31 |
/* |
|
32 |
----------------------------------------------------------------------------- |
|
33 |
CContactInterfaceCallback::CContactInterfaceCallback() |
|
34 |
Description : Symbian default Constructor can NOT contain |
|
35 |
any code that might leave. |
|
36 |
Return values : N/A |
|
37 |
----------------------------------------------------------------------------- |
|
38 |
*/ |
|
39 |
CContactInterfaceCallback::CContactInterfaceCallback() |
|
40 |
:iCallback(NULL), |
|
41 |
iTransactionId(0), |
|
42 |
iInParamList(NULL), |
|
43 |
iEventParamList(NULL), |
|
44 |
iContact(NULL) |
|
45 |
{ |
|
46 |
} |
|
47 |
||
48 |
/* |
|
49 |
----------------------------------------------------------------------------- |
|
50 |
CContactInterfaceCallback::NewL() |
|
51 |
Description : Two-phased constructor. |
|
52 |
Return values : CContactInterfaceCallback object pointer |
|
53 |
----------------------------------------------------------------------------- |
|
54 |
*/ |
|
55 |
CContactInterfaceCallback* CContactInterfaceCallback::NewL() |
|
56 |
{ |
|
57 |
return new ( ELeave ) CContactInterfaceCallback(); |
|
58 |
} |
|
59 |
||
60 |
/* |
|
61 |
----------------------------------------------------------------------------- |
|
62 |
CContactInterfaceCallback::NewL() |
|
63 |
Description : Two-phased overloaded constructor. |
|
64 |
Return values : CContactInterfaceCallback object pointer |
|
65 |
----------------------------------------------------------------------------- |
|
66 |
*/ |
|
67 |
CContactInterfaceCallback* CContactInterfaceCallback::NewL(CSingleContact* aContact) |
|
68 |
{ |
|
69 |
CContactInterfaceCallback* self = new (ELeave) CContactInterfaceCallback(); |
|
70 |
self->iContact = aContact; |
|
71 |
return self; |
|
72 |
} |
|
73 |
||
74 |
||
75 |
/* |
|
76 |
----------------------------------------------------------------------------- |
|
77 |
CContactInterfaceCallback::~CContactInterfaceCallback() |
|
78 |
Description : Destructor, free allocated resources |
|
79 |
Return values : N/A |
|
80 |
----------------------------------------------------------------------------- |
|
81 |
*/ |
|
82 |
CContactInterfaceCallback::~CContactInterfaceCallback() |
|
83 |
{ |
|
84 |
delete iEventParamList; |
|
85 |
delete iContact; |
|
86 |
} |
|
87 |
||
88 |
/* |
|
89 |
----------------------------------------------------------------------------- |
|
90 |
CContactInterfaceCallback::SetParams() |
|
91 |
Description : Sets the basic params of the callback object |
|
92 |
Return values : N/A |
|
93 |
----------------------------------------------------------------------------- |
|
94 |
*/ |
|
95 |
void CContactInterfaceCallback::SetParams( MLiwNotifyCallback* aCallback, |
|
96 |
const TInt aTransId, |
|
97 |
const CLiwGenericParamList* aInParamList ) |
|
98 |
{ |
|
99 |
iCallback = aCallback; |
|
100 |
iTransactionId = aTransId; |
|
101 |
iInParamList = aInParamList; |
|
102 |
} |
|
103 |
||
104 |
/* |
|
105 |
----------------------------------------------------------------------------- |
|
106 |
CContactInterfaceCallback::HandleReturnValue() |
|
107 |
Description : The MContactCallback Method, is called when |
|
108 |
Error has occured.The Error is passed |
|
109 |
to the consumer by appending to the CLiwGenericParamList. |
|
110 |
Return values : N/A |
|
111 |
----------------------------------------------------------------------------- |
|
112 |
*/ |
|
113 |
void CContactInterfaceCallback::HandleReturnValue( TOperationEvent aEventId, const TInt& aError,TInt aTransId) |
|
114 |
{ |
|
115 |
TInt err = 0; |
|
116 |
CleanupStack::PushL(this); |
|
117 |
if( iCallback ) |
|
118 |
{ |
|
119 |
if( iEventParamList ) |
|
120 |
{ |
|
121 |
iEventParamList->Reset(); |
|
122 |
} |
|
123 |
else |
|
124 |
{ |
|
125 |
iEventParamList = CLiwGenericParamList::NewL(); |
|
126 |
} |
|
127 |
||
128 |
if(aEventId == EOpCancel) |
|
129 |
{ |
|
130 |
iEventParamList->AppendL(TLiwGenericParam(KErrorCode, |
|
131 |
TLiwVariant((TInt32)SErrCancelSuccess ))); |
|
132 |
//Call HandleNotify |
|
133 |
TRAP(err,iCallback->HandleNotifyL((TInt32)aTransId, |
|
134 |
KLiwEventCanceled, |
|
135 |
*iEventParamList, |
|
136 |
*iInParamList)); |
|
137 |
} |
|
138 |
else if(aEventId == EOpError) |
|
139 |
{ |
|
140 |
TInt32 sapiError = CContactInterface::SapiError(aError); |
|
141 |
iEventParamList->AppendL(TLiwGenericParam( KErrorCode, |
|
142 |
TLiwVariant((TInt32)sapiError))); |
|
143 |
//Call HandleNotify |
|
144 |
TRAP(err,iCallback->HandleNotifyL((TInt32)aTransId, |
|
145 |
KLiwEventError, |
|
146 |
*iEventParamList, |
|
147 |
*iInParamList)); |
|
148 |
} |
|
149 |
else if(aEventId == EInvalidKey) |
|
150 |
{ |
|
151 |
TPtrC8 ptr = CSearchFields::GetFieldKeyFromId(aError); |
|
152 |
TBuf<25> buff; |
|
153 |
buff.Copy(ptr); |
|
154 |
TBuf<KMaxName> errmsg(KAddFieldKeyNotSupported); |
|
155 |
errmsg.Append(buff); |
|
156 |
||
157 |
const_cast<TInt&> (aError) = KErrNotSupported; |
|
158 |
TInt32 sapiError = CContactInterface::SapiError(aError); |
|
159 |
||
160 |
iEventParamList->AppendL(TLiwGenericParam( KErrorCode, |
|
161 |
TLiwVariant((TInt32)sapiError))); |
|
162 |
||
163 |
iEventParamList->AppendL(TLiwGenericParam(KErrorMessage, |
|
164 |
TLiwVariant(errmsg))); |
|
165 |
//Call HandleNotify |
|
166 |
TRAP(err,iCallback->HandleNotifyL((TInt32)aTransId, |
|
167 |
KLiwEventError, |
|
168 |
*iEventParamList, |
|
169 |
*iInParamList)); |
|
170 |
} |
|
171 |
else |
|
172 |
{ |
|
173 |
//Append Error code |
|
174 |
TInt32 sapiError = CContactInterface::SapiError(aError); |
|
175 |
iEventParamList->AppendL(TLiwGenericParam( KErrorCode, |
|
176 |
TLiwVariant( (TInt32)sapiError ))); |
|
177 |
//Append Reason |
|
178 |
||
179 |
//Call HandleNotify |
|
180 |
TRAP(err,iCallback->HandleNotifyL((TInt32)aTransId, |
|
181 |
KLiwEventCompleted, |
|
182 |
*iEventParamList, |
|
183 |
*iInParamList)); |
|
184 |
} |
|
185 |
||
186 |
} |
|
187 |
CleanupStack::PopAndDestroy(this); |
|
188 |
} |
|
189 |
/* |
|
190 |
----------------------------------------------------------------------------- |
|
191 |
CContactInterfaceCallback::HandleReturnIter() |
|
192 |
Description : The MContactCallback Method, is called when |
|
193 |
GetList returns an iterator on a list of entries retrived. |
|
194 |
Return values : N/A |
|
195 |
----------------------------------------------------------------------------- |
|
196 |
*/ |
|
197 |
||
198 |
||
199 |
void CContactInterfaceCallback::HandleReturnIter(const TInt& aError, |
|
200 |
CContactIter* aIter, |
|
201 |
TInt aTransId) |
|
202 |
{ |
|
203 |
TInt err = 0; |
|
204 |
CleanupStack::PushL(this); |
|
205 |
if( iCallback ) |
|
206 |
{ |
|
207 |
if( iEventParamList ) |
|
208 |
{ |
|
209 |
iEventParamList->Reset(); |
|
210 |
} |
|
211 |
else |
|
212 |
{ |
|
213 |
iEventParamList = CLiwGenericParamList::NewL(); |
|
214 |
} |
|
215 |
//Append Error Code |
|
216 |
TInt32 sapiError = CContactInterface::SapiError(aError); |
|
217 |
iEventParamList->AppendL(TLiwGenericParam( KErrorCode, |
|
218 |
TLiwVariant((TInt32)sapiError))); |
|
219 |
||
220 |
if(aIter) |
|
221 |
{ |
|
222 |
CContactIterator* iterator=CContactIterator::NewL(aIter); |
|
223 |
CleanupStack::PushL(iterator); |
|
224 |
//Append Iterator in case it is valid |
|
225 |
iEventParamList->AppendL(TLiwGenericParam(KReturnValue, |
|
226 |
TLiwVariant(iterator))); |
|
227 |
iterator->DecRef(); |
|
228 |
CleanupStack::Pop(iterator); |
|
229 |
} |
|
230 |
||
231 |
//Call HandleNotify |
|
232 |
TRAP(err,iCallback->HandleNotifyL(aTransId, |
|
233 |
KLiwEventCompleted, |
|
234 |
*iEventParamList, |
|
235 |
*iInParamList)); |
|
236 |
} |
|
237 |
CleanupStack::PopAndDestroy(this); |
|
238 |
} |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
239 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
240 |
void CContactInterfaceCallback :: 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
|
241 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
242 |
TInt err = 0; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
243 |
CleanupStack::PushL(this); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
244 |
if( iCallback ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
245 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
246 |
if( iEventParamList ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
247 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
248 |
iEventParamList->Reset(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
249 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
250 |
else |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
251 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
252 |
iEventParamList = CLiwGenericParamList::NewL(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
253 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
254 |
//Append Error Code |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
255 |
TInt32 sapiError = CContactInterface::SapiError(aError); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
256 |
iEventParamList->AppendL(TLiwGenericParam( KErrorCode, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
257 |
TLiwVariant((TInt32)sapiError))); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
258 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
259 |
if(acntId) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
260 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
261 |
HBufC* cntIdUnicode = HBufC::NewL(acntId->Length()); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
262 |
CleanupStack :: PushL(cntIdUnicode); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
263 |
cntIdUnicode->Des().Copy(*acntId); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
264 |
delete acntId; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
265 |
acntId = NULL; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
266 |
ContactIDToUTF(cntIdUnicode); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
267 |
iEventParamList->AppendL(TLiwGenericParam(KReturnValue, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
268 |
TLiwVariant(*cntIdUnicode))); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
269 |
CleanupStack :: Pop(cntIdUnicode); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
270 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
271 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
272 |
//Call HandleNotify |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
273 |
TRAP(err,iCallback->HandleNotifyL(aTransId, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
274 |
KLiwEventCompleted, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
275 |
*iEventParamList, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
276 |
*iInParamList)); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
277 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
278 |
CleanupStack::PopAndDestroy(this); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
279 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
280 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
281 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
282 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
283 |
void CContactInterfaceCallback::HandleReturnArray(const TInt& aError, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
284 |
RPointerArray<HBufC8>& aArray, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
285 |
TInt aTransId) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
286 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
287 |
TInt err = 0; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
288 |
CleanupStack::PushL(this); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
289 |
if( iCallback ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
290 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
291 |
if( iEventParamList ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
292 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
293 |
iEventParamList->Reset(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
294 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
295 |
else |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
296 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
297 |
iEventParamList = CLiwGenericParamList::NewL(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
298 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
299 |
//Append Error Code |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
300 |
TInt32 sapiError = CContactInterface::SapiError(aError); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
301 |
iEventParamList->AppendL(TLiwGenericParam( KErrorCode, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
302 |
TLiwVariant((TInt32)sapiError))); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
303 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
304 |
if(aArray.Count() > 0) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
305 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
306 |
CLiwList* IdList = NULL; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
307 |
TLiwVariant outputVal; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
308 |
TInt count = aArray.Count(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
309 |
TInt i; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
310 |
IdList = CLiwDefaultList::NewL(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
311 |
for(i=0; i<count; i++) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
312 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
313 |
TDesC8* idVal = aArray[i]; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
314 |
HBufC8* idBufVal = idVal->AllocL(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
315 |
HBufC* cntIdUnicode = HBufC::NewL(idBufVal->Length()); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
316 |
CleanupStack :: PushL(cntIdUnicode); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
317 |
cntIdUnicode->Des().Copy(*idBufVal); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
318 |
delete idBufVal; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
319 |
idBufVal = NULL; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
320 |
ContactIDToUTF(cntIdUnicode); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
321 |
outputVal.Set(*cntIdUnicode); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
322 |
IdList->AppendL(outputVal); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
323 |
CleanupStack :: Pop(cntIdUnicode); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
324 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
325 |
CLiwMap* pFieldLinkedMap = CLiwDefaultMap::NewL(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
326 |
CleanupClosePushL(*pFieldLinkedMap); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
327 |
pFieldLinkedMap->InsertL(KIdsLabel,TLiwVariant(IdList)); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
328 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
329 |
//Append Iterator in case it is valid |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
330 |
iEventParamList->AppendL(TLiwGenericParam(KReturnValue, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
331 |
TLiwVariant(pFieldLinkedMap))); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
332 |
CleanupStack::PopAndDestroy(pFieldLinkedMap); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
333 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
334 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
335 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
336 |
//Call HandleNotify |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
337 |
TRAP(err,iCallback->HandleNotifyL(aTransId, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
338 |
KLiwEventCompleted, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
339 |
*iEventParamList, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
340 |
*iInParamList)); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
341 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
342 |
CleanupStack::PopAndDestroy(this); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
343 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
344 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
345 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
346 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
347 |
void CContactInterfaceCallback :: ContactIDToUTF(HBufC* aContactID) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
348 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
349 |
TInt len = aContactID->Length(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
350 |
TUint16* ptr16 = const_cast<TUint16*> (aContactID->Des().Ptr()); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
351 |
for(TInt i=0; i<len; i++) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
352 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
353 |
ptr16[i] = ptr16[i] | 0xE000; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
354 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
355 |
} |