author | Fionntina Carville <fionntinac@symbian.org> |
Mon, 15 Nov 2010 11:44:32 +0000 | |
branch | RCL_3 |
changeset 84 | 1dabaed15bcd |
parent 81 | c26cc2a7c548 |
permissions | -rw-r--r-- |
62 | 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 |
||
19 |
#ifndef __EASYDIALINGCONTACTDATAMANAGER_H__ |
|
20 |
#define __EASYDIALINGCONTACTDATAMANAGER_H__ |
|
21 |
||
22 |
#include <MPbk2ImageOperationObservers.h> |
|
23 |
#include <MVPbkSingleContactOperationObserver.h> |
|
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
24 |
#include <MVPbkContactStoreObserver.h> |
62 | 25 |
#include <MVPbkOperationObserver.h> |
26 |
#include <MVPbkContactViewBase.h> |
|
27 |
#include <TPbk2ImageManagerParams.h> |
|
28 |
#include <MPbkGlobalSetting.h> // For name order setting |
|
29 |
#include <MVPbkContactViewObserver.h> |
|
30 |
#include "easydialingcontactdata.h" |
|
31 |
||
32 |
// FORWARD DECLARATIONS |
|
33 |
class CVPbkContactManager; |
|
34 |
class MContactDataManagerObserver; |
|
35 |
class MVPbkFieldType; |
|
36 |
class CPbk2ImageManager; |
|
37 |
class CVPbkTopContactManager; |
|
38 |
class CRepository; |
|
39 |
||
40 |
/** |
|
41 |
* CEasyDialingContactDataManager |
|
42 |
* Handles the loading and storing of thumbnail bitmaps |
|
43 |
*/ |
|
44 |
class CEasyDialingContactDataManager : |
|
45 |
public CBase, |
|
46 |
public MPbk2ImageGetObserver, |
|
47 |
public MVPbkSingleContactOperationObserver, |
|
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
48 |
public MVPbkContactStoreObserver, |
62 | 49 |
public MVPbkOperationErrorObserver, |
50 |
public MVPbkOperationResultObserver<MVPbkContactViewBase*>, |
|
51 |
public MPbkGlobalSettingObserver, |
|
52 |
public MVPbkContactViewObserver |
|
53 |
||
54 |
{ |
|
55 |
public: |
|
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
56 |
|
62 | 57 |
/** |
58 |
* Contact name display order |
|
59 |
*/ |
|
60 |
enum TNameOrder |
|
61 |
{ |
|
62 |
EFirstnameLastname, |
|
63 |
ELastnameFirstname |
|
64 |
}; |
|
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
65 |
|
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
66 |
public: |
62 | 67 |
|
68 |
/** |
|
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
69 |
* Constructor. |
62 | 70 |
*/ |
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
71 |
CEasyDialingContactDataManager(CVPbkContactManager* aContactManager); |
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
72 |
|
62 | 73 |
|
74 |
/** |
|
75 |
* Destructor. |
|
76 |
*/ |
|
77 |
~CEasyDialingContactDataManager(); |
|
78 |
||
79 |
||
80 |
/** |
|
81 |
* Second phase constructor of the class. |
|
82 |
*/ |
|
83 |
void ConstructL(); |
|
84 |
||
85 |
/** |
|
86 |
* Sets the observer. Observer is notified when thumbnail loading is complete |
|
87 |
* @param aObserver |
|
88 |
*/ |
|
89 |
void SetObserver(MContactDataManagerObserver* aObserver); |
|
90 |
||
91 |
/** |
|
92 |
* 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 |
|
94 |
* from the old one, deletes all loaded thumbnails, which causes them to be |
|
95 |
* reloaded when they are needed the next time. |
|
96 |
* @param aSize The size of the thumbnails |
|
97 |
*/ |
|
98 |
void SetThumbnailSize(const TSize& aSize); |
|
99 |
||
100 |
/** |
|
101 |
* Gets an id string for the thumbnail, if thumbnail exists for the contact. |
|
102 |
* Used when the listbox items are created. |
|
103 |
* @param aContact Contact link |
|
104 |
* @param aMatchThumbnail If true, tries to match the link to the existing thumbnails |
|
105 |
* @param aFav Is this contact a favourite |
|
106 |
* @return id string. caller needs to delete this. |
|
107 |
*/ |
|
108 |
HBufC* GetThumbnailIdL( MVPbkContactLink* aContact, TBool aMatchThumbnail, TBool aFav ); |
|
109 |
||
110 |
/** |
|
111 |
* Gets the thumbnail for a contact item. If thumbnail is not loaded, starts |
|
112 |
* loading it. |
|
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
113 |
* @param aContact Contact link |
62 | 114 |
* @param aThumbnail Outparam. Contact thumbnail. NULL if contact doesn't have thumbnail |
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
115 |
* @param aFav Outparam. Favourite status |
62 | 116 |
* @return true if contact data has been loaded |
117 |
*/ |
|
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
118 |
TBool GetThumbnailAndFav(const TDesC& aId, CFbsBitmap*& aThumbnail, TBool& aFav); |
62 | 119 |
|
120 |
/** |
|
121 |
* Deletes all loaded thumbnails and cancel asynchronous operations. |
|
122 |
*/ |
|
123 |
void Reset(); |
|
124 |
||
125 |
/** |
|
126 |
* Returs ETrue if voice call is available for current contact. |
|
127 |
*/ |
|
128 |
TBool VoiceCallAvailable( TInt aIndex ); |
|
129 |
||
130 |
||
131 |
/** |
|
132 |
* Returs ETrue if video call is available for current contact. |
|
133 |
*/ |
|
134 |
TBool VideoCallAvailable( TInt aIndex ); |
|
135 |
||
136 |
||
137 |
/** |
|
138 |
* Returs ETrue if uni-editor is available for current contact. |
|
139 |
*/ |
|
140 |
TBool UniEditorAvailable( TInt aIndex ); |
|
141 |
||
142 |
||
143 |
/** |
|
144 |
* Returns HBufC8 descriptor containing MVPbkContactLink |
|
145 |
* link packaged. |
|
146 |
*/ |
|
147 |
HBufC8* ContactLinkLC( TInt aIndex ); |
|
148 |
||
149 |
||
150 |
/** |
|
151 |
* Sets the iContactThumbnailSetting member variable to either true or false |
|
152 |
* which is read and if it is false then thumbnails are not shown |
|
153 |
* @param aContactThumbnailSetting which is cenrep value for ContactThumbnailSetting |
|
154 |
*/ |
|
155 |
void SetContactThumbnailSetting( TInt aContactThumbnailSetting ); |
|
156 |
||
157 |
/** |
|
158 |
* Gets the iContactThumbnailSetting member variable to either true or false |
|
159 |
* which is read and if it is false then thumbnails are not shown |
|
160 |
* returns iContactThumbnailSetting which is cenrep value for ContactThumbnailSetting |
|
161 |
*/ |
|
162 |
TBool GetContactThumbnailSetting( ); |
|
163 |
||
164 |
||
165 |
/** |
|
166 |
* Flushes the asynchronous contact data of all contacts. |
|
167 |
*/ |
|
168 |
void Reload(); |
|
169 |
||
170 |
/** |
|
171 |
* Checks if contact link is a favourite. This is meant to be used for contacts that |
|
172 |
* don't yet have contact data item. Since this needs to go through all the favourites, |
|
173 |
* unnecessary calls should be avoided. |
|
174 |
*/ |
|
175 |
TBool IsFavL( MVPbkContactLink* aLink ); |
|
176 |
||
177 |
/** |
|
178 |
* @return the number of favourites in contact db |
|
179 |
*/ |
|
180 |
TInt NumberOfFavsL(); |
|
181 |
||
182 |
/** |
|
183 |
* Creates contact link to a favourite contact. |
|
184 |
* @param aIndex Index of the favourite in favourites view |
|
185 |
* @return the newly created link (added to cleanupstack) |
|
186 |
*/ |
|
187 |
MVPbkContactLink* FavLinkLC( TInt aIndex ); |
|
188 |
||
189 |
/** |
|
190 |
* Creates contact string for favourite contact. This string can be used directly |
|
191 |
* in the contact listbox. F.ex. "Firstname Surname\tCompanyname". |
|
192 |
* @param aIndex Index of the favourite in favourites view |
|
193 |
* @param aNameOrder Name ordering to be used |
|
194 |
* @return the newly created string (added to cleanupstack) |
|
195 |
*/ |
|
196 |
HBufC* FavContactStringLC( TInt aIndex, TNameOrder aNameOrder ); |
|
197 |
||
198 |
/** |
|
199 |
* @return Contact name display order |
|
200 |
*/ |
|
201 |
TNameOrder NameOrder(); |
|
202 |
||
203 |
/** |
|
204 |
* Pause the loading of contact data. This is used to make sure listbox is responsive |
|
205 |
* and smooth during panning and flicking. |
|
206 |
* @param aPause Pause on/off |
|
207 |
*/ |
|
208 |
void Pause( TBool aPause ); |
|
209 |
||
210 |
public: |
|
211 |
||
212 |
/** |
|
213 |
* From MPbk2ImageGetObserver. |
|
214 |
*/ |
|
215 |
void Pbk2ImageGetComplete(MPbk2ImageOperation& aOperation, CFbsBitmap* aBitmap); |
|
216 |
||
217 |
||
218 |
/** |
|
219 |
* From MPbk2ImageGetObserver. |
|
220 |
*/ |
|
221 |
void Pbk2ImageGetFailed(MPbk2ImageOperation& aOperation, TInt aError); |
|
222 |
||
223 |
public: |
|
224 |
||
225 |
/** |
|
226 |
* From MPbkGlobalSettingObserver. |
|
227 |
*/ |
|
228 |
void SettingChangedL( MPbkGlobalSetting::TPbkGlobalSetting aKey ); |
|
229 |
||
230 |
private: |
|
231 |
||
232 |
/** |
|
233 |
* From MVPbkSingleContactOperationObserver. |
|
234 |
*/ |
|
235 |
void VPbkSingleContactOperationComplete( |
|
236 |
MVPbkContactOperationBase& aOperation, |
|
237 |
MVPbkStoreContact* aContact ); |
|
238 |
||
239 |
||
240 |
/** |
|
241 |
* From MVPbkSingleContactOperationObserver. |
|
242 |
*/ |
|
243 |
void VPbkSingleContactOperationFailed( |
|
244 |
MVPbkContactOperationBase& aOperation, |
|
245 |
TInt aError ); |
|
246 |
||
247 |
private: |
|
248 |
||
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
249 |
|
62 | 250 |
/** |
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
251 |
* From MVPbkContactStoreObserver. |
62 | 252 |
*/ |
253 |
void StoreReady( MVPbkContactStore& aContactStore ); |
|
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
254 |
|
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
255 |
|
62 | 256 |
/** |
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
257 |
* From MVPbkContactStoreObserver. |
62 | 258 |
*/ |
259 |
void StoreUnavailable( MVPbkContactStore& aContactStore, TInt aReason ); |
|
260 |
||
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
261 |
|
62 | 262 |
/** |
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
263 |
* From MVPbkContactStoreObserver. |
62 | 264 |
*/ |
265 |
void HandleStoreEventL( MVPbkContactStore& aContactStore, |
|
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
266 |
TVPbkContactStoreEvent aStoreEvent ); |
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
267 |
|
62 | 268 |
private: |
269 |
/** |
|
270 |
* From MVPbkOperationErrorObserver. |
|
271 |
*/ |
|
272 |
void VPbkOperationFailed( |
|
273 |
MVPbkContactOperationBase* aOperation, |
|
274 |
TInt aError ); |
|
275 |
||
276 |
private: |
|
277 |
/** |
|
278 |
* From MVPbkOperationResultObserver. |
|
279 |
*/ |
|
280 |
void VPbkOperationResultCompleted( |
|
281 |
MVPbkContactOperationBase* aOperation, |
|
282 |
MVPbkContactViewBase* aOperationResult ); |
|
283 |
||
284 |
||
285 |
private: |
|
286 |
/** |
|
287 |
* From MVPbkContactViewObserver. |
|
288 |
* For observing changes to favourites view. |
|
289 |
*/ |
|
290 |
virtual void ContactViewReady( |
|
291 |
MVPbkContactViewBase& aView ); |
|
292 |
||
293 |
virtual void ContactViewUnavailable( |
|
294 |
MVPbkContactViewBase& aView ); |
|
295 |
||
296 |
virtual void ContactAddedToView( |
|
297 |
MVPbkContactViewBase& aView, |
|
298 |
TInt aIndex, |
|
299 |
const MVPbkContactLink& aContactLink ); |
|
300 |
||
301 |
virtual void ContactRemovedFromView( |
|
302 |
MVPbkContactViewBase& aView, |
|
303 |
TInt aIndex, |
|
304 |
const MVPbkContactLink& aContactLink ); |
|
305 |
||
306 |
virtual void ContactViewError( |
|
307 |
MVPbkContactViewBase& aView, |
|
308 |
TInt aError, |
|
309 |
TBool aErrorNotified ); |
|
310 |
||
311 |
private: |
|
312 |
||
313 |
void InitReady(); |
|
314 |
||
315 |
TInt FindContactIndex( MVPbkContactLink* aContact ); |
|
316 |
||
317 |
void LoadNextContactDataL(); |
|
318 |
||
319 |
void DoHandleImageGetCompleteL(CFbsBitmap* aBitmap, TInt aIndex); |
|
320 |
||
321 |
void HandleError(TInt aError); |
|
322 |
||
323 |
void DoHandleContactOperationCompleteL( MVPbkStoreContact* aContact, TInt aIndex); |
|
324 |
||
325 |
void GetAvailableServicesL( MVPbkStoreContact* aContact, TInt aIndex ); |
|
326 |
||
327 |
void InformObserver(); |
|
328 |
||
329 |
void UpdateNameOrderL(); |
|
330 |
||
331 |
private: |
|
332 |
/** Array that contains all loaded contact data. Owned. */ |
|
333 |
RPointerArray<CEasyDialingContactData> iContactDataArray; |
|
334 |
||
335 |
/** Array that contains indexes of thumbnails that are waiting to be loaded. Owned. */ |
|
336 |
RArray<TInt> iWaitingContacts; |
|
337 |
||
338 |
/** Phonebook image manager. Owned. */ |
|
339 |
CPbk2ImageManager* iImageManager; |
|
340 |
||
341 |
/** Parameters for image manager. Contains info about the size of thumbnails. */ |
|
342 |
TPbk2ImageManagerParams iImageManagerParams; |
|
343 |
||
344 |
/** Field type. Not owned. */ |
|
345 |
const MVPbkFieldType* iThumbnailFieldType; |
|
346 |
||
347 |
/** Image loading operation. Owned. */ |
|
348 |
MPbk2ImageOperation* iImageOperation; |
|
349 |
||
350 |
/** Contact item for which a thumbnail is being loaded. Owned. */ |
|
351 |
MVPbkStoreContact* iStoreContact; |
|
352 |
||
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
353 |
/** Virtual phonebook contact manager. Not owned. */ |
62 | 354 |
CVPbkContactManager* iContactManager; |
355 |
||
356 |
/** Contact data manager observer. Not owned. */ |
|
357 |
MContactDataManagerObserver* iObserver; |
|
358 |
||
359 |
/** Top (i.e. favourite) contacts manager. Owned. */ |
|
360 |
CVPbkTopContactManager* iVPbkTopContactManager; |
|
361 |
||
362 |
/** Virtual phonebook operation handle. Owned. */ |
|
363 |
MVPbkContactOperationBase* iContactOperation; |
|
364 |
||
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
365 |
/** Default contact store. Not owned. */ |
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
366 |
MVPbkContactStore* iContactStore; |
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
367 |
|
62 | 368 |
/** Variable which tells either to show or hide contact thumbnails. */ |
369 |
TBool iContactThumbnailSetting; |
|
370 |
||
371 |
/** ETrue if asynchronous opening of the contac store is ready. */ |
|
372 |
TBool iStoreReady; |
|
373 |
||
374 |
/** View to vpbk containing all favourite contacts. Owned. */ |
|
375 |
MVPbkContactViewBase* iFavsView; |
|
376 |
||
377 |
/** Favourites view is ready to be used. */ |
|
378 |
TBool iFavsViewReady; |
|
379 |
||
380 |
/** Virtual phonebook operation handle for getting favourites. Owned. */ |
|
381 |
MVPbkContactOperationBase* iFavsOperation; |
|
382 |
||
383 |
/** Phonebook settings interface. */ |
|
384 |
MPbkGlobalSetting* iPbkSettings; |
|
385 |
||
386 |
/** Contact name display order. */ |
|
387 |
TNameOrder iNameOrder; |
|
388 |
||
389 |
/** Contact data manager pause status */ |
|
390 |
TBool iPause; |
|
391 |
}; |
|
392 |
||
393 |
#endif //__EASYDIALINGTHUMBNAILMANAGER_H__ |