19 #include <fbs.h> |
19 #include <fbs.h> |
20 #include <CPbk2ImageManager.h> |
20 #include <CPbk2ImageManager.h> |
21 #include <CVPbkContactManager.h> |
21 #include <CVPbkContactManager.h> |
22 #include <MVPbkContactStoreList.h> |
22 #include <MVPbkContactStoreList.h> |
23 #include <MVPbkContactLink.h> |
23 #include <MVPbkContactLink.h> |
24 #include <CPbk2StoreConfiguration.h> |
|
25 #include <CVPbkContactStoreUriArray.h> |
|
26 #include <VPbkContactStoreUris.h> |
24 #include <VPbkContactStoreUris.h> |
27 #include <TVPbkContactStoreUriPtr.h> |
25 #include <TVPbkContactStoreUriPtr.h> |
28 #include <CVPbkTopContactManager.h> |
26 #include <CVPbkTopContactManager.h> |
29 #include <MVPbkContactOperationBase.h> |
27 #include <MVPbkContactOperationBase.h> |
30 #include <TVPbkStoreContactAnalyzer.h> |
28 #include <TVPbkStoreContactAnalyzer.h> |
31 #include <MVPbkFieldType.h> |
29 #include <MVPbkFieldType.h> |
32 #include <VPbkEng.rsg> |
30 #include <VPbkEng.rsg> |
|
31 |
33 #include <MVPbkContactViewBase.h> |
32 #include <MVPbkContactViewBase.h> |
34 #include <MVPbkBaseContactFieldCollection.h> |
33 #include <MVPbkBaseContactFieldCollection.h> |
35 #include <MVPbkContactFieldTextData.h> |
34 #include <MVPbkContactFieldTextData.h> |
36 #include <MVPbkContactFieldData.h> |
35 #include <MVPbkContactFieldData.h> |
|
36 |
37 #include <CVPbkContactLinkArray.h> |
37 #include <CVPbkContactLinkArray.h> |
38 #include <MVPbkContactLink.h> |
38 #include <MVPbkContactLink.h> |
39 #include <MVPbkContactOperationBase.h> |
39 #include <MVPbkContactOperationBase.h> |
40 #include <MVPbkOperationObserver.h> |
40 #include <MVPbkOperationObserver.h> |
41 #include <MVPbkContactStore.h> |
41 #include <MVPbkContactStore.h> // MVPbkContactStore |
42 #include <MVPbkContactStoreProperties.h> |
|
43 #include <MVPbkStoreContact.h> |
42 #include <MVPbkStoreContact.h> |
|
43 #include <centralrepository.h> |
|
44 |
44 #include <PbkGlobalSettingFactory.h> |
45 #include <PbkGlobalSettingFactory.h> |
45 #include <centralrepository.h> |
|
46 |
46 |
47 #include "easydialingcontactdata.h" |
47 #include "easydialingcontactdata.h" |
48 #include "easydialingcontactdatamanager.h" |
48 #include "easydialingcontactdatamanager.h" |
49 #include "easydialingutils.h" |
49 #include "easydialingutils.h" |
50 #include "mcontactdatamanagerobserver.h" |
50 #include "mcontactdatamanagerobserver.h" |
51 #include "easydialingcrkeys.h" |
51 #include "easydialingcrkeys.h" |
52 #include "easydialinglogger.h" |
52 #include "easydialinglogger.h" |
53 |
53 |
54 // --------------------------------------------------------------------------- |
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 |
55 // CEasyDialingContactDataManager::CEasyDialingContactDataManager |
70 // --------------------------------------------------------------------------- |
56 // --------------------------------------------------------------------------- |
71 // |
57 // |
72 CEasyDialingContactDataManager::CEasyDialingContactDataManager() |
58 CEasyDialingContactDataManager::CEasyDialingContactDataManager(CVPbkContactManager* aContactManager) |
73 : iPbkStoreConfiguration(NULL), |
59 : iImageOperation(NULL), iContactManager(aContactManager), iContactOperation(NULL), |
74 iImageOperation(NULL), |
60 iContactThumbnailSetting(ETrue), iStoreReady(EFalse) |
75 iContactManager(NULL), |
|
76 iContactOperation(NULL), |
|
77 iContactThumbnailSetting(ETrue), |
|
78 iStoreReady(EFalse) |
|
79 { |
61 { |
80 } |
62 } |
81 |
63 |
82 |
64 |
83 // --------------------------------------------------------------------------- |
65 // --------------------------------------------------------------------------- |
118 // CEasyDialingContactDataManager::ConstructL |
92 // CEasyDialingContactDataManager::ConstructL |
119 // --------------------------------------------------------------------------- |
93 // --------------------------------------------------------------------------- |
120 // |
94 // |
121 void CEasyDialingContactDataManager::ConstructL() |
95 void CEasyDialingContactDataManager::ConstructL() |
122 { |
96 { |
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); |
97 iImageManager = CPbk2ImageManager::NewL(*iContactManager); |
138 |
98 |
|
99 TVPbkContactStoreUriPtr uri( VPbkContactStoreUris::DefaultCntDbUri() ); |
|
100 iContactStore = iContactManager->ContactStoresL().Find( uri ); |
|
101 |
139 iVPbkTopContactManager = CVPbkTopContactManager::NewL( *iContactManager ); |
102 iVPbkTopContactManager = CVPbkTopContactManager::NewL( *iContactManager ); |
140 |
103 |
141 iImageManagerParams.iFlags = TPbk2ImageManagerParams::EScaleImage | TPbk2ImageManagerParams::EKeepAspectRatio; |
104 iImageManagerParams.iFlags = TPbk2ImageManagerParams::EScaleImage | TPbk2ImageManagerParams::EKeepAspectRatio; |
142 iThumbnailFieldType = iContactManager->FieldTypes().Find( R_VPBK_FIELD_TYPE_THUMBNAILPIC ); |
105 iThumbnailFieldType = iContactManager->FieldTypes().Find( R_VPBK_FIELD_TYPE_THUMBNAILPIC ); |
143 |
106 |
|
107 // Open the store |
|
108 iContactStore->OpenL( *this ); |
|
109 |
144 // Read easydialing setting from cenrep. |
110 // Read easydialing setting from cenrep. |
145 CRepository* cenrep = CRepository::NewL( KCRUidEasyDialSettings ); |
111 CRepository* cenrep = CRepository::NewL( KCRUidEasyDialSettings ); |
146 CleanupStack::PushL( cenrep ); |
112 CleanupStack::PushL( cenrep ); |
147 User::LeaveIfError( cenrep->Get( KEasyDialingContactThumbnails, iContactThumbnailSetting ) ); |
113 User::LeaveIfError( cenrep->Get( KEasyDialingContactThumbnails, iContactThumbnailSetting ) ); |
148 CleanupStack::PopAndDestroy( cenrep ); |
114 CleanupStack::PopAndDestroy( cenrep ); |
149 |
115 |
150 // Start observing Phoenbook setting for the name order |
|
151 iPbkSettings = PbkGlobalSettingFactory::CreatePersistentSettingL(); |
116 iPbkSettings = PbkGlobalSettingFactory::CreatePersistentSettingL(); |
152 iPbkSettings->ConnectL( MPbkGlobalSetting::EGeneralSettingCategory ); |
117 iPbkSettings->ConnectL( MPbkGlobalSetting::EGeneralSettingCategory ); |
153 iPbkSettings->RegisterObserverL( this ); |
118 iPbkSettings->RegisterObserverL( this ); |
154 |
119 |
155 // Get name order from Phonebook settings |
120 // Get name order from Phonebook settings |
156 UpdateNameOrderL(); |
121 UpdateNameOrderL(); |
157 |
|
158 // Check if store with favourites is configured to be searched. |
|
159 SetupFavStoreSearchedL(); |
|
160 } |
122 } |
161 |
123 |
162 // --------------------------------------------------------------------------- |
124 // --------------------------------------------------------------------------- |
163 // CEasyDialingContactDataManager::SetObserver |
125 // CEasyDialingContactDataManager::SetObserver |
164 // --------------------------------------------------------------------------- |
126 // --------------------------------------------------------------------------- |
165 // |
127 // |
166 void CEasyDialingContactDataManager::SetObserver(MContactDataManagerObserver* aObserver) |
128 void CEasyDialingContactDataManager::SetObserver(MContactDataManagerObserver* aObserver) |
167 { |
129 { |
168 iObserver = aObserver; |
130 iObserver = aObserver; |
169 } |
|
170 |
|
171 // --------------------------------------------------------------------------- |
|
172 // CEasyDialingContactDataManager::ContactManager |
|
173 // --------------------------------------------------------------------------- |
|
174 // |
|
175 CVPbkContactManager& CEasyDialingContactDataManager::ContactManager() |
|
176 { |
|
177 return *iContactManager; |
|
178 } |
131 } |
179 |
132 |
180 // --------------------------------------------------------------------------- |
133 // --------------------------------------------------------------------------- |
181 // CEasyDialingContactDataManager::SetThumbnailSize |
134 // CEasyDialingContactDataManager::SetThumbnailSize |
182 // --------------------------------------------------------------------------- |
135 // --------------------------------------------------------------------------- |
206 |
159 |
207 LOGSTRING1("newIndex = %d", newIndex); |
160 LOGSTRING1("newIndex = %d", newIndex); |
208 if (newIndex == KErrNotFound) |
161 if (newIndex == KErrNotFound) |
209 { |
162 { |
210 MVPbkContactLink* newLink = aContact->CloneLC(); |
163 MVPbkContactLink* newLink = aContact->CloneLC(); |
211 CEasyDialingContactData* newData = new (ELeave) CEasyDialingContactData(newLink); |
164 CEasyDialingContactData *newThumbnail = new (ELeave) CEasyDialingContactData(newLink); |
212 CleanupStack::Pop(); // newLink |
165 CleanupStack::Pop(); // newLink |
213 newIndex = iContactDataArray.Count(); |
166 newIndex = iContactDataArray.Count(); |
214 CleanupStack::PushL(newData); |
167 CleanupStack::PushL(newThumbnail); |
215 iContactDataArray.AppendL(newData); |
168 iContactDataArray.AppendL(newThumbnail); |
216 CleanupStack::Pop(newData); |
169 CleanupStack::Pop(newThumbnail); |
217 SetStoreFlagsForContact(newData); |
|
218 } |
170 } |
219 |
171 |
220 iContactDataArray[ newIndex ]->SetFav( aFav ); |
172 iContactDataArray[ newIndex ]->SetFav( aFav ); |
221 |
173 |
222 HBufC* id = HBufC::NewL( sizeof(TInt) * 2 ); // space for hex representation of TInt |
174 HBufC* id = HBufC::NewL( sizeof(TInt) * 2 ); // space for hex representation of TInt |
225 LOGSTRING1("CEasyDialingContactDataManager: GetThumbnailIdL returns %S", id); |
177 LOGSTRING1("CEasyDialingContactDataManager: GetThumbnailIdL returns %S", id); |
226 return id; |
178 return id; |
227 } |
179 } |
228 |
180 |
229 // --------------------------------------------------------------------------- |
181 // --------------------------------------------------------------------------- |
230 // CEasyDialingContactDataManager::IndexForId |
182 // CEasyDialingContactDataManager::GetThumbnailAndFav |
231 // --------------------------------------------------------------------------- |
183 // --------------------------------------------------------------------------- |
232 // |
184 // |
233 TInt CEasyDialingContactDataManager::IndexForId( const TDesC& aId ) const |
185 TBool CEasyDialingContactDataManager::GetThumbnailAndFav(const TDesC& aId, CFbsBitmap*& aThumbnail, TBool& aFav) |
234 { |
186 { |
|
187 LOGSTRING("CEasyDialingContactDataManager: GetThumbnailAndFav"); |
235 TUint idVal(0); |
188 TUint idVal(0); |
236 TLex lex(aId); |
189 TLex lex(aId); |
237 lex.Val(idVal, EHex); |
190 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 |
191 |
249 TBool retVal; |
192 TBool retVal; |
250 |
193 |
251 CEasyDialingContactData* contactData = iContactDataArray[aIndex]; |
194 CEasyDialingContactData* thumbnail = iContactDataArray[idVal]; |
252 if ( contactData->IsLoaded() ) |
195 aFav = thumbnail->Fav(); |
253 { |
196 if (thumbnail->IsLoaded()) |
254 aThumbnail = contactData->Thumbnail(); |
197 { |
|
198 aThumbnail = thumbnail->Thumbnail(); |
255 retVal = ETrue; |
199 retVal = ETrue; |
256 } |
200 } |
257 else |
201 else |
258 { |
202 { |
259 aThumbnail = NULL; |
203 aThumbnail = NULL; |
260 retVal = EFalse; |
204 retVal = EFalse; |
261 if (iWaitingContacts.Find(aIndex) == KErrNotFound) |
205 if (iWaitingContacts.Find(idVal) == KErrNotFound) |
262 { |
206 { |
263 LOGSTRING1("iWaitingContacts.Append %d", aIndex); |
207 LOGSTRING1("iWaitingContacts.Append %d", idVal); |
264 iWaitingContacts.Append(aIndex); |
208 iWaitingContacts.Append(idVal); |
265 TRAPD(err, LoadNextContactDataL()); |
209 TRAPD(err, LoadNextContactDataL()); |
266 if (err) |
210 if (err) |
267 { |
211 { |
268 HandleError(err); |
212 HandleError(err); |
269 } |
213 } |
270 } |
214 } |
271 } |
215 } |
272 LOGSTRING("CEasyDialingContactDataManager: GetThumbnail Exit"); |
216 LOGSTRING("CEasyDialingContactDataManager: GetThumbnailAndFav Exit"); |
273 return retVal; |
217 return retVal; |
274 } |
218 } |
275 |
219 |
276 // --------------------------------------------------------------------------- |
220 // --------------------------------------------------------------------------- |
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 |
221 // CEasyDialingContactDataManager::IsFavL |
308 // --------------------------------------------------------------------------- |
222 // --------------------------------------------------------------------------- |
309 // |
223 // |
310 TBool CEasyDialingContactDataManager::IsFavL( MVPbkContactLink* aLink ) |
224 TBool CEasyDialingContactDataManager::IsFavL( MVPbkContactLink* aLink ) |
311 { |
225 { |
402 { |
316 { |
403 return iNameOrder; |
317 return iNameOrder; |
404 } |
318 } |
405 |
319 |
406 // --------------------------------------------------------------------------- |
320 // --------------------------------------------------------------------------- |
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 |
321 // CEasyDialingContactDataManager::Pause |
425 // --------------------------------------------------------------------------- |
322 // --------------------------------------------------------------------------- |
426 // |
323 // |
427 void CEasyDialingContactDataManager::Pause( TBool aPause ) |
324 void CEasyDialingContactDataManager::Pause( TBool aPause ) |
428 { |
325 { |
489 { |
386 { |
490 LOGSTRING("CEasyDialingContactDataManager: LoadNextContactDataL"); |
387 LOGSTRING("CEasyDialingContactDataManager: LoadNextContactDataL"); |
491 if ( !iImageOperation && !iContactOperation && iWaitingContacts.Count() && iStoreReady && !iPause ) |
388 if ( !iImageOperation && !iContactOperation && iWaitingContacts.Count() && iStoreReady && !iPause ) |
492 { |
389 { |
493 // first we need to load the contact item |
390 // first we need to load the contact item |
494 const TInt index( iWaitingContacts[0] ); |
391 CEasyDialingContactData* tn = iContactDataArray[iWaitingContacts[0]]; |
495 |
392 iContactOperation = iContactManager->RetrieveContactL( *(tn->ContactLink()), *this); |
496 if ( index >= 0 && index < iContactDataArray.Count() ) |
393 |
497 { |
394 if (!iContactOperation) |
498 CEasyDialingContactData* data = iContactDataArray[index]; |
395 { |
499 iContactOperation = iContactManager->RetrieveContactL( *(data->ContactLink()), *this); |
396 tn->LoadingComplete(); |
500 if (!iContactOperation) |
397 RDebug::Print(_L("iWaitingContacts.Remove %d"), iWaitingContacts[0]); |
501 { |
398 iWaitingContacts.Remove(0); |
502 data->LoadingComplete(); |
399 LoadNextContactDataL(); |
503 RDebug::Print(_L("iWaitingContacts.Remove %d"), iWaitingContacts[0]); |
400 } |
504 iWaitingContacts.Remove(0); |
401 } |
505 LoadNextContactDataL(); |
|
506 } |
|
507 } |
|
508 } |
|
509 LOGSTRING("CEasyDialingContactDataManager: LoadNextContactDataL Exit"); |
402 LOGSTRING("CEasyDialingContactDataManager: LoadNextContactDataL Exit"); |
510 } |
403 } |
511 |
404 |
512 // --------------------------------------------------------------------------- |
405 // --------------------------------------------------------------------------- |
513 // CEasyDialingContactDataManager::PbkImageGetComplete |
406 // CEasyDialingContactDataManager::PbkImageGetComplete |
515 // --------------------------------------------------------------------------- |
408 // --------------------------------------------------------------------------- |
516 // |
409 // |
517 void CEasyDialingContactDataManager::Pbk2ImageGetComplete(MPbk2ImageOperation& aOperation, CFbsBitmap* aBitmap) |
410 void CEasyDialingContactDataManager::Pbk2ImageGetComplete(MPbk2ImageOperation& aOperation, CFbsBitmap* aBitmap) |
518 { |
411 { |
519 LOGSTRING("CEasyDialingContactDataManager: Pbk2ImageGetComplete"); |
412 LOGSTRING("CEasyDialingContactDataManager: Pbk2ImageGetComplete"); |
520 TInt index( KErrNotFound ); |
413 TInt index = iWaitingContacts[0]; |
521 if ( iWaitingContacts.Count() > 0 ) |
414 LOGSTRING1("iWaitingContacts.Remove %d", iWaitingContacts[0]); |
522 { |
415 iWaitingContacts.Remove(0); |
523 index = iWaitingContacts[0]; |
|
524 LOGSTRING1("iWaitingContacts.Remove %d", iWaitingContacts[0]); |
|
525 iWaitingContacts.Remove(0); |
|
526 } |
|
527 |
|
528 delete &aOperation; |
416 delete &aOperation; |
529 iImageOperation = NULL; |
417 iImageOperation = NULL; |
530 delete iStoreContact; |
418 delete iStoreContact; |
531 iStoreContact = NULL; |
419 iStoreContact = NULL; |
532 |
420 |
545 // |
433 // |
546 void CEasyDialingContactDataManager::Pbk2ImageGetFailed(MPbk2ImageOperation& aOperation, TInt /*aError*/) |
434 void CEasyDialingContactDataManager::Pbk2ImageGetFailed(MPbk2ImageOperation& aOperation, TInt /*aError*/) |
547 { |
435 { |
548 LOGSTRING("CEasyDialingContactDataManager: Pbk2ImageGetFailed"); |
436 LOGSTRING("CEasyDialingContactDataManager: Pbk2ImageGetFailed"); |
549 Pbk2ImageGetComplete(aOperation, NULL); |
437 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 } |
438 } |
575 |
439 |
576 // --------------------------------------------------------------------------- |
440 // --------------------------------------------------------------------------- |
577 // CEasyDialingContactDataManager::SettingChangedL |
441 // CEasyDialingContactDataManager::SettingChangedL |
578 // From MPbkGlobalSettingObserver |
442 // From MPbkGlobalSettingObserver |
783 if ( iObserver ) |
645 if ( iObserver ) |
784 { |
646 { |
785 iObserver->AllContactDataLoaded(); |
647 iObserver->AllContactDataLoaded(); |
786 } |
648 } |
787 } |
649 } |
788 |
650 |
789 // --------------------------------------------------------------------------- |
651 // --------------------------------------------------------------------------- |
790 // CEasyDialingContactDataManager::StoreReady |
652 // CEasyDialingContactDataManager::StoreReady |
791 // from MVPbkContactStoreListObserver |
653 // from MVPbkContactStoreObserver |
|
654 // Called when the contact store is ready to be used, signals |
|
655 // the next engine state. |
792 // @param aContactStore The store that is ready. |
656 // @param aContactStore The store that is ready. |
793 // --------------------------------------------------------------------------- |
657 // --------------------------------------------------------------------------- |
794 // |
658 // |
|
659 |
795 void CEasyDialingContactDataManager::StoreReady( MVPbkContactStore& /*aContactStore*/ ) |
660 void CEasyDialingContactDataManager::StoreReady( MVPbkContactStore& /*aContactStore*/ ) |
796 { |
661 { |
797 } |
662 // next open the favourites view |
798 |
663 TRAPD( err, iVPbkTopContactManager->GetTopContactsViewL( *this, *this ) ); |
|
664 if ( err ) |
|
665 { |
|
666 HandleError( err ); |
|
667 } |
|
668 } |
|
669 |
799 // --------------------------------------------------------------------------- |
670 // --------------------------------------------------------------------------- |
800 // CEasyDialingContactDataManager::StoreUnavailable |
671 // CEasyDialingContactDataManager::StoreUnavailable |
801 // from MVPbkContactStoreListObserver |
672 // from MVPbkContactStoreObserver |
802 // Called when a contact store becomes unavailable. |
673 // Called when a contact store becomes unavailable. |
803 // @param aContactStore The store that became unavailable. |
674 // @param aContactStore The store that became unavailable. |
804 // @param aReason The reason why the store is unavailable. |
675 // @param aReason The reason why the store is unavailable. |
805 // This is one of the system wide error codes. |
676 // This is one of the system wide error codes. |
806 // --------------------------------------------------------------------------- |
677 // --------------------------------------------------------------------------- |
807 // |
678 // |
808 void CEasyDialingContactDataManager::StoreUnavailable( MVPbkContactStore& /*aContactStore*/, |
679 void CEasyDialingContactDataManager::StoreUnavailable( MVPbkContactStore& /*aContactStore*/, |
809 TInt /*aReason*/ ) |
680 TInt /*aReason*/ ) |
810 { |
681 { |
811 // Opening some contact database failed. Easydialing can operate without |
682 // Opening main contact database failed. Easydialing can operate without |
812 // any database connections, but thumbnails and favourite stars can't be |
683 // it, but thumbnails and favourite stars can't be shown, and availability |
813 // shown, and availability of action menu items can't be checked. |
684 // of action menu items can't be checked. |
814 // Of course, if easydialing can't open the database, probably PCSServer |
685 // Of course, if easydialing can't open the database, probably PCSServer |
815 // can't open it either... |
686 // can't open it either... |
816 } |
687 } |
817 |
688 |
818 // --------------------------------------------------------------------------- |
689 // --------------------------------------------------------------------------- |
819 // CEasyDialingContactDataManager::HandleStoreEventL |
690 // CEasyDialingContactDataManager::HandleStoreEventL |
820 // from MVPbkContactStoreListObserver |
691 // from MVPbkContactStoreObserver |
821 // Called when changes occur in the contact store. |
692 // Called when changes occur in the contact store. |
822 // IGNORED because ED plugin reacts to contact modifications by listening |
693 // IGNORED. |
823 // to PCS cache update events. |
|
824 // @param aContactStore A store whose event it is. |
694 // @param aContactStore A store whose event it is. |
825 // @param aStoreEvent The event that has occurred. |
695 // @param aStoreEvent The event that has occurred. |
826 // --------------------------------------------------------------------------- |
696 // --------------------------------------------------------------------------- |
827 // |
697 // |
828 void CEasyDialingContactDataManager::HandleStoreEventL( MVPbkContactStore& /*aContactStore*/, |
698 void CEasyDialingContactDataManager::HandleStoreEventL(MVPbkContactStore& /*aContactStore*/, |
829 TVPbkContactStoreEvent /*aStoreEvent*/ ) |
699 TVPbkContactStoreEvent /*aStoreEvent*/) |
830 { |
700 { |
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 } |
701 } |
850 |
702 |
851 // --------------------------------------------------------------------------- |
703 // --------------------------------------------------------------------------- |
852 // CEasyDialingContactDataManager::VPbkOperationFailed |
704 // CEasyDialingContactDataManager::VPbkOperationFailed |
853 // --------------------------------------------------------------------------- |
705 // --------------------------------------------------------------------------- |
989 iStoreContact = aContact; |
841 iStoreContact = aContact; |
990 |
842 |
991 // Find out the available communication methods for the contact. |
843 // Find out the available communication methods for the contact. |
992 GetAvailableServicesL( aContact, aIndex ); |
844 GetAvailableServicesL( aContact, aIndex ); |
993 |
845 |
|
846 |
994 // Next initiate async thumbnail get operation. |
847 // Next initiate async thumbnail get operation. |
995 |
848 |
996 if (GetContactThumbnailSetting()) // reads the iContactThumbnailSetting value if it is false we dont fetch images |
849 if(GetContactThumbnailSetting()) // reads the iContactThumbnailSetting value if it is false we dont fetch images |
997 { |
850 { |
998 if (iImageManager->HasImage(*iStoreContact, *iThumbnailFieldType)) |
851 if (iImageManager->HasImage(*iStoreContact, *iThumbnailFieldType)) |
999 { |
852 { |
1000 iImageOperation = iImageManager->GetImageAsyncL( |
853 iImageOperation = iImageManager->GetImageAsyncL( |
1001 &iImageManagerParams, |
854 &iImageManagerParams, |
1006 } |
859 } |
1007 if (!iImageOperation) |
860 if (!iImageOperation) |
1008 { |
861 { |
1009 CEasyDialingContactData *tn = iContactDataArray[aIndex]; |
862 CEasyDialingContactData *tn = iContactDataArray[aIndex]; |
1010 tn->LoadingComplete(); |
863 tn->LoadingComplete(); |
1011 LOGSTRING1("iWaitingContacts.Remove %d", iWaitingContacts[0]); |
864 LOGSTRING1("iWaitingContacts.Remove %d", iWaitingContacts[0]); |
1012 iWaitingContacts.Remove(0); |
865 iWaitingContacts.Remove(0); |
1013 delete iStoreContact; |
866 delete iStoreContact; |
1014 iStoreContact = NULL; |
867 iStoreContact = NULL; |
1015 LoadNextContactDataL(); |
868 LoadNextContactDataL(); |
1016 InformObserver(); |
869 InformObserver(); |
1017 } |
870 } |
1018 } |
871 } |
1019 else |
872 else |
1020 { |
873 { |
1021 // Opening contact failed. Mark contact data loaded, so it's not opened again. |
874 // Opening contact failed. Mark contact data loaded, so it's not opened again. |
1022 CEasyDialingContactData* data = iContactDataArray[aIndex]; |
875 CEasyDialingContactData *tn = iContactDataArray[aIndex]; |
1023 data->LoadingComplete(); |
876 tn->LoadingComplete(); |
1024 LOGSTRING1("iWaitingContacts.Remove %d", iWaitingContacts[0]); |
877 LOGSTRING1("iWaitingContacts.Remove %d", iWaitingContacts[0]); |
1025 iWaitingContacts.Remove(0); |
878 iWaitingContacts.Remove(0); |
1026 LoadNextContactDataL(); |
879 LoadNextContactDataL(); |
1027 InformObserver(); |
880 InformObserver(); |
1028 } |
881 } |
1029 LOGSTRING("CEasyDialingContactDataManager: DoHandleContactOperationCompleteL Exit"); |
882 LOGSTRING("CEasyDialingContactDataManager: DoHandleContactOperationCompleteL Exit"); |
1069 MVPbkStoreContact* aContact ) |
922 MVPbkStoreContact* aContact ) |
1070 { |
923 { |
1071 LOGSTRING("CEasyDialingContactDataManager: VPbkSingleContactOperationComplete"); |
924 LOGSTRING("CEasyDialingContactDataManager: VPbkSingleContactOperationComplete"); |
1072 delete &aOperation; |
925 delete &aOperation; |
1073 iContactOperation = NULL; |
926 iContactOperation = NULL; |
1074 if ( iWaitingContacts.Count() > 0 ) |
927 TInt index = iWaitingContacts[0]; |
1075 { |
928 LOGSTRING1("VPbkSingleContactOperationComplete, Index=%d", index); |
1076 TInt index = iWaitingContacts[0]; |
929 TRAPD(err, DoHandleContactOperationCompleteL(aContact, index)); |
1077 LOGSTRING1("VPbkSingleContactOperationComplete, Index=%d", index); |
930 if (err) |
1078 TRAPD(err, DoHandleContactOperationCompleteL(aContact, index)); |
931 { |
1079 if ( err ) |
932 HandleError(err); |
1080 { |
933 } |
1081 HandleError(err); |
|
1082 } |
|
1083 } |
|
1084 |
|
1085 LOGSTRING("CEasyDialingContactDataManager: VPbkSingleContactOperationComplete Exit"); |
934 LOGSTRING("CEasyDialingContactDataManager: VPbkSingleContactOperationComplete Exit"); |
1086 } |
935 } |
1087 |
936 |
1088 // --------------------------------------------------------------------------- |
937 // --------------------------------------------------------------------------- |
1089 // CEasyDialingContactDataManager::VPbkSingleContactOperationFailed |
938 // CEasyDialingContactDataManager::VPbkSingleContactOperationFailed |
1148 { |
997 { |
1149 iContactDataArray[ i ]->DeleteThumbnail(); |
998 iContactDataArray[ i ]->DeleteThumbnail(); |
1150 } |
999 } |
1151 } |
1000 } |
1152 |
1001 |
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 |
1002 |
1186 // End of File |
1003 // End of File |
1187 |
1004 |