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