|
1 /* |
|
2 * Copyright (c) 2010 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: Easy dialing contact data manager. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <e32std.h> |
|
19 #include <fbs.h> |
|
20 #include <CPbk2ImageManager.h> |
|
21 #include <CVPbkContactManager.h> |
|
22 #include <MVPbkContactStoreList.h> |
|
23 #include <MVPbkContactLink.h> |
|
24 #include <CPbk2StoreConfiguration.h> |
|
25 #include <CVPbkContactStoreUriArray.h> |
|
26 #include <VPbkContactStoreUris.h> |
|
27 #include <TVPbkContactStoreUriPtr.h> |
|
28 #include <CVPbkTopContactManager.h> |
|
29 #include <MVPbkContactOperationBase.h> |
|
30 #include <TVPbkStoreContactAnalyzer.h> |
|
31 #include <MVPbkFieldType.h> |
|
32 #include <VPbkEng.rsg> |
|
33 #include <MVPbkContactViewBase.h> |
|
34 #include <MVPbkBaseContactFieldCollection.h> |
|
35 #include <MVPbkContactFieldTextData.h> |
|
36 #include <MVPbkContactFieldData.h> |
|
37 #include <CVPbkContactLinkArray.h> |
|
38 #include <MVPbkContactLink.h> |
|
39 #include <MVPbkContactOperationBase.h> |
|
40 #include <MVPbkOperationObserver.h> |
|
41 #include <MVPbkContactStore.h> |
|
42 #include <MVPbkContactStoreProperties.h> |
|
43 #include <MVPbkStoreContact.h> |
|
44 #include <PbkGlobalSettingFactory.h> |
|
45 #include <centralrepository.h> |
|
46 |
|
47 #include "easydialingcontactdata.h" |
|
48 #include "easydialingcontactdatamanager.h" |
|
49 #include "easydialingutils.h" |
|
50 #include "mcontactdatamanagerobserver.h" |
|
51 #include "easydialingcrkeys.h" |
|
52 #include "easydialinglogger.h" |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // CEasyDialingContactDataManager::NewL |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 CEasyDialingContactDataManager* CEasyDialingContactDataManager::NewL() |
|
59 { |
|
60 CEasyDialingContactDataManager* self = |
|
61 new ( ELeave ) CEasyDialingContactDataManager(); |
|
62 CleanupStack::PushL( self ); |
|
63 self->ConstructL(); |
|
64 CleanupStack::Pop( self ); |
|
65 return self; |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------------------------- |
|
69 // CEasyDialingContactDataManager::CEasyDialingContactDataManager |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 CEasyDialingContactDataManager::CEasyDialingContactDataManager() |
|
73 : iPbkStoreConfiguration(NULL), |
|
74 iImageOperation(NULL), |
|
75 iContactManager(NULL), |
|
76 iContactOperation(NULL), |
|
77 iContactThumbnailSetting(ETrue), |
|
78 iStoreReady(EFalse) |
|
79 { |
|
80 } |
|
81 |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // CEasyDialingContactDataManager::~CEasyDialingContactDataManager |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 CEasyDialingContactDataManager::~CEasyDialingContactDataManager() |
|
88 { |
|
89 Reset(); |
|
90 iWaitingContacts.Close(); |
|
91 iContactDataArray.Close(); |
|
92 delete iImageManager; |
|
93 delete iVPbkTopContactManager; |
|
94 delete iImageOperation; |
|
95 delete iContactOperation; |
|
96 delete iFavsView; |
|
97 |
|
98 if ( iContactManager ) |
|
99 { |
|
100 TRAP_IGNORE( iContactManager->ContactStoresL().CloseAll( *this ) ); |
|
101 } |
|
102 delete iContactManager; |
|
103 |
|
104 if ( iPbkStoreConfiguration ) |
|
105 { |
|
106 iPbkStoreConfiguration->RemoveObserver( *this ); |
|
107 } |
|
108 delete iPbkStoreConfiguration; |
|
109 |
|
110 if ( iPbkSettings ) |
|
111 { |
|
112 iPbkSettings->Close(); |
|
113 } |
|
114 delete iPbkSettings; |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // CEasyDialingContactDataManager::ConstructL |
|
119 // --------------------------------------------------------------------------- |
|
120 // |
|
121 void CEasyDialingContactDataManager::ConstructL() |
|
122 { |
|
123 // Create contact store configuration handler |
|
124 iPbkStoreConfiguration = CPbk2StoreConfiguration::NewL(); |
|
125 iPbkStoreConfiguration->AddObserverL( *this ); |
|
126 |
|
127 // Create manager for all the supported contact stores |
|
128 CVPbkContactStoreUriArray* supportedStores = |
|
129 iPbkStoreConfiguration->SupportedStoreConfigurationL(); |
|
130 CleanupStack::PushL( supportedStores ); |
|
131 iContactManager = CVPbkContactManager::NewL( *supportedStores ); |
|
132 CleanupStack::PopAndDestroy( supportedStores ); |
|
133 |
|
134 // Open the stores and start observing them |
|
135 iContactManager->ContactStoresL().OpenAllL( *this ); |
|
136 |
|
137 iImageManager = CPbk2ImageManager::NewL(*iContactManager); |
|
138 |
|
139 iVPbkTopContactManager = CVPbkTopContactManager::NewL( *iContactManager ); |
|
140 |
|
141 iImageManagerParams.iFlags = TPbk2ImageManagerParams::EScaleImage | TPbk2ImageManagerParams::EKeepAspectRatio; |
|
142 iThumbnailFieldType = iContactManager->FieldTypes().Find( R_VPBK_FIELD_TYPE_THUMBNAILPIC ); |
|
143 |
|
144 // Read easydialing setting from cenrep. |
|
145 CRepository* cenrep = CRepository::NewL( KCRUidEasyDialSettings ); |
|
146 CleanupStack::PushL( cenrep ); |
|
147 User::LeaveIfError( cenrep->Get( KEasyDialingContactThumbnails, iContactThumbnailSetting ) ); |
|
148 CleanupStack::PopAndDestroy( cenrep ); |
|
149 |
|
150 // Start observing Phoenbook setting for the name order |
|
151 iPbkSettings = PbkGlobalSettingFactory::CreatePersistentSettingL(); |
|
152 iPbkSettings->ConnectL( MPbkGlobalSetting::EGeneralSettingCategory ); |
|
153 iPbkSettings->RegisterObserverL( this ); |
|
154 |
|
155 // Get name order from Phonebook settings |
|
156 UpdateNameOrderL(); |
|
157 |
|
158 // Check if store with favourites is configured to be searched. |
|
159 SetupFavStoreSearchedL(); |
|
160 } |
|
161 |
|
162 // --------------------------------------------------------------------------- |
|
163 // CEasyDialingContactDataManager::SetObserver |
|
164 // --------------------------------------------------------------------------- |
|
165 // |
|
166 void CEasyDialingContactDataManager::SetObserver(MContactDataManagerObserver* aObserver) |
|
167 { |
|
168 iObserver = aObserver; |
|
169 } |
|
170 |
|
171 // --------------------------------------------------------------------------- |
|
172 // CEasyDialingContactDataManager::ContactManager |
|
173 // --------------------------------------------------------------------------- |
|
174 // |
|
175 CVPbkContactManager& CEasyDialingContactDataManager::ContactManager() |
|
176 { |
|
177 return *iContactManager; |
|
178 } |
|
179 |
|
180 // --------------------------------------------------------------------------- |
|
181 // CEasyDialingContactDataManager::SetThumbnailSize |
|
182 // --------------------------------------------------------------------------- |
|
183 // |
|
184 void CEasyDialingContactDataManager::SetThumbnailSize(const TSize& aSize) |
|
185 { |
|
186 if (iImageManagerParams.iSize != aSize) |
|
187 { |
|
188 iImageManagerParams.iSize = aSize; |
|
189 Reload(); |
|
190 } |
|
191 } |
|
192 |
|
193 // --------------------------------------------------------------------------- |
|
194 // CEasyDialingContactDataManager::GetThumbnailIdL |
|
195 // --------------------------------------------------------------------------- |
|
196 // |
|
197 HBufC* CEasyDialingContactDataManager::GetThumbnailIdL( |
|
198 MVPbkContactLink* aContact, TBool aMatchThumbnails, TBool aFav ) |
|
199 { |
|
200 LOGSTRING("CEasyDialingContactDataManager: GetThumbnailIdL"); |
|
201 TInt newIndex(KErrNotFound); |
|
202 if (aMatchThumbnails) |
|
203 { |
|
204 newIndex = FindContactIndex( aContact ); |
|
205 } |
|
206 |
|
207 LOGSTRING1("newIndex = %d", newIndex); |
|
208 if (newIndex == KErrNotFound) |
|
209 { |
|
210 MVPbkContactLink* newLink = aContact->CloneLC(); |
|
211 CEasyDialingContactData* newData = new (ELeave) CEasyDialingContactData(newLink); |
|
212 CleanupStack::Pop(); // newLink |
|
213 newIndex = iContactDataArray.Count(); |
|
214 CleanupStack::PushL(newData); |
|
215 iContactDataArray.AppendL(newData); |
|
216 CleanupStack::Pop(newData); |
|
217 SetStoreFlagsForContact(newData); |
|
218 } |
|
219 |
|
220 iContactDataArray[ newIndex ]->SetFav( aFav ); |
|
221 |
|
222 HBufC* id = HBufC::NewL( sizeof(TInt) * 2 ); // space for hex representation of TInt |
|
223 TPtr ptr = id->Des(); |
|
224 ptr.Num(newIndex, EHex); |
|
225 LOGSTRING1("CEasyDialingContactDataManager: GetThumbnailIdL returns %S", id); |
|
226 return id; |
|
227 } |
|
228 |
|
229 // --------------------------------------------------------------------------- |
|
230 // CEasyDialingContactDataManager::IndexForId |
|
231 // --------------------------------------------------------------------------- |
|
232 // |
|
233 TInt CEasyDialingContactDataManager::IndexForId( const TDesC& aId ) const |
|
234 { |
|
235 TUint idVal(0); |
|
236 TLex lex(aId); |
|
237 lex.Val(idVal, EHex); |
|
238 return idVal; |
|
239 } |
|
240 |
|
241 // --------------------------------------------------------------------------- |
|
242 // CEasyDialingContactDataManager::GetThumbnail |
|
243 // --------------------------------------------------------------------------- |
|
244 // |
|
245 TBool CEasyDialingContactDataManager::GetThumbnail( TInt aIndex, CFbsBitmap*& aThumbnail ) |
|
246 { |
|
247 LOGSTRING("CEasyDialingContactDataManager: GetThumbnail"); |
|
248 |
|
249 TBool retVal; |
|
250 |
|
251 CEasyDialingContactData* contactData = iContactDataArray[aIndex]; |
|
252 if ( contactData->IsLoaded() ) |
|
253 { |
|
254 aThumbnail = contactData->Thumbnail(); |
|
255 retVal = ETrue; |
|
256 } |
|
257 else |
|
258 { |
|
259 aThumbnail = NULL; |
|
260 retVal = EFalse; |
|
261 if (iWaitingContacts.Find(aIndex) == KErrNotFound) |
|
262 { |
|
263 LOGSTRING1("iWaitingContacts.Append %d", aIndex); |
|
264 iWaitingContacts.Append(aIndex); |
|
265 TRAPD(err, LoadNextContactDataL()); |
|
266 if (err) |
|
267 { |
|
268 HandleError(err); |
|
269 } |
|
270 } |
|
271 } |
|
272 LOGSTRING("CEasyDialingContactDataManager: GetThumbnail Exit"); |
|
273 return retVal; |
|
274 } |
|
275 |
|
276 // --------------------------------------------------------------------------- |
|
277 // CEasyDialingContactDataManager::IsFav |
|
278 // --------------------------------------------------------------------------- |
|
279 // |
|
280 TBool CEasyDialingContactDataManager::IsFav( TInt aIndex ) const |
|
281 { |
|
282 CEasyDialingContactData* contactData = iContactDataArray[aIndex]; |
|
283 return contactData->Fav(); |
|
284 } |
|
285 |
|
286 // --------------------------------------------------------------------------- |
|
287 // CEasyDialingContactDataManager::IsSimContact |
|
288 // --------------------------------------------------------------------------- |
|
289 // |
|
290 TBool CEasyDialingContactDataManager::IsSimContact( TInt aIndex ) const |
|
291 { |
|
292 CEasyDialingContactData* contactData = iContactDataArray[aIndex]; |
|
293 return contactData->IsSimContact(); |
|
294 } |
|
295 |
|
296 // --------------------------------------------------------------------------- |
|
297 // CEasyDialingContactDataManager::IsSdnContact |
|
298 // --------------------------------------------------------------------------- |
|
299 // |
|
300 TBool CEasyDialingContactDataManager::IsSdnContact( TInt aIndex ) const |
|
301 { |
|
302 CEasyDialingContactData* contactData = iContactDataArray[aIndex]; |
|
303 return contactData->IsSdnContact(); |
|
304 } |
|
305 |
|
306 // --------------------------------------------------------------------------- |
|
307 // CEasyDialingContactDataManager::IsFavL |
|
308 // --------------------------------------------------------------------------- |
|
309 // |
|
310 TBool CEasyDialingContactDataManager::IsFavL( MVPbkContactLink* aLink ) |
|
311 { |
|
312 if ( iFavsView && iFavsViewReady && iFavsView->IndexOfLinkL( *aLink ) > KErrNotFound ) |
|
313 { |
|
314 return ETrue; |
|
315 } |
|
316 else |
|
317 { |
|
318 return EFalse; |
|
319 } |
|
320 } |
|
321 |
|
322 // --------------------------------------------------------------------------- |
|
323 // CEasyDialingContactDataManager::NumberOfFavsL |
|
324 // --------------------------------------------------------------------------- |
|
325 // |
|
326 TInt CEasyDialingContactDataManager::NumberOfFavsL() |
|
327 { |
|
328 if ( iFavsView && iFavsViewReady && iFavStoreSearched ) |
|
329 { |
|
330 return iFavsView->ContactCountL(); |
|
331 } |
|
332 else |
|
333 { |
|
334 return 0; |
|
335 } |
|
336 } |
|
337 |
|
338 // --------------------------------------------------------------------------- |
|
339 // CEasyDialingContactDataManager::FavLinkLC |
|
340 // --------------------------------------------------------------------------- |
|
341 // |
|
342 MVPbkContactLink* CEasyDialingContactDataManager::FavLinkLC( TInt aIndex ) |
|
343 { |
|
344 if ( !iFavsView || !iFavsViewReady || !iFavStoreSearched ) |
|
345 { |
|
346 // LC function should not return normally unless it has actually |
|
347 // put something to cleanup stack |
|
348 User::Leave( KErrNotFound ); |
|
349 } |
|
350 return iFavsView->ContactAtL( aIndex ).CreateLinkLC(); |
|
351 } |
|
352 |
|
353 // --------------------------------------------------------------------------- |
|
354 // CEasyDialingContactDataManager::FavContactStringLC |
|
355 // --------------------------------------------------------------------------- |
|
356 // |
|
357 HBufC* CEasyDialingContactDataManager::FavContactStringLC( TInt aIndex, TNameOrder aNameOrder ) |
|
358 { |
|
359 const MVPbkBaseContactFieldCollection& fields = iFavsView->ContactAtL( aIndex ).Fields(); |
|
360 TPtrC firstName; |
|
361 TPtrC lastName; |
|
362 TPtrC companyName; |
|
363 for ( TInt i = 0; i < fields.FieldCount(); i++ ) |
|
364 { |
|
365 const MVPbkFieldType* fieldType = fields.FieldAt( i ).MatchFieldType( 0 ); |
|
366 switch ( fieldType->FieldTypeResId() ) |
|
367 { |
|
368 case R_VPBK_FIELD_TYPE_LASTNAME: |
|
369 { |
|
370 const MVPbkContactFieldTextData& data = |
|
371 MVPbkContactFieldTextData::Cast( fields.FieldAt( i ).FieldData() ); |
|
372 lastName.Set( data.Text() ); |
|
373 } |
|
374 break; |
|
375 case R_VPBK_FIELD_TYPE_FIRSTNAME: |
|
376 { |
|
377 const MVPbkContactFieldTextData& data = |
|
378 MVPbkContactFieldTextData::Cast( fields.FieldAt( i ).FieldData() ); |
|
379 firstName.Set( data.Text() ); |
|
380 } |
|
381 break; |
|
382 case R_VPBK_FIELD_TYPE_COMPANYNAME: |
|
383 { |
|
384 const MVPbkContactFieldTextData& data = |
|
385 MVPbkContactFieldTextData::Cast( fields.FieldAt( i ).FieldData() ); |
|
386 companyName.Set( data.Text() ); |
|
387 } |
|
388 break; |
|
389 default: |
|
390 break; |
|
391 } |
|
392 } |
|
393 |
|
394 return EasyDialingUtils::CreateContactStringLC( firstName, lastName, companyName, aNameOrder ); |
|
395 } |
|
396 |
|
397 // --------------------------------------------------------------------------- |
|
398 // CEasyDialingContactDataManager::NameOrder |
|
399 // --------------------------------------------------------------------------- |
|
400 // |
|
401 CEasyDialingContactDataManager::TNameOrder CEasyDialingContactDataManager::NameOrder() |
|
402 { |
|
403 return iNameOrder; |
|
404 } |
|
405 |
|
406 // --------------------------------------------------------------------------- |
|
407 // CEasyDialingContactDataManager::GetCurrentStoreUrisL |
|
408 // --------------------------------------------------------------------------- |
|
409 // |
|
410 void CEasyDialingContactDataManager::GetCurrentStoreUrisL( RPointerArray<TDesC>& aUris ) |
|
411 { |
|
412 CVPbkContactStoreUriArray* storeUris = iPbkStoreConfiguration->CurrentConfigurationL(); |
|
413 CleanupStack::PushL( storeUris ); |
|
414 for ( TInt i = 0 ; i < storeUris->Count() ; ++i ) |
|
415 { |
|
416 HBufC* dbUri = (*storeUris)[i].UriDes().AllocLC(); |
|
417 aUris.AppendL( dbUri ); |
|
418 CleanupStack::Pop( dbUri ); |
|
419 } |
|
420 CleanupStack::PopAndDestroy( storeUris ); |
|
421 } |
|
422 |
|
423 // --------------------------------------------------------------------------- |
|
424 // CEasyDialingContactDataManager::Pause |
|
425 // --------------------------------------------------------------------------- |
|
426 // |
|
427 void CEasyDialingContactDataManager::Pause( TBool aPause ) |
|
428 { |
|
429 if ( iPause != aPause ) |
|
430 { |
|
431 iPause = aPause; |
|
432 |
|
433 if ( !iPause && iWaitingContacts.Count() ) |
|
434 { |
|
435 TRAPD( err, LoadNextContactDataL()); |
|
436 if ( err ) |
|
437 { |
|
438 HandleError(err); |
|
439 } |
|
440 } |
|
441 } |
|
442 } |
|
443 |
|
444 // --------------------------------------------------------------------------- |
|
445 // CEasyDialingContactDataManager::InitReady |
|
446 // --------------------------------------------------------------------------- |
|
447 // |
|
448 void CEasyDialingContactDataManager::InitReady() |
|
449 { |
|
450 // Initialization is ready. we can start loading contact data, if needed. |
|
451 // (It is unlikely that there is any data to load at this point) |
|
452 iStoreReady = ETrue; |
|
453 if ( iWaitingContacts.Count() ) |
|
454 { |
|
455 TRAPD( err, LoadNextContactDataL() ) |
|
456 if ( err ) |
|
457 { |
|
458 HandleError( err ); |
|
459 } |
|
460 } |
|
461 } |
|
462 |
|
463 // --------------------------------------------------------------------------- |
|
464 // CEasyDialingContactDataManager::FindContactIndex |
|
465 // --------------------------------------------------------------------------- |
|
466 // |
|
467 TInt CEasyDialingContactDataManager::FindContactIndex( MVPbkContactLink* aContact ) |
|
468 { |
|
469 TInt index( KErrNotFound ); |
|
470 |
|
471 for ( TInt i = 0; i < iContactDataArray.Count(); i++ ) |
|
472 { |
|
473 if ( iContactDataArray[i]->ContactLink()->IsSame( *aContact ) ) |
|
474 { |
|
475 index = i; |
|
476 break; |
|
477 } |
|
478 } |
|
479 |
|
480 return index; |
|
481 } |
|
482 |
|
483 |
|
484 // --------------------------------------------------------------------------- |
|
485 // CEasyDialingContactDataManager::LoadNextContactDataL |
|
486 // --------------------------------------------------------------------------- |
|
487 // |
|
488 void CEasyDialingContactDataManager::LoadNextContactDataL() |
|
489 { |
|
490 LOGSTRING("CEasyDialingContactDataManager: LoadNextContactDataL"); |
|
491 if ( !iImageOperation && !iContactOperation && iWaitingContacts.Count() && iStoreReady && !iPause ) |
|
492 { |
|
493 // first we need to load the contact item |
|
494 const TInt index( iWaitingContacts[0] ); |
|
495 |
|
496 if ( index >= 0 && index < iContactDataArray.Count() ) |
|
497 { |
|
498 CEasyDialingContactData* data = iContactDataArray[index]; |
|
499 iContactOperation = iContactManager->RetrieveContactL( *(data->ContactLink()), *this); |
|
500 if (!iContactOperation) |
|
501 { |
|
502 data->LoadingComplete(); |
|
503 RDebug::Print(_L("iWaitingContacts.Remove %d"), iWaitingContacts[0]); |
|
504 iWaitingContacts.Remove(0); |
|
505 LoadNextContactDataL(); |
|
506 } |
|
507 } |
|
508 } |
|
509 LOGSTRING("CEasyDialingContactDataManager: LoadNextContactDataL Exit"); |
|
510 } |
|
511 |
|
512 // --------------------------------------------------------------------------- |
|
513 // CEasyDialingContactDataManager::PbkImageGetComplete |
|
514 // From MPbkImageGetObserver |
|
515 // --------------------------------------------------------------------------- |
|
516 // |
|
517 void CEasyDialingContactDataManager::Pbk2ImageGetComplete(MPbk2ImageOperation& aOperation, CFbsBitmap* aBitmap) |
|
518 { |
|
519 LOGSTRING("CEasyDialingContactDataManager: Pbk2ImageGetComplete"); |
|
520 TInt index( KErrNotFound ); |
|
521 if ( iWaitingContacts.Count() > 0 ) |
|
522 { |
|
523 index = iWaitingContacts[0]; |
|
524 LOGSTRING1("iWaitingContacts.Remove %d", iWaitingContacts[0]); |
|
525 iWaitingContacts.Remove(0); |
|
526 } |
|
527 |
|
528 delete &aOperation; |
|
529 iImageOperation = NULL; |
|
530 delete iStoreContact; |
|
531 iStoreContact = NULL; |
|
532 |
|
533 TRAPD(err, DoHandleImageGetCompleteL(aBitmap, index)); |
|
534 if (err) |
|
535 { |
|
536 HandleError(err); |
|
537 } |
|
538 LOGSTRING("CEasyDialingContactDataManager: Pbk2ImageGetComplete Exit"); |
|
539 } |
|
540 |
|
541 // --------------------------------------------------------------------------- |
|
542 // CEasyDialingContactDataManager::PbkImageGetFailed |
|
543 // From MPbkImageGetObserver |
|
544 // --------------------------------------------------------------------------- |
|
545 // |
|
546 void CEasyDialingContactDataManager::Pbk2ImageGetFailed(MPbk2ImageOperation& aOperation, TInt /*aError*/) |
|
547 { |
|
548 LOGSTRING("CEasyDialingContactDataManager: Pbk2ImageGetFailed"); |
|
549 Pbk2ImageGetComplete(aOperation, NULL); |
|
550 } |
|
551 |
|
552 // ----------------------------------------------------------------------------- |
|
553 // ConfigurationChanged |
|
554 // From MPbk2StoreConfigurationObserver |
|
555 // Called when contact store configuration changes |
|
556 // ----------------------------------------------------------------------------- |
|
557 // |
|
558 void CEasyDialingContactDataManager::ConfigurationChanged() |
|
559 { |
|
560 TRAP_IGNORE( SetupFavStoreSearchedL() ); |
|
561 iObserver->StoreConfigurationChanged(); |
|
562 } |
|
563 |
|
564 // ----------------------------------------------------------------------------- |
|
565 // ConfigurationChangedComplete |
|
566 // From MPbk2StoreConfigurationObserver |
|
567 // Called when contact store configuration change has been informed to all |
|
568 // observers |
|
569 // ----------------------------------------------------------------------------- |
|
570 // |
|
571 void CEasyDialingContactDataManager::ConfigurationChangedComplete() |
|
572 { |
|
573 // no implementation needed |
|
574 } |
|
575 |
|
576 // --------------------------------------------------------------------------- |
|
577 // CEasyDialingContactDataManager::SettingChangedL |
|
578 // From MPbkGlobalSettingObserver |
|
579 // --------------------------------------------------------------------------- |
|
580 // |
|
581 void CEasyDialingContactDataManager::SettingChangedL( MPbkGlobalSetting::TPbkGlobalSetting aKey ) |
|
582 { |
|
583 if ( aKey == MPbkGlobalSetting::ENameOrdering ) |
|
584 { |
|
585 UpdateNameOrderL(); |
|
586 if ( iObserver ) |
|
587 { |
|
588 iObserver->NameOrderChanged(); |
|
589 } |
|
590 } |
|
591 } |
|
592 |
|
593 // --------------------------------------------------------------------------- |
|
594 // CEasyDialingContactDataManager::UpdateNameOrderL |
|
595 // Update name order according to Phonebook setting |
|
596 // --------------------------------------------------------------------------- |
|
597 // |
|
598 void CEasyDialingContactDataManager::UpdateNameOrderL() |
|
599 { |
|
600 /* |
|
601 * Phonebook name ordering flag, integer value, possible values: |
|
602 * 0: name order Lastname Firstname |
|
603 * 1: name order Firstname Lastname |
|
604 * 2: name order undefined |
|
605 */ |
|
606 TInt nameOrderSetting; |
|
607 iPbkSettings->Get( MPbkGlobalSetting::ENameOrdering, nameOrderSetting ); |
|
608 |
|
609 switch ( nameOrderSetting ) |
|
610 { |
|
611 case 0: |
|
612 { |
|
613 iNameOrder = ELastnameFirstname; |
|
614 break; |
|
615 } |
|
616 case 1: |
|
617 { |
|
618 iNameOrder = EFirstnameLastname; |
|
619 break; |
|
620 } |
|
621 case 2: |
|
622 default: |
|
623 { |
|
624 // Decide name order based on UI language: lastname-firstname |
|
625 // for Chinese, firstname-lastname for the rest of languages. |
|
626 TLanguage uiLang = User::Language(); |
|
627 if ( uiLang == ELangPrcChinese || |
|
628 uiLang == ELangHongKongChinese || |
|
629 uiLang == ELangTaiwanChinese ) |
|
630 { |
|
631 iNameOrder = ELastnameFirstname; |
|
632 } |
|
633 else |
|
634 { |
|
635 iNameOrder = EFirstnameLastname; |
|
636 } |
|
637 } |
|
638 } |
|
639 } |
|
640 |
|
641 // --------------------------------------------------------------------------- |
|
642 // CEasyDialingContactDataManager::DoHandleImageGetCompleteL |
|
643 // --------------------------------------------------------------------------- |
|
644 // |
|
645 void CEasyDialingContactDataManager::DoHandleImageGetCompleteL(CFbsBitmap* aBitmap, TInt aIndex) |
|
646 { |
|
647 LOGSTRING("CEasyDialingContactDataManager: DoHandleImageGetCompleteL"); |
|
648 if ( aIndex >= 0 && aIndex < iContactDataArray.Count() ) |
|
649 { |
|
650 CEasyDialingContactData* data = iContactDataArray[aIndex]; |
|
651 data->LoadingComplete(); |
|
652 if (aBitmap) |
|
653 { |
|
654 data->SetThumbnail(aBitmap); |
|
655 } |
|
656 } |
|
657 LoadNextContactDataL(); |
|
658 InformObserver(); |
|
659 LOGSTRING("CEasyDialingContactDataManager: DoHandleImageGetCompleteL Exit"); |
|
660 } |
|
661 |
|
662 // --------------------------------------------------------------------------- |
|
663 // CEasyDialingContactDataManager::Reset |
|
664 // --------------------------------------------------------------------------- |
|
665 // |
|
666 void CEasyDialingContactDataManager::Reset() |
|
667 { |
|
668 LOGSTRING("CEasyDialingContactDataManager: Reset"); |
|
669 delete iImageOperation; |
|
670 iImageOperation = NULL; |
|
671 delete iContactOperation; |
|
672 iContactOperation = NULL; |
|
673 delete iStoreContact; |
|
674 iStoreContact = NULL; |
|
675 iWaitingContacts.Reset(); |
|
676 iContactDataArray.ResetAndDestroy(); |
|
677 iPause = EFalse; |
|
678 } |
|
679 |
|
680 // --------------------------------------------------------------------------- |
|
681 // CEasyDialingContactDataManager::VoiceCallAvailable |
|
682 // --------------------------------------------------------------------------- |
|
683 // |
|
684 TBool CEasyDialingContactDataManager::VoiceCallAvailable( TInt aIndex ) |
|
685 { |
|
686 LOGSTRING("CEasyDialingContactDataManager: VoiceCallAvailable"); |
|
687 |
|
688 TBool ret( EFalse ); |
|
689 |
|
690 if( aIndex >= 0 ) |
|
691 { |
|
692 // If the parsed index is valid, return the availability. |
|
693 ret = iContactDataArray[ aIndex ]->VoiceCallAvailable(); |
|
694 } |
|
695 |
|
696 LOGSTRING1("CEasyDialingContactDataManager: VoiceCallAvailable returns %d", ret); |
|
697 return ret; |
|
698 } |
|
699 |
|
700 |
|
701 // --------------------------------------------------------------------------- |
|
702 // CEasyDialingContactDataManager::VideoCallAvailable |
|
703 // --------------------------------------------------------------------------- |
|
704 // |
|
705 TBool CEasyDialingContactDataManager::VideoCallAvailable( TInt aIndex ) |
|
706 { |
|
707 LOGSTRING("CEasyDialingContactDataManager: VideoCallAvailable"); |
|
708 |
|
709 TBool ret( EFalse ); |
|
710 |
|
711 if( aIndex >= 0 ) |
|
712 { |
|
713 // If the parsed index is valid, return the availability. |
|
714 ret = iContactDataArray[ aIndex ]->VideoCallAvailable(); |
|
715 } |
|
716 |
|
717 LOGSTRING1("CEasyDialingContactDataManager: VideoCallAvailable returns %d", ret); |
|
718 return ret; |
|
719 } |
|
720 |
|
721 |
|
722 // --------------------------------------------------------------------------- |
|
723 // CEasyDialingContactDataManager::UniEditorAvailable |
|
724 // --------------------------------------------------------------------------- |
|
725 // |
|
726 TBool CEasyDialingContactDataManager::UniEditorAvailable( TInt aIndex ) |
|
727 { |
|
728 LOGSTRING("CEasyDialingContactDataManager: UniEditorAvailable"); |
|
729 |
|
730 TBool ret( EFalse ); |
|
731 |
|
732 if( aIndex >= 0 ) |
|
733 { |
|
734 // If the parsed index is valid, return the availability. |
|
735 ret = iContactDataArray[ aIndex ]->UniEditorAvailable(); |
|
736 } |
|
737 |
|
738 LOGSTRING1("CEasyDialingContactDataManager: UniEditorAvailable returns %d", ret); |
|
739 return ret; |
|
740 } |
|
741 |
|
742 |
|
743 // --------------------------------------------------------------------------- |
|
744 // CEasyDialingContactDataManager::ContactLinkLC |
|
745 // --------------------------------------------------------------------------- |
|
746 // |
|
747 HBufC8* CEasyDialingContactDataManager::ContactLinkLC( TInt aIndex ) |
|
748 { |
|
749 LOGSTRING( "CEasyDialingContactDataManager: ContactLinkLC" ); |
|
750 |
|
751 if ( aIndex < 0 || aIndex >= iContactDataArray.Count() ) |
|
752 { |
|
753 User::Leave( KErrArgument ); |
|
754 } |
|
755 |
|
756 return iContactDataArray[ aIndex ]->ContactLink()->PackLC(); |
|
757 } |
|
758 |
|
759 |
|
760 // --------------------------------------------------------------------------- |
|
761 // CEasyDialingContactDataManager::HandleError |
|
762 // --------------------------------------------------------------------------- |
|
763 // |
|
764 void CEasyDialingContactDataManager::HandleError(TInt /*aError*/) |
|
765 { |
|
766 LOGSTRING("CEasyDialingContactDataManager: HandleError"); |
|
767 // Something went wrong, but there is no need to panic. |
|
768 // Cancel async operations and notify observer that we are done. |
|
769 iWaitingContacts.Reset(); |
|
770 delete iImageOperation; |
|
771 iImageOperation = NULL; |
|
772 delete iContactOperation; |
|
773 iContactOperation = NULL; |
|
774 |
|
775 // Also mark all contact data as loaded. Otherwise it would just be |
|
776 // loaded again, which would cause infinite loop if there is a permanent |
|
777 // problem. |
|
778 for ( TInt i = 0; i < iContactDataArray.Count(); i++ ) |
|
779 { |
|
780 iContactDataArray[i]->LoadingComplete(); |
|
781 } |
|
782 |
|
783 if ( iObserver ) |
|
784 { |
|
785 iObserver->AllContactDataLoaded(); |
|
786 } |
|
787 } |
|
788 |
|
789 // --------------------------------------------------------------------------- |
|
790 // CEasyDialingContactDataManager::StoreReady |
|
791 // from MVPbkContactStoreListObserver |
|
792 // @param aContactStore The store that is ready. |
|
793 // --------------------------------------------------------------------------- |
|
794 // |
|
795 void CEasyDialingContactDataManager::StoreReady( MVPbkContactStore& /*aContactStore*/ ) |
|
796 { |
|
797 } |
|
798 |
|
799 // --------------------------------------------------------------------------- |
|
800 // CEasyDialingContactDataManager::StoreUnavailable |
|
801 // from MVPbkContactStoreListObserver |
|
802 // Called when a contact store becomes unavailable. |
|
803 // @param aContactStore The store that became unavailable. |
|
804 // @param aReason The reason why the store is unavailable. |
|
805 // This is one of the system wide error codes. |
|
806 // --------------------------------------------------------------------------- |
|
807 // |
|
808 void CEasyDialingContactDataManager::StoreUnavailable( MVPbkContactStore& /*aContactStore*/, |
|
809 TInt /*aReason*/ ) |
|
810 { |
|
811 // Opening some contact database failed. Easydialing can operate without |
|
812 // any database connections, but thumbnails and favourite stars can't be |
|
813 // shown, and availability of action menu items can't be checked. |
|
814 // Of course, if easydialing can't open the database, probably PCSServer |
|
815 // can't open it either... |
|
816 } |
|
817 |
|
818 // --------------------------------------------------------------------------- |
|
819 // CEasyDialingContactDataManager::HandleStoreEventL |
|
820 // from MVPbkContactStoreListObserver |
|
821 // Called when changes occur in the contact store. |
|
822 // IGNORED because ED plugin reacts to contact modifications by listening |
|
823 // to PCS cache update events. |
|
824 // @param aContactStore A store whose event it is. |
|
825 // @param aStoreEvent The event that has occurred. |
|
826 // --------------------------------------------------------------------------- |
|
827 // |
|
828 void CEasyDialingContactDataManager::HandleStoreEventL( MVPbkContactStore& /*aContactStore*/, |
|
829 TVPbkContactStoreEvent /*aStoreEvent*/ ) |
|
830 { |
|
831 } |
|
832 |
|
833 // ----------------------------------------------------------------------------- |
|
834 // CEasyDialingPlugin::OpenComplete |
|
835 // From MVPbkContactStoreListObserver. |
|
836 // Called when all contact stores are ready to be used, signals |
|
837 // the next engine state. |
|
838 // |
|
839 // ----------------------------------------------------------------------------- |
|
840 // |
|
841 void CEasyDialingContactDataManager::OpenComplete() |
|
842 { |
|
843 // next open the favourites view |
|
844 TRAPD( err, iVPbkTopContactManager->GetTopContactsViewL( *this, *this ) ); |
|
845 if ( err ) |
|
846 { |
|
847 HandleError( err ); |
|
848 } |
|
849 } |
|
850 |
|
851 // --------------------------------------------------------------------------- |
|
852 // CEasyDialingContactDataManager::VPbkOperationFailed |
|
853 // --------------------------------------------------------------------------- |
|
854 // |
|
855 void CEasyDialingContactDataManager::VPbkOperationFailed( |
|
856 MVPbkContactOperationBase* /*aOperation*/, |
|
857 TInt /*aError*/ ) |
|
858 { |
|
859 // Loading list of favourite contacts failed. |
|
860 // Continue as if none of the contacts are favourited. |
|
861 delete iFavsOperation; |
|
862 iFavsOperation = NULL; |
|
863 delete iFavsView; |
|
864 iFavsView = NULL; |
|
865 iFavsViewReady = EFalse; |
|
866 |
|
867 InitReady(); |
|
868 } |
|
869 |
|
870 // --------------------------------------------------------------------------- |
|
871 // CEasyDialingContactDataManager::VPbkOperationResultCompleted |
|
872 // --------------------------------------------------------------------------- |
|
873 // |
|
874 void CEasyDialingContactDataManager::VPbkOperationResultCompleted( |
|
875 MVPbkContactOperationBase* /*aOperation*/, |
|
876 MVPbkContactViewBase* aOperationResult ) |
|
877 { |
|
878 delete iFavsOperation; |
|
879 iFavsOperation = NULL; |
|
880 delete iFavsView; |
|
881 iFavsView = aOperationResult; |
|
882 iFavsViewReady = ETrue; |
|
883 |
|
884 // Leave can be safely ignored. Notifications of favourites view changes |
|
885 // will not work, but otherwise Easydialing will work correctly. |
|
886 TRAP_IGNORE( iFavsView->AddObserverL( *this ) ); |
|
887 |
|
888 InitReady(); |
|
889 } |
|
890 |
|
891 // --------------------------------------------------------------------------- |
|
892 // CEasyDialingContactDataManager::ContactViewReady |
|
893 // From MVPbkContactViewObserver. |
|
894 // --------------------------------------------------------------------------- |
|
895 // |
|
896 void CEasyDialingContactDataManager::ContactViewReady( |
|
897 MVPbkContactViewBase& aView ) |
|
898 { |
|
899 LOGSTRING("CEasyDialingContactDataManager: ContactViewReady"); |
|
900 |
|
901 if ( iFavsView == &aView ) |
|
902 { |
|
903 iFavsViewReady = ETrue; |
|
904 } |
|
905 } |
|
906 |
|
907 // --------------------------------------------------------------------------- |
|
908 // CEasyDialingContactDataManager::ContactViewUnavailable |
|
909 // From MVPbkContactViewObserver. |
|
910 // --------------------------------------------------------------------------- |
|
911 // |
|
912 void CEasyDialingContactDataManager::ContactViewUnavailable( |
|
913 MVPbkContactViewBase& aView ) |
|
914 { |
|
915 LOGSTRING("CEasyDialingContactDataManager: ContactViewUnavailable"); |
|
916 |
|
917 if ( iFavsView == &aView ) |
|
918 { |
|
919 iFavsViewReady = EFalse; |
|
920 } |
|
921 } |
|
922 |
|
923 // --------------------------------------------------------------------------- |
|
924 // CEasyDialingContactDataManager::ContactAddedToView |
|
925 // From MVPbkContactViewObserver. |
|
926 // --------------------------------------------------------------------------- |
|
927 // |
|
928 void CEasyDialingContactDataManager::ContactAddedToView( |
|
929 MVPbkContactViewBase& aView, |
|
930 TInt /*aIndex*/, |
|
931 const MVPbkContactLink& /*aContactLink*/ ) |
|
932 { |
|
933 LOGSTRING("CEasyDialingContactDataManager: ContactAddedToView"); |
|
934 |
|
935 if ( iFavsView == &aView ) |
|
936 { |
|
937 iObserver->FavouritesChanged(); |
|
938 } |
|
939 } |
|
940 |
|
941 // --------------------------------------------------------------------------- |
|
942 // CEasyDialingContactDataManager::ContactRemovedFromView |
|
943 // From MVPbkContactViewObserver. |
|
944 // --------------------------------------------------------------------------- |
|
945 // |
|
946 void CEasyDialingContactDataManager::ContactRemovedFromView( |
|
947 MVPbkContactViewBase& aView, |
|
948 TInt /*aIndex*/, |
|
949 const MVPbkContactLink& /*aContactLink*/ ) |
|
950 { |
|
951 LOGSTRING("CEasyDialingContactDataManager: ContactRemovedFromView"); |
|
952 |
|
953 if ( iFavsView == &aView ) |
|
954 { |
|
955 iObserver->FavouritesChanged(); |
|
956 } |
|
957 } |
|
958 |
|
959 // --------------------------------------------------------------------------- |
|
960 // CEasyDialingContactDataManager::ContactViewError |
|
961 // From MVPbkContactViewObserver. |
|
962 // --------------------------------------------------------------------------- |
|
963 // |
|
964 void CEasyDialingContactDataManager::ContactViewError( |
|
965 MVPbkContactViewBase& aView, |
|
966 TInt /*aError*/, |
|
967 TBool /*aErrorNotified*/ ) |
|
968 { |
|
969 LOGSTRING("CEasyDialingContactDataManager: ContactViewError"); |
|
970 |
|
971 if ( iFavsView == &aView ) |
|
972 { |
|
973 iFavsViewReady = EFalse; |
|
974 } |
|
975 } |
|
976 |
|
977 // --------------------------------------------------------------------------- |
|
978 // CEasyDialingContactDataManager::DoHandleContactOperationCompleteL |
|
979 // --------------------------------------------------------------------------- |
|
980 // |
|
981 void CEasyDialingContactDataManager::DoHandleContactOperationCompleteL( |
|
982 MVPbkStoreContact* aContact, TInt aIndex) |
|
983 { |
|
984 LOGSTRING("CEasyDialingContactDataManager: DoHandleContactOperationCompleteL"); |
|
985 if (aContact) |
|
986 { |
|
987 |
|
988 __ASSERT_DEBUG((!iStoreContact && !iImageOperation), User::Panic(_L("CEasyDialingContactDataManager"), 1)); |
|
989 iStoreContact = aContact; |
|
990 |
|
991 // Find out the available communication methods for the contact. |
|
992 GetAvailableServicesL( aContact, aIndex ); |
|
993 |
|
994 // Next initiate async thumbnail get operation. |
|
995 |
|
996 if (GetContactThumbnailSetting()) // reads the iContactThumbnailSetting value if it is false we dont fetch images |
|
997 { |
|
998 if (iImageManager->HasImage(*iStoreContact, *iThumbnailFieldType)) |
|
999 { |
|
1000 iImageOperation = iImageManager->GetImageAsyncL( |
|
1001 &iImageManagerParams, |
|
1002 *iStoreContact, |
|
1003 *iThumbnailFieldType, |
|
1004 *this); |
|
1005 } |
|
1006 } |
|
1007 if (!iImageOperation) |
|
1008 { |
|
1009 CEasyDialingContactData *tn = iContactDataArray[aIndex]; |
|
1010 tn->LoadingComplete(); |
|
1011 LOGSTRING1("iWaitingContacts.Remove %d", iWaitingContacts[0]); |
|
1012 iWaitingContacts.Remove(0); |
|
1013 delete iStoreContact; |
|
1014 iStoreContact = NULL; |
|
1015 LoadNextContactDataL(); |
|
1016 InformObserver(); |
|
1017 } |
|
1018 } |
|
1019 else |
|
1020 { |
|
1021 // Opening contact failed. Mark contact data loaded, so it's not opened again. |
|
1022 CEasyDialingContactData* data = iContactDataArray[aIndex]; |
|
1023 data->LoadingComplete(); |
|
1024 LOGSTRING1("iWaitingContacts.Remove %d", iWaitingContacts[0]); |
|
1025 iWaitingContacts.Remove(0); |
|
1026 LoadNextContactDataL(); |
|
1027 InformObserver(); |
|
1028 } |
|
1029 LOGSTRING("CEasyDialingContactDataManager: DoHandleContactOperationCompleteL Exit"); |
|
1030 } |
|
1031 |
|
1032 |
|
1033 // --------------------------------------------------------------------------- |
|
1034 // CEasyDialingContactDataManager::GetAvailableServicesL |
|
1035 // |
|
1036 // Reads from parameter contact which services, i.e. communication methods, |
|
1037 // can be used with this contact. |
|
1038 // --------------------------------------------------------------------------- |
|
1039 // |
|
1040 void CEasyDialingContactDataManager::GetAvailableServicesL( MVPbkStoreContact* aContact, TInt aIndex ) |
|
1041 { |
|
1042 LOGSTRING1("CEasyDialingContactDataManager: GetAvailableServicesL index = %d", aIndex); |
|
1043 TVPbkStoreContactAnalyzer analyzer( *iContactManager, aContact ); |
|
1044 |
|
1045 CEasyDialingContactData* contactData = iContactDataArray[aIndex]; |
|
1046 |
|
1047 // Voice call is available if either circuit-switched call or voip call is available. |
|
1048 TBool csdCall = (analyzer.HasFieldL( VPbkFieldTypeSelectorFactory::EVoiceCallSelector ) != KErrNotFound); |
|
1049 TBool voipCall = (analyzer.HasFieldL( VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) != KErrNotFound); |
|
1050 |
|
1051 contactData->SetVoiceCallAvailable( csdCall || voipCall ); |
|
1052 |
|
1053 contactData->SetVideoCallAvailable( |
|
1054 analyzer.HasFieldL( VPbkFieldTypeSelectorFactory::EVideoCallSelector ) != KErrNotFound ); |
|
1055 |
|
1056 contactData->SetUniEditorAvailable( |
|
1057 analyzer.HasFieldL( VPbkFieldTypeSelectorFactory::EUniEditorSelector ) != KErrNotFound ); |
|
1058 |
|
1059 LOGSTRING("CEasyDialingContactDataManager: GetAvailableServicesL Exit"); |
|
1060 } |
|
1061 |
|
1062 |
|
1063 // --------------------------------------------------------------------------- |
|
1064 // CEasyDialingContactDataManager::VPbkSingleContactOperationComplete |
|
1065 // --------------------------------------------------------------------------- |
|
1066 // |
|
1067 void CEasyDialingContactDataManager::VPbkSingleContactOperationComplete( |
|
1068 MVPbkContactOperationBase& aOperation, |
|
1069 MVPbkStoreContact* aContact ) |
|
1070 { |
|
1071 LOGSTRING("CEasyDialingContactDataManager: VPbkSingleContactOperationComplete"); |
|
1072 delete &aOperation; |
|
1073 iContactOperation = NULL; |
|
1074 if ( iWaitingContacts.Count() > 0 ) |
|
1075 { |
|
1076 TInt index = iWaitingContacts[0]; |
|
1077 LOGSTRING1("VPbkSingleContactOperationComplete, Index=%d", index); |
|
1078 TRAPD(err, DoHandleContactOperationCompleteL(aContact, index)); |
|
1079 if ( err ) |
|
1080 { |
|
1081 HandleError(err); |
|
1082 } |
|
1083 } |
|
1084 |
|
1085 LOGSTRING("CEasyDialingContactDataManager: VPbkSingleContactOperationComplete Exit"); |
|
1086 } |
|
1087 |
|
1088 // --------------------------------------------------------------------------- |
|
1089 // CEasyDialingContactDataManager::VPbkSingleContactOperationFailed |
|
1090 // --------------------------------------------------------------------------- |
|
1091 // |
|
1092 void CEasyDialingContactDataManager::VPbkSingleContactOperationFailed( |
|
1093 MVPbkContactOperationBase& /*aOperation*/, |
|
1094 TInt /*aError*/ ) |
|
1095 { |
|
1096 LOGSTRING("CEasyDialingContactDataManager: VPbkSingleContactOperationFailed"); |
|
1097 delete iContactOperation; |
|
1098 iContactOperation = NULL; |
|
1099 TInt index = iWaitingContacts[0]; |
|
1100 LOGSTRING1("VPbkSingleContactOperationFailed, Index=%d", index); |
|
1101 TRAPD(err, DoHandleContactOperationCompleteL(NULL, index)); |
|
1102 if (err) |
|
1103 { |
|
1104 HandleError(err); |
|
1105 } |
|
1106 LOGSTRING("CEasyDialingContactDataManager: VPbkSingleContactOperationFailed Exit"); |
|
1107 } |
|
1108 |
|
1109 // --------------------------------------------------------------------------- |
|
1110 // CEasyDialingContactDataManager::InformObserver |
|
1111 // --------------------------------------------------------------------------- |
|
1112 // |
|
1113 void CEasyDialingContactDataManager::InformObserver() |
|
1114 { |
|
1115 if (iObserver && !iWaitingContacts.Count()) |
|
1116 { |
|
1117 iObserver->AllContactDataLoaded(); |
|
1118 } |
|
1119 } |
|
1120 |
|
1121 // --------------------------------------------------------------------------- |
|
1122 // CEasyDialingContactDataManager::SetContactThumbnailSetting |
|
1123 // --------------------------------------------------------------------------- |
|
1124 // |
|
1125 void CEasyDialingContactDataManager::SetContactThumbnailSetting( TInt aContactThumbnailSetting ) |
|
1126 { |
|
1127 iContactThumbnailSetting = aContactThumbnailSetting; |
|
1128 } |
|
1129 |
|
1130 // --------------------------------------------------------------------------- |
|
1131 // CEasyDialingContactDataManager::GetContactThumbnailSetting |
|
1132 // --------------------------------------------------------------------------- |
|
1133 // |
|
1134 TBool CEasyDialingContactDataManager::GetContactThumbnailSetting( ) |
|
1135 { |
|
1136 return iContactThumbnailSetting; |
|
1137 } |
|
1138 |
|
1139 // --------------------------------------------------------------------------- |
|
1140 // CEasyDialingContactDataManager::Reload |
|
1141 // --------------------------------------------------------------------------- |
|
1142 // |
|
1143 void CEasyDialingContactDataManager::Reload( ) |
|
1144 { |
|
1145 LOGSTRING("CEasyDialingContactDataManager: Reload"); |
|
1146 |
|
1147 for ( TInt i = 0 ; i < iContactDataArray.Count() ; i++ ) |
|
1148 { |
|
1149 iContactDataArray[ i ]->DeleteThumbnail(); |
|
1150 } |
|
1151 } |
|
1152 |
|
1153 // --------------------------------------------------------------------------- |
|
1154 // CEasyDialingContactDataManager::SetupFavStoreSearchedL |
|
1155 // --------------------------------------------------------------------------- |
|
1156 // |
|
1157 void CEasyDialingContactDataManager::SetupFavStoreSearchedL() |
|
1158 { |
|
1159 // Check if favourite contact store (i.e. the default contact store) is one |
|
1160 // of the stores configured to be searched. |
|
1161 CVPbkContactStoreUriArray* storeUris = |
|
1162 iPbkStoreConfiguration->CurrentConfigurationL(); |
|
1163 iFavStoreSearched = |
|
1164 storeUris->IsIncluded( VPbkContactStoreUris::DefaultCntDbUri() ); |
|
1165 delete storeUris; |
|
1166 } |
|
1167 |
|
1168 // --------------------------------------------------------------------------- |
|
1169 // CEasyDialingContactDataManager::SetStoreFlagsForContact |
|
1170 // --------------------------------------------------------------------------- |
|
1171 // |
|
1172 void CEasyDialingContactDataManager::SetStoreFlagsForContact( |
|
1173 CEasyDialingContactData* aContactData ) const |
|
1174 { |
|
1175 MVPbkContactLink* link = aContactData->ContactLink(); |
|
1176 const TDesC& uri = link->ContactStore().StoreProperties().Uri().UriDes(); |
|
1177 |
|
1178 TBool isSim = ( uri.Compare( VPbkContactStoreUris::SimGlobalAdnUri() ) == 0 ); |
|
1179 aContactData->SetSimContact( isSim ); |
|
1180 |
|
1181 TBool isSdn = ( uri.Compare( VPbkContactStoreUris::SimGlobalSdnUri() ) == 0 ); |
|
1182 aContactData->SetSdnContact( isSdn ); |
|
1183 } |
|
1184 |
|
1185 |
|
1186 // End of File |
|
1187 |