author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:15:33 +0300 | |
branch | RCL_3 |
changeset 85 | 38bb213f60ba |
parent 63 | f4a778e096c2 |
permissions | -rw-r--r-- |
63 | 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 "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: A contact adapter between VPbk framework and VPbkSimStoreImpl |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDES |
|
20 |
#include "CContact.h" |
|
21 |
||
22 |
#include "CContactStore.h" |
|
23 |
#include "CFieldTypeMappings.h" |
|
24 |
#include "CViewContact.h" |
|
25 |
#include "MVPbkContactObserver.h" |
|
26 |
#include "CSupportedFieldTypes.h" |
|
27 |
#include "CContactOperationCallback.h" |
|
28 |
#include "VPbkSimStoreError.h" |
|
29 |
||
30 |
#include <CVPbkAsyncOperation.h> |
|
31 |
#include <CVPbkContactLinkArray.h> |
|
32 |
#include <CVPbkSimContact.h> |
|
33 |
#include <MVPbkSimCntStore.h> |
|
34 |
#include <MVPbkContactViewBase.h> |
|
35 |
#include <MVPbkContactStoreProperties.h> |
|
36 |
#include <RVPbkStreamedIntArray.h> |
|
37 |
#include <TVPbkSimStoreProperty.h> |
|
38 |
#include <VPbkSimCntFieldTypes.hrh> |
|
39 |
#include <MVPbkSimStoreOperation.h> |
|
40 |
#include <VPbkError.h> |
|
41 |
#include <MVPbkStoreContactProperties.h> |
|
42 |
||
43 |
namespace { |
|
44 |
||
45 |
// MODULE DATA STRUCTURES |
|
46 |
enum TContactFlags |
|
47 |
{ |
|
48 |
KNewContact = 1 |
|
49 |
}; |
|
50 |
||
51 |
// ============================= LOCAL FUNCTIONS =============================== |
|
52 |
||
53 |
MVPbkContactObserver::TContactOp ConvertContactOperation( |
|
54 |
MVPbkSimContactObserver::TEvent aEvent ) |
|
55 |
{ |
|
56 |
MVPbkContactObserver::TContactOp op = |
|
57 |
MVPbkContactObserver::EContactOperationUnknown; |
|
58 |
switch ( aEvent ) |
|
59 |
{ |
|
60 |
case MVPbkSimContactObserver::EDelete: |
|
61 |
{ |
|
62 |
op = MVPbkContactObserver::EContactDelete; |
|
63 |
break; |
|
64 |
} |
|
65 |
case MVPbkSimContactObserver::ESave: |
|
66 |
{ |
|
67 |
op = MVPbkContactObserver::EContactCommit; |
|
68 |
break; |
|
69 |
} |
|
70 |
default: |
|
71 |
{ |
|
72 |
op = MVPbkContactObserver::EContactOperationUnknown; |
|
73 |
break; |
|
74 |
} |
|
75 |
} |
|
76 |
return op; |
|
77 |
} |
|
78 |
||
79 |
TInt MaxNumberOfFieldsInContact( TVPbkSimCntFieldType aType, |
|
80 |
TVPbkUSimStoreProperty& aUsimProp ) |
|
81 |
{ |
|
82 |
TInt result = 0; |
|
83 |
switch ( aType ) |
|
84 |
{ |
|
85 |
case EVPbkSimReading: // FALLTHROUGH |
|
86 |
case EVPbkSimNickName: // FALLTHROUGH |
|
87 |
case EVPbkSimName: |
|
88 |
{ |
|
89 |
++result; // only one name field can exist |
|
90 |
break; |
|
91 |
} |
|
92 |
case EVPbkSimEMailAddress: |
|
93 |
{ |
|
94 |
if (aUsimProp.iMaxNumOfEmails != KVPbkSimStorePropertyUndefined) |
|
95 |
{ |
|
96 |
result = aUsimProp.iMaxNumOfEmails; |
|
97 |
} |
|
98 |
break; |
|
99 |
} |
|
100 |
case EVPbkSimGsmNumber: // FALLTHROUGH |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
101 |
case EVPbkSimAdditionalNumber: |
63 | 102 |
{ |
103 |
++result; // always at least one number |
|
104 |
if ( aUsimProp.iMaxNumOfAnrs != KVPbkSimStorePropertyUndefined ) |
|
105 |
{ |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
106 |
result += aUsimProp.iMaxNumOfAnrs; |
63 | 107 |
} |
108 |
break; |
|
109 |
} |
|
110 |
default: |
|
111 |
{ |
|
112 |
// Do nothing |
|
113 |
break; |
|
114 |
} |
|
115 |
} |
|
116 |
return result; |
|
117 |
} |
|
118 |
} |
|
119 |
||
120 |
namespace VPbkSimStore { |
|
121 |
||
122 |
// ============================ MEMBER FUNCTIONS =============================== |
|
123 |
||
124 |
// ----------------------------------------------------------------------------- |
|
125 |
// CContact::CContact |
|
126 |
// C++ default constructor can NOT contain any code, that |
|
127 |
// might leave. |
|
128 |
// ----------------------------------------------------------------------------- |
|
129 |
// |
|
130 |
inline CContact::CContact( CContactStore& aParentStore ) |
|
131 |
: iParentStore( aParentStore ) |
|
132 |
{ |
|
133 |
} |
|
134 |
||
135 |
// ----------------------------------------------------------------------------- |
|
136 |
// CContact::ConstructL |
|
137 |
// Symbian 2nd phase constructor can leave. |
|
138 |
// ----------------------------------------------------------------------------- |
|
139 |
// |
|
140 |
inline void CContact::ConstructL( CVPbkSimContact& aSimContact, |
|
141 |
TBool aIsNewContact ) |
|
142 |
{ |
|
143 |
if ( aIsNewContact ) |
|
144 |
{ |
|
145 |
iFlags.Set( KNewContact ); |
|
146 |
} |
|
147 |
iFields.SetContact( *this, aSimContact ); |
|
148 |
iAsyncOp = new( ELeave ) VPbkEngUtils::CVPbkAsyncOperation; |
|
149 |
} |
|
150 |
||
151 |
// ----------------------------------------------------------------------------- |
|
152 |
// CContact::NewL |
|
153 |
// Two-phased constructor. |
|
154 |
// ----------------------------------------------------------------------------- |
|
155 |
// |
|
156 |
CContact* CContact::NewL( CContactStore& aParentStore, |
|
157 |
CVPbkSimContact* aSimContact, TBool aIsNewContact ) |
|
158 |
{ |
|
159 |
CContact* self = new ( ELeave ) CContact( aParentStore ); |
|
160 |
CleanupStack::PushL(self); |
|
161 |
self->ConstructL( *aSimContact, aIsNewContact ); |
|
162 |
CleanupStack::Pop( self ); |
|
163 |
// Take ownership after construction |
|
164 |
self->iSimContact = aSimContact; |
|
165 |
return self; |
|
166 |
} |
|
167 |
||
168 |
// Destructor |
|
169 |
CContact::~CContact() |
|
170 |
{ |
|
171 |
delete iStoreOperation; |
|
172 |
delete iAsyncOp; |
|
173 |
delete iSimContact; |
|
174 |
} |
|
175 |
||
176 |
// ----------------------------------------------------------------------------- |
|
177 |
// CContact::ParentObject |
|
178 |
// ----------------------------------------------------------------------------- |
|
179 |
// |
|
180 |
MVPbkObjectHierarchy& CContact::ParentObject() const |
|
181 |
{ |
|
182 |
return iParentStore; |
|
183 |
} |
|
184 |
||
185 |
// ----------------------------------------------------------------------------- |
|
186 |
// CContact::ConstFields |
|
187 |
// ----------------------------------------------------------------------------- |
|
188 |
// |
|
189 |
const MVPbkStoreContactFieldCollection& CContact::Fields() const |
|
190 |
{ |
|
191 |
return iFields; |
|
192 |
} |
|
193 |
||
194 |
// ----------------------------------------------------------------------------- |
|
195 |
// CContact::IsSame |
|
196 |
// ----------------------------------------------------------------------------- |
|
197 |
// |
|
198 |
TBool CContact::IsSame( const MVPbkStoreContact& aOtherContact ) const |
|
199 |
{ |
|
200 |
if ( &ParentStore() == &aOtherContact.ParentStore() ) |
|
201 |
{ |
|
202 |
const CContact& otherCnt = static_cast<const CContact&>( aOtherContact ); |
|
203 |
return otherCnt.SimContact().SimIndex() == iSimContact->SimIndex(); |
|
204 |
} |
|
205 |
return EFalse; |
|
206 |
} |
|
207 |
||
208 |
// ----------------------------------------------------------------------------- |
|
209 |
// CContact::CreateLinkLC |
|
210 |
// ----------------------------------------------------------------------------- |
|
211 |
// |
|
212 |
MVPbkContactLink* CContact::CreateLinkLC() const |
|
213 |
{ |
|
214 |
return iParentStore.CreateLinkLC( iSimContact->SimIndex() ); |
|
215 |
} |
|
216 |
||
217 |
// ----------------------------------------------------------------------------- |
|
218 |
// CContact::DeleteL |
|
219 |
// ----------------------------------------------------------------------------- |
|
220 |
// |
|
221 |
void CContact::DeleteL( MVPbkContactObserver& aObserver ) const |
|
222 |
{ |
|
223 |
if ( iStoreOperation ) |
|
224 |
{ |
|
225 |
User::Leave( KErrInUse ); |
|
226 |
} |
|
227 |
||
228 |
// From the client point of view the MVPbkStoreContact is constant but |
|
229 |
// implementation needs a non const contact. |
|
230 |
RVPbkStreamedIntArray indexArray; |
|
231 |
CleanupClosePushL( indexArray ); |
|
232 |
indexArray.AppendIntL(iSimContact->SimIndex() ); |
|
233 |
iStoreOperation = iParentStore.NativeStore().DeleteL( indexArray, |
|
234 |
const_cast<CContact&>(*this)); |
|
235 |
iObserver = &aObserver; |
|
236 |
CleanupStack::PopAndDestroy(); // indexArray |
|
237 |
} |
|
238 |
||
239 |
// ----------------------------------------------------------------------------- |
|
240 |
// CContact::MatchContactStore |
|
241 |
// ----------------------------------------------------------------------------- |
|
242 |
// |
|
243 |
TBool CContact::MatchContactStore(const TDesC& aContactStoreUri) const |
|
244 |
{ |
|
245 |
return iParentStore.MatchContactStore(aContactStoreUri); |
|
246 |
} |
|
247 |
||
248 |
// ----------------------------------------------------------------------------- |
|
249 |
// CContact::MatchContactStoreDomain |
|
250 |
// ----------------------------------------------------------------------------- |
|
251 |
// |
|
252 |
TBool CContact::MatchContactStoreDomain(const TDesC& aContactStoreDomain) const |
|
253 |
{ |
|
254 |
return iParentStore.MatchContactStoreDomain(aContactStoreDomain); |
|
255 |
} |
|
256 |
||
257 |
// ----------------------------------------------------------------------------- |
|
258 |
// CContact::CreateBookmarkLC |
|
259 |
// ----------------------------------------------------------------------------- |
|
260 |
// |
|
261 |
MVPbkContactBookmark* CContact::CreateBookmarkLC() const |
|
262 |
{ |
|
263 |
return iParentStore.CreateBookmarkLC( iSimContact->SimIndex() ); |
|
264 |
} |
|
265 |
||
266 |
// ----------------------------------------------------------------------------- |
|
267 |
// CContact::ParentStore |
|
268 |
// ----------------------------------------------------------------------------- |
|
269 |
// |
|
270 |
MVPbkContactStore& CContact::ParentStore() const |
|
271 |
{ |
|
272 |
return iParentStore; |
|
273 |
} |
|
274 |
||
275 |
// ----------------------------------------------------------------------------- |
|
276 |
// CContact::Fields |
|
277 |
// ----------------------------------------------------------------------------- |
|
278 |
// |
|
279 |
MVPbkStoreContactFieldCollection& CContact::Fields() |
|
280 |
{ |
|
281 |
return iFields; |
|
282 |
} |
|
283 |
||
284 |
// ----------------------------------------------------------------------------- |
|
285 |
// CContact::CreateFieldLC |
|
286 |
// ----------------------------------------------------------------------------- |
|
287 |
// |
|
288 |
MVPbkStoreContactField* CContact::CreateFieldLC( |
|
289 |
const MVPbkFieldType& aFieldType ) const |
|
290 |
{ |
|
291 |
if ( !iParentStore.SupportedFieldTypes().ContainsSame( aFieldType ) ) |
|
292 |
{ |
|
293 |
// According to contact API the function must leave if |
|
294 |
// the type is invalid |
|
295 |
User::Leave( KErrNotSupported ); |
|
296 |
} |
|
297 |
TVPbkSimCntFieldType simType = |
|
298 |
iParentStore.FieldTypeMappings().Match( aFieldType ); |
|
299 |
||
300 |
__ASSERT_DEBUG( simType != EVPbkSimUnknownType, |
|
301 |
VPbkSimStore::Panic( ESimFieldTypeNotFound ) ); |
|
302 |
||
303 |
if ( simType == EVPbkSimGsmNumber || |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
304 |
simType == EVPbkSimAdditionalNumber ) |
63 | 305 |
{ |
306 |
// EVPbkSimGsmNumber and EVPbkSimAdditionalNumber maps to same |
|
307 |
// VPbk field type. A sim contact can have only one EVPbkSimGsmNumber |
|
308 |
// field type and possibly many EVPbkSimAdditionalNumber types |
|
309 |
// depending on the USIM store. |
|
310 |
// However, if SIM card doesn't support additional number it is allowed |
|
311 |
// to create as many EVPbkSimGsmNumber fields as client wants. This |
|
312 |
// is needed to enable temporary contacts that holds multiple numbers. |
|
313 |
CVPbkSimContact::TFieldLookup lookup = |
|
314 |
iSimContact->FindField( EVPbkSimGsmNumber ); |
|
315 |
if ( lookup.EndOfLookup() || |
|
316 |
!( iParentStore.SimStoreCapabilities() & |
|
317 |
VPbkSimStoreImpl::KAdditionalNumUsed )) |
|
318 |
{ |
|
319 |
simType = EVPbkSimGsmNumber; |
|
320 |
} |
|
321 |
else |
|
322 |
{ |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
323 |
simType = EVPbkSimAdditionalNumber; |
63 | 324 |
} |
325 |
} |
|
326 |
||
327 |
CVPbkSimCntField* field = iSimContact->CreateFieldLC( simType ); |
|
328 |
TContactNewField* fieldWrapper = new( ELeave ) TContactNewField( field ); |
|
329 |
fieldWrapper->SetParentContact( const_cast<CContact&>( *this ) ); |
|
330 |
CleanupStack::Pop( field ); |
|
331 |
CleanupDeletePushL( fieldWrapper ); |
|
332 |
return fieldWrapper; |
|
333 |
} |
|
334 |
||
335 |
// ----------------------------------------------------------------------------- |
|
336 |
// CContact::AddFieldL |
|
337 |
// ----------------------------------------------------------------------------- |
|
338 |
// |
|
339 |
TInt CContact::AddFieldL( MVPbkStoreContactField* aField ) |
|
340 |
{ |
|
341 |
__ASSERT_ALWAYS( aField, VPbkError::Panic( VPbkError::ENullContactField ) ); |
|
342 |
// Test that the client gives this contact's field and doesn't pass |
|
343 |
// an existing field of this contact as a new one |
|
344 |
__ASSERT_ALWAYS( &aField->ParentContact() == this && |
|
345 |
aField != iFields.FieldPointer(), |
|
346 |
VPbkError::Panic( VPbkError::EInvalidContactField ) ); |
|
347 |
||
348 |
// Now the wrapper is casted back |
|
349 |
TContactNewField* fieldWrapper = static_cast<TContactNewField*>( aField ); |
|
350 |
// Takes ownership of the field from the wrapper |
|
351 |
CVPbkSimCntField* field = fieldWrapper->SimField(); |
|
352 |
CleanupStack::PushL( field ); |
|
353 |
// Add sim field to sim contact. Contact owns the field now. |
|
354 |
iSimContact->AddFieldL( field ); |
|
355 |
CleanupStack::Pop( field ); |
|
356 |
// After this the function must not leave because client has created |
|
357 |
// the fieldWrapper with CreateFieldLC and it's in the CleanupStack |
|
358 |
// Client pops the fieldWrapper after this function |
|
359 |
delete fieldWrapper; |
|
360 |
// The field is appended to the array -> return the last field index. |
|
361 |
return iSimContact->FieldCount() - 1; |
|
362 |
} |
|
363 |
||
364 |
// ----------------------------------------------------------------------------- |
|
365 |
// CContact::RemoveField |
|
366 |
// ----------------------------------------------------------------------------- |
|
367 |
// |
|
368 |
void CContact::RemoveField( TInt aIndex ) |
|
369 |
{ |
|
370 |
__ASSERT_ALWAYS( aIndex >= 0 && aIndex < iFields.FieldCount(), |
|
371 |
VPbkError::Panic(VPbkError::EInvalidFieldIndex) ); |
|
372 |
__ASSERT_ALWAYS( !iParentStore.StoreProperties().ReadOnly(), |
|
373 |
VPbkError::Panic(VPbkError::EInvalidAccessToReadOnlyContact ) ); |
|
374 |
||
375 |
iSimContact->DeleteField( aIndex ); |
|
376 |
} |
|
377 |
||
378 |
// ----------------------------------------------------------------------------- |
|
379 |
// CContact::RemoveAllFields |
|
380 |
// ----------------------------------------------------------------------------- |
|
381 |
// |
|
382 |
void CContact::RemoveAllFields() |
|
383 |
{ |
|
384 |
__ASSERT_ALWAYS( !iParentStore.StoreProperties().ReadOnly(), |
|
385 |
VPbkError::Panic(VPbkError::EInvalidAccessToReadOnlyContact ) ); |
|
386 |
||
387 |
iSimContact->DeleteAllFields(); |
|
388 |
} |
|
389 |
||
390 |
// ----------------------------------------------------------------------------- |
|
391 |
// CContact::LockL |
|
392 |
// ----------------------------------------------------------------------------- |
|
393 |
// |
|
394 |
void CContact::LockL( MVPbkContactObserver& aObserver ) const |
|
395 |
{ |
|
396 |
MVPbkContactObserver::TContactOpResult opResult; |
|
397 |
opResult.iExtension = NULL; |
|
398 |
opResult.iOpCode = MVPbkContactObserver::EContactLock; |
|
399 |
opResult.iStoreContact = NULL; |
|
400 |
||
401 |
CContactOperationCallback* callBack = |
|
402 |
new( ELeave ) CContactOperationCallback( opResult, aObserver, |
|
403 |
KErrNone ); |
|
404 |
CleanupStack::PushL( callBack ); |
|
405 |
iAsyncOp->CallbackL( callBack ); |
|
406 |
CleanupStack::Pop( callBack ); |
|
407 |
iLocked = ETrue; |
|
408 |
} |
|
409 |
||
410 |
// ----------------------------------------------------------------------------- |
|
411 |
// CContact::CommitL |
|
412 |
// ----------------------------------------------------------------------------- |
|
413 |
// |
|
414 |
void CContact::CommitL( MVPbkContactObserver& aObserver ) const |
|
415 |
{ |
|
416 |
if ( iLocked || iFlags.IsSet( KNewContact )) |
|
417 |
{ |
|
418 |
if ( iStoreOperation ) |
|
419 |
{ |
|
420 |
User::Leave( KErrInUse ); |
|
421 |
} |
|
422 |
// From the client point of view the MVPbkStoreContact is constant but |
|
423 |
// implementation needs a non const contact. |
|
424 |
iStoreOperation = iSimContact->SaveL( const_cast<CContact&>( *this )); |
|
425 |
iObserver = &aObserver; |
|
426 |
} |
|
427 |
else |
|
428 |
{ |
|
429 |
// Virtual Phonebook API demands that contact must be locked before |
|
430 |
// CommitL. Sim Store has to behave according to that and |
|
431 |
// complete with KErrAccessDenied. |
|
432 |
MVPbkContactObserver::TContactOpResult opResult; |
|
433 |
opResult.iExtension = NULL; |
|
434 |
opResult.iOpCode = MVPbkContactObserver::EContactCommit; |
|
435 |
opResult.iStoreContact = NULL; |
|
436 |
CContactOperationCallback* callBack = |
|
437 |
new( ELeave ) CContactOperationCallback( |
|
438 |
opResult, aObserver, KErrAccessDenied ); |
|
439 |
CleanupStack::PushL( callBack ); |
|
440 |
iAsyncOp->CallbackL( callBack ); |
|
441 |
CleanupStack::Pop( callBack ); |
|
442 |
} |
|
443 |
} |
|
444 |
||
445 |
// ----------------------------------------------------------------------------- |
|
446 |
// CContact::GroupsJoinedLC |
|
447 |
// ----------------------------------------------------------------------------- |
|
448 |
// |
|
449 |
MVPbkContactLinkArray* CContact::GroupsJoinedLC() const |
|
450 |
{ |
|
451 |
return CVPbkContactLinkArray::NewLC(); |
|
452 |
} |
|
453 |
||
454 |
// ----------------------------------------------------------------------------- |
|
455 |
// CContact::Group |
|
456 |
// ----------------------------------------------------------------------------- |
|
457 |
// |
|
458 |
MVPbkContactGroup* CContact::Group() |
|
459 |
{ |
|
460 |
return NULL; |
|
461 |
} |
|
462 |
||
463 |
// ----------------------------------------------------------------------------- |
|
464 |
// CContact::MaxNumberOfFieldL |
|
465 |
// ----------------------------------------------------------------------------- |
|
466 |
// |
|
467 |
TInt CContact::MaxNumberOfFieldL( const MVPbkFieldType& aType ) const |
|
468 |
{ |
|
469 |
TInt res = 0; |
|
470 |
TVPbkSimCntFieldType nativeType = |
|
471 |
iParentStore.FieldTypeMappings().Match( aType ); |
|
472 |
if ( nativeType != EVPbkSimUnknownType ) |
|
473 |
{ |
|
474 |
TVPbkUSimStoreProperty usimProp; |
|
475 |
User::LeaveIfError(iParentStore.NativeStore().GetUSimStoreProperties( |
|
476 |
usimProp )); |
|
477 |
res = MaxNumberOfFieldsInContact( nativeType, usimProp ); |
|
478 |
} |
|
479 |
return res; |
|
480 |
} |
|
481 |
||
482 |
// ----------------------------------------------------------------------------- |
|
483 |
// CContact::ContactEventComplete |
|
484 |
// ----------------------------------------------------------------------------- |
|
485 |
// |
|
486 |
void CContact::ContactEventComplete( TEvent aEvent, |
|
487 |
CVPbkSimContact* /*aContact*/ ) |
|
488 |
{ |
|
489 |
__ASSERT_DEBUG( iObserver, Panic(EPreCond_CContact_ContactEventComplete)); |
|
490 |
||
491 |
delete iStoreOperation; |
|
492 |
iStoreOperation = NULL; |
|
493 |
||
494 |
MVPbkContactObserver::TContactOpResult vpbkOpResult; |
|
495 |
vpbkOpResult.iStoreContact = NULL; |
|
496 |
vpbkOpResult.iExtension = NULL; |
|
497 |
vpbkOpResult.iOpCode = ConvertContactOperation( aEvent ); |
|
498 |
||
499 |
MVPbkContactObserver* observer = iObserver; |
|
500 |
ResetContactOperationState(); |
|
501 |
observer->ContactOperationCompleted( vpbkOpResult ); |
|
502 |
} |
|
503 |
||
504 |
// ----------------------------------------------------------------------------- |
|
505 |
// CContact::ContactEventError |
|
506 |
// ----------------------------------------------------------------------------- |
|
507 |
// |
|
508 |
void CContact::ContactEventError( TEvent aEvent, |
|
509 |
CVPbkSimContact* /*aContact*/, TInt aError ) |
|
510 |
{ |
|
511 |
__ASSERT_DEBUG( iObserver, Panic(EPreCond_CContact_ContactEventError)); |
|
512 |
||
513 |
delete iStoreOperation; |
|
514 |
iStoreOperation = NULL; |
|
515 |
||
516 |
MVPbkContactObserver* observer = iObserver; |
|
517 |
ResetContactOperationState(); |
|
518 |
MVPbkContactObserver::TContactOp op = ConvertContactOperation( aEvent ); |
|
519 |
observer->ContactOperationFailed( op, aError, EFalse ); |
|
520 |
} |
|
521 |
||
522 |
// ----------------------------------------------------------------------------- |
|
523 |
// CContact::ResetContactOperationState |
|
524 |
// ----------------------------------------------------------------------------- |
|
525 |
// |
|
526 |
void CContact::ResetContactOperationState() |
|
527 |
{ |
|
528 |
iObserver = NULL; |
|
529 |
} |
|
530 |
||
531 |
TAny* CContact::StoreContactExtension(TUid aExtensionUid) |
|
532 |
{ |
|
533 |
||
534 |
if( aExtensionUid == KMVPbkStoreContactExtension2Uid ) |
|
535 |
return static_cast<MVPbkStoreContact2*>( this ); |
|
536 |
return NULL; |
|
537 |
} |
|
538 |
||
539 |
||
540 |
||
541 |
MVPbkStoreContactProperties* CContact::PropertiesL() const |
|
542 |
{ |
|
543 |
//sim store doesn't support any of MVPbkStoreContactProperties functions |
|
544 |
return NULL; |
|
545 |
} |
|
546 |
||
547 |
void CContact::SetAsOwnL( MVPbkContactObserver& /*aObserver*/ ) const |
|
548 |
{ |
|
549 |
// own link is not supported in sim store |
|
550 |
User::Leave( KErrNotSupported ); |
|
551 |
} |
|
552 |
||
553 |
} // namespace VPbkSimStore |
|
554 |
||
555 |
// end of file |
|
556 |