18 |
18 |
19 #ifndef __EASYDIALINGCONTACTDATAMANAGER_H__ |
19 #ifndef __EASYDIALINGCONTACTDATAMANAGER_H__ |
20 #define __EASYDIALINGCONTACTDATAMANAGER_H__ |
20 #define __EASYDIALINGCONTACTDATAMANAGER_H__ |
21 |
21 |
22 #include <MPbk2ImageOperationObservers.h> |
22 #include <MPbk2ImageOperationObservers.h> |
|
23 #include <MPbk2StoreConfigurationObserver.h> |
23 #include <MVPbkSingleContactOperationObserver.h> |
24 #include <MVPbkSingleContactOperationObserver.h> |
24 #include <MVPbkContactStoreObserver.h> |
25 #include <MVPbkContactStoreListObserver.h> |
25 #include <MVPbkOperationObserver.h> |
26 #include <MVPbkOperationObserver.h> |
26 #include <MVPbkContactViewBase.h> |
27 #include <MVPbkContactViewBase.h> |
27 #include <TPbk2ImageManagerParams.h> |
28 #include <TPbk2ImageManagerParams.h> |
28 #include <MPbkGlobalSetting.h> // For name order setting |
29 #include <MPbkGlobalSetting.h> // For name order setting |
29 #include <MVPbkContactViewObserver.h> |
30 #include <MVPbkContactViewObserver.h> |
30 #include "easydialingcontactdata.h" |
31 #include "easydialingcontactdata.h" |
31 |
32 |
32 // FORWARD DECLARATIONS |
33 // FORWARD DECLARATIONS |
|
34 class CPbk2StoreConfiguration; |
33 class CVPbkContactManager; |
35 class CVPbkContactManager; |
34 class MContactDataManagerObserver; |
36 class MContactDataManagerObserver; |
35 class MVPbkFieldType; |
37 class MVPbkFieldType; |
36 class CPbk2ImageManager; |
38 class CPbk2ImageManager; |
37 class CVPbkTopContactManager; |
39 class CVPbkTopContactManager; |
43 */ |
45 */ |
44 class CEasyDialingContactDataManager : |
46 class CEasyDialingContactDataManager : |
45 public CBase, |
47 public CBase, |
46 public MPbk2ImageGetObserver, |
48 public MPbk2ImageGetObserver, |
47 public MVPbkSingleContactOperationObserver, |
49 public MVPbkSingleContactOperationObserver, |
48 public MVPbkContactStoreObserver, |
50 public MVPbkContactStoreListObserver, |
49 public MVPbkOperationErrorObserver, |
51 public MVPbkOperationErrorObserver, |
50 public MVPbkOperationResultObserver<MVPbkContactViewBase*>, |
52 public MVPbkOperationResultObserver<MVPbkContactViewBase*>, |
|
53 public MPbk2StoreConfigurationObserver, |
51 public MPbkGlobalSettingObserver, |
54 public MPbkGlobalSettingObserver, |
52 public MVPbkContactViewObserver |
55 public MVPbkContactViewObserver |
53 |
56 |
54 { |
57 { |
55 public: |
58 public: |
56 |
59 |
57 /** |
60 /** |
58 * Contact name display order |
61 * Contact name display order |
59 */ |
62 */ |
60 enum TNameOrder |
63 enum TNameOrder |
61 { |
64 { |
62 EFirstnameLastname, |
65 EFirstnameLastname, |
63 ELastnameFirstname |
66 ELastnameFirstname |
64 }; |
67 }; |
65 |
68 |
66 public: |
69 public: // constructor and destructor |
67 |
70 |
|
71 /** |
|
72 * Two-phased constructor |
|
73 */ |
|
74 static CEasyDialingContactDataManager* NewL(); |
|
75 |
|
76 /** |
|
77 * Destructor. |
|
78 */ |
|
79 ~CEasyDialingContactDataManager(); |
|
80 |
|
81 private: // constructors |
68 /** |
82 /** |
69 * Constructor. |
83 * Constructor. |
70 */ |
84 */ |
71 CEasyDialingContactDataManager(CVPbkContactManager* aContactManager); |
85 CEasyDialingContactDataManager(); |
72 |
|
73 |
|
74 /** |
|
75 * Destructor. |
|
76 */ |
|
77 ~CEasyDialingContactDataManager(); |
|
78 |
86 |
79 |
87 |
80 /** |
88 /** |
81 * Second phase constructor of the class. |
89 * Second phase constructor of the class. |
82 */ |
90 */ |
83 void ConstructL(); |
91 void ConstructL(); |
84 |
92 |
|
93 public: // new methods |
85 /** |
94 /** |
86 * Sets the observer. Observer is notified when thumbnail loading is complete |
95 * Sets the observer. Observer is notified when thumbnail loading is complete |
87 * @param aObserver |
96 * @param aObserver |
88 */ |
97 */ |
89 void SetObserver(MContactDataManagerObserver* aObserver); |
98 void SetObserver(MContactDataManagerObserver* aObserver); |
|
99 |
|
100 /** |
|
101 * Gets a handle to the VPbk contact manager |
|
102 */ |
|
103 CVPbkContactManager& ContactManager(); |
90 |
104 |
91 /** |
105 /** |
92 * Sets the size of the thumbnails. If the loaded thumbnail is larger than |
106 * Sets the size of the thumbnails. If the loaded thumbnail is larger than |
93 * the set size, thumnail is scaled to the size. If the set size is different |
107 * the set size, thumnail is scaled to the size. If the set size is different |
94 * from the old one, deletes all loaded thumbnails, which causes them to be |
108 * from the old one, deletes all loaded thumbnails, which causes them to be |
106 * @return id string. caller needs to delete this. |
120 * @return id string. caller needs to delete this. |
107 */ |
121 */ |
108 HBufC* GetThumbnailIdL( MVPbkContactLink* aContact, TBool aMatchThumbnail, TBool aFav ); |
122 HBufC* GetThumbnailIdL( MVPbkContactLink* aContact, TBool aMatchThumbnail, TBool aFav ); |
109 |
123 |
110 /** |
124 /** |
|
125 * Gets internal index for a contact item with the given internal ID. |
|
126 */ |
|
127 TInt IndexForId( const TDesC& aId ) const; |
|
128 |
|
129 /** |
111 * Gets the thumbnail for a contact item. If thumbnail is not loaded, starts |
130 * Gets the thumbnail for a contact item. If thumbnail is not loaded, starts |
112 * loading it. |
131 * loading it. |
113 * @param aContact Contact link |
132 * @param aIndex Internal index for the contact, obtained with IndexForId |
114 * @param aThumbnail Outparam. Contact thumbnail. NULL if contact doesn't have thumbnail |
133 * @param aThumbnail Outparam. Contact thumbnail. NULL if contact doesn't have thumbnail |
115 * @param aFav Outparam. Favourite status |
|
116 * @return true if contact data has been loaded |
134 * @return true if contact data has been loaded |
117 */ |
135 */ |
118 TBool GetThumbnailAndFav(const TDesC& aId, CFbsBitmap*& aThumbnail, TBool& aFav); |
136 TBool GetThumbnail( TInt aIndex, CFbsBitmap*& aThumbnail ); |
|
137 |
|
138 /** |
|
139 * Checks if contact is a favorite contact |
|
140 * @param aIndex Internal index fo the contact, obtained with IndexForId |
|
141 * @return ETrue if contact is a favorite contact |
|
142 */ |
|
143 TBool IsFav( TInt aIndex ) const; |
|
144 |
|
145 /** |
|
146 * Checks if contact is a SIM contact |
|
147 * @param aIndex Internal index fo the contact, obtained with IndexForId |
|
148 * @return ETrue if contact is a SIM contact |
|
149 */ |
|
150 TBool IsSimContact( TInt aIndex ) const; |
|
151 |
|
152 /** |
|
153 * Checks if contact is a service number contact |
|
154 * @param aIndex Internal index fo the contact, obtained with IndexForId |
|
155 * @return ETrue if contact is a service number contact |
|
156 */ |
|
157 TBool IsSdnContact( TInt aIndex ) const; |
119 |
158 |
120 /** |
159 /** |
121 * Deletes all loaded thumbnails and cancel asynchronous operations. |
160 * Deletes all loaded thumbnails and cancel asynchronous operations. |
122 */ |
161 */ |
123 void Reset(); |
162 void Reset(); |
199 * @return Contact name display order |
238 * @return Contact name display order |
200 */ |
239 */ |
201 TNameOrder NameOrder(); |
240 TNameOrder NameOrder(); |
202 |
241 |
203 /** |
242 /** |
|
243 * Get URIs of the contact stores which are currently shown in Phonebook. |
|
244 * @param aUris On return, contains heap descriptors identifying the contact |
|
245 * stores which are active. Ownership of the descriptors is given. |
|
246 */ |
|
247 void GetCurrentStoreUrisL( RPointerArray<TDesC>& aUris ); |
|
248 |
|
249 /** |
204 * Pause the loading of contact data. This is used to make sure listbox is responsive |
250 * Pause the loading of contact data. This is used to make sure listbox is responsive |
205 * and smooth during panning and flicking. |
251 * and smooth during panning and flicking. |
206 * @param aPause Pause on/off |
252 * @param aPause Pause on/off |
207 */ |
253 */ |
208 void Pause( TBool aPause ); |
254 void Pause( TBool aPause ); |
221 void Pbk2ImageGetFailed(MPbk2ImageOperation& aOperation, TInt aError); |
267 void Pbk2ImageGetFailed(MPbk2ImageOperation& aOperation, TInt aError); |
222 |
268 |
223 public: |
269 public: |
224 |
270 |
225 /** |
271 /** |
|
272 * From MPbk2StoreConfigurationObserver |
|
273 */ |
|
274 void ConfigurationChanged(); |
|
275 |
|
276 /** |
|
277 * From MPbk2StoreConfigurationObserver |
|
278 */ |
|
279 void ConfigurationChangedComplete(); |
|
280 |
|
281 |
|
282 public: |
|
283 |
|
284 /** |
226 * From MPbkGlobalSettingObserver. |
285 * From MPbkGlobalSettingObserver. |
227 */ |
286 */ |
228 void SettingChangedL( MPbkGlobalSetting::TPbkGlobalSetting aKey ); |
287 void SettingChangedL( MPbkGlobalSetting::TPbkGlobalSetting aKey ); |
229 |
288 |
230 private: |
289 private: |
244 MVPbkContactOperationBase& aOperation, |
303 MVPbkContactOperationBase& aOperation, |
245 TInt aError ); |
304 TInt aError ); |
246 |
305 |
247 private: |
306 private: |
248 |
307 |
249 |
308 /** |
250 /** |
309 * From MVPbkContactStoreListObserver. |
251 * From MVPbkContactStoreObserver. |
|
252 */ |
310 */ |
253 void StoreReady( MVPbkContactStore& aContactStore ); |
311 void StoreReady( MVPbkContactStore& aContactStore ); |
254 |
312 |
255 |
313 /** |
256 /** |
314 * From MVPbkContactStoreListObserver. |
257 * From MVPbkContactStoreObserver. |
|
258 */ |
315 */ |
259 void StoreUnavailable( MVPbkContactStore& aContactStore, TInt aReason ); |
316 void StoreUnavailable( MVPbkContactStore& aContactStore, TInt aReason ); |
260 |
317 |
261 |
318 /** |
262 /** |
319 * From MVPbkContactStoreListObserver. |
263 * From MVPbkContactStoreObserver. |
|
264 */ |
320 */ |
265 void HandleStoreEventL( MVPbkContactStore& aContactStore, |
321 void HandleStoreEventL( MVPbkContactStore& aContactStore, |
266 TVPbkContactStoreEvent aStoreEvent ); |
322 TVPbkContactStoreEvent aStoreEvent ); |
267 |
323 |
|
324 /** |
|
325 * From MVPbkContactStoreListObserver. |
|
326 */ |
|
327 void OpenComplete(); |
|
328 |
268 private: |
329 private: |
269 /** |
330 /** |
270 * From MVPbkOperationErrorObserver. |
331 * From MVPbkOperationErrorObserver. |
271 */ |
332 */ |
272 void VPbkOperationFailed( |
333 void VPbkOperationFailed( |
325 void GetAvailableServicesL( MVPbkStoreContact* aContact, TInt aIndex ); |
386 void GetAvailableServicesL( MVPbkStoreContact* aContact, TInt aIndex ); |
326 |
387 |
327 void InformObserver(); |
388 void InformObserver(); |
328 |
389 |
329 void UpdateNameOrderL(); |
390 void UpdateNameOrderL(); |
330 |
391 |
331 private: |
392 void SetupFavStoreSearchedL(); |
|
393 |
|
394 void SetStoreFlagsForContact( CEasyDialingContactData* aContactData ) const; |
|
395 |
|
396 private: |
|
397 /** Phonebook store configuration. Owned. */ |
|
398 CPbk2StoreConfiguration* iPbkStoreConfiguration; |
|
399 |
332 /** Array that contains all loaded contact data. Owned. */ |
400 /** Array that contains all loaded contact data. Owned. */ |
333 RPointerArray<CEasyDialingContactData> iContactDataArray; |
401 RPointerArray<CEasyDialingContactData> iContactDataArray; |
334 |
402 |
335 /** Array that contains indexes of thumbnails that are waiting to be loaded. Owned. */ |
403 /** Array that contains indexes of thumbnails that are waiting to be loaded. Owned. */ |
336 RArray<TInt> iWaitingContacts; |
404 RArray<TInt> iWaitingContacts; |
348 MPbk2ImageOperation* iImageOperation; |
416 MPbk2ImageOperation* iImageOperation; |
349 |
417 |
350 /** Contact item for which a thumbnail is being loaded. Owned. */ |
418 /** Contact item for which a thumbnail is being loaded. Owned. */ |
351 MVPbkStoreContact* iStoreContact; |
419 MVPbkStoreContact* iStoreContact; |
352 |
420 |
353 /** Virtual phonebook contact manager. Not owned. */ |
421 /** Virtual phonebook contact manager. Owned. */ |
354 CVPbkContactManager* iContactManager; |
422 CVPbkContactManager* iContactManager; |
355 |
423 |
356 /** Contact data manager observer. Not owned. */ |
424 /** Contact data manager observer. Not owned. */ |
357 MContactDataManagerObserver* iObserver; |
425 MContactDataManagerObserver* iObserver; |
358 |
426 |
360 CVPbkTopContactManager* iVPbkTopContactManager; |
428 CVPbkTopContactManager* iVPbkTopContactManager; |
361 |
429 |
362 /** Virtual phonebook operation handle. Owned. */ |
430 /** Virtual phonebook operation handle. Owned. */ |
363 MVPbkContactOperationBase* iContactOperation; |
431 MVPbkContactOperationBase* iContactOperation; |
364 |
432 |
365 /** Default contact store. Not owned. */ |
|
366 MVPbkContactStore* iContactStore; |
|
367 |
|
368 /** Variable which tells either to show or hide contact thumbnails. */ |
433 /** Variable which tells either to show or hide contact thumbnails. */ |
369 TBool iContactThumbnailSetting; |
434 TBool iContactThumbnailSetting; |
370 |
435 |
371 /** ETrue if asynchronous opening of the contac store is ready. */ |
436 /** ETrue if asynchronous opening of the contac store is ready. */ |
372 TBool iStoreReady; |
437 TBool iStoreReady; |
375 MVPbkContactViewBase* iFavsView; |
440 MVPbkContactViewBase* iFavsView; |
376 |
441 |
377 /** Favourites view is ready to be used. */ |
442 /** Favourites view is ready to be used. */ |
378 TBool iFavsViewReady; |
443 TBool iFavsViewReady; |
379 |
444 |
|
445 /** Contact store containing favourite contacts is configured to be searched. */ |
|
446 TBool iFavStoreSearched; |
|
447 |
380 /** Virtual phonebook operation handle for getting favourites. Owned. */ |
448 /** Virtual phonebook operation handle for getting favourites. Owned. */ |
381 MVPbkContactOperationBase* iFavsOperation; |
449 MVPbkContactOperationBase* iFavsOperation; |
382 |
450 |
383 /** Phonebook settings interface. */ |
451 /** Phonebook settings interface. */ |
384 MPbkGlobalSetting* iPbkSettings; |
452 MPbkGlobalSetting* iPbkSettings; |