63
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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: Class for handlind the launchpad related data
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef __CCAPPCOMMLAUNCHERLPADMODEL_H__
|
|
20 |
#define __CCAPPCOMMLAUNCHERLPADMODEL_H__
|
|
21 |
|
|
22 |
#include <e32base.h>
|
|
23 |
#include "ccalogger.h"
|
|
24 |
#include <e32hashtab.h>
|
|
25 |
#include <spdefinitions.h>
|
|
26 |
#include <mspnotifychangeobserver.h>
|
|
27 |
#include <VPbkFieldType.hrh>
|
|
28 |
|
|
29 |
|
|
30 |
_LIT( KPbk2ECEIconFileName, "\\resource\\apps\\phonebook2ece.mif");
|
|
31 |
|
|
32 |
class CCCAppCommLauncherContainer;
|
|
33 |
class CAknIconArray;
|
|
34 |
class CCoeEnv;
|
|
35 |
class CFbsBitmap;
|
|
36 |
class CCCAppCommLauncherPlugin;
|
|
37 |
class CCCAppCommLauncherPbkCmd;
|
|
38 |
class CSPSettings;
|
|
39 |
class CSPNotifyChange;
|
|
40 |
|
|
41 |
const TInt KCCAppCommLauncherMaxButtonDataTextLength = 150;
|
|
42 |
|
|
43 |
enum TCCAppCommLauncherAddressFields
|
|
44 |
{
|
|
45 |
EAddressPO,
|
|
46 |
EAddressExt,
|
|
47 |
EAddressStreet,
|
|
48 |
EAddressLocal,
|
|
49 |
EAddressRegion,
|
|
50 |
EAddressPostcode,
|
|
51 |
EAddressCountry
|
|
52 |
};
|
|
53 |
|
|
54 |
/**
|
|
55 |
* Small utility class for launchpad data storage
|
|
56 |
*
|
|
57 |
* @code
|
|
58 |
* ?good_class_usage_example(s)
|
|
59 |
* @endcode
|
|
60 |
*
|
|
61 |
* @lib ccaappcommlauncher.dll
|
|
62 |
* @since S60 v5.0
|
|
63 |
*/
|
|
64 |
class TCommLauncherButtonData
|
|
65 |
{
|
|
66 |
public:
|
|
67 |
TCommLauncherButtonData( VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aContactAction ):
|
|
68 |
iContactAction( aContactAction ),
|
|
69 |
iNumberOfAddresses(0),
|
|
70 |
iFlags(0),
|
|
71 |
iClipFromBegining(EFalse){};
|
|
72 |
|
|
73 |
enum TFlags
|
|
74 |
{
|
|
75 |
EDefaultSet = 0x01,
|
|
76 |
EHasPresenceIcon = 0x02
|
|
77 |
};
|
|
78 |
|
|
79 |
VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector iContactAction;
|
|
80 |
TBuf<KCCAppCommLauncherMaxButtonDataTextLength> iText;
|
|
81 |
TInt iNumberOfAddresses;
|
|
82 |
TUint iFlags;
|
|
83 |
TBuf<KCCAppCommLauncherMaxButtonDataTextLength> iPopupText;
|
|
84 |
TBool iClipFromBegining;
|
|
85 |
};
|
|
86 |
|
|
87 |
/**
|
|
88 |
* Class for handlind the launchpad related data
|
|
89 |
*
|
|
90 |
* @code
|
|
91 |
* ?good_class_usage_example(s)
|
|
92 |
* @endcode
|
|
93 |
*
|
|
94 |
* @lib ccaappcommlauncher.dll
|
|
95 |
* @since S60 v5.0
|
|
96 |
*/
|
|
97 |
class CCCAppCommLauncherLPadModel :
|
|
98 |
public CBase,
|
|
99 |
public MDesCArray,
|
|
100 |
public MSPNotifyChangeObserver
|
|
101 |
{
|
|
102 |
public:
|
|
103 |
|
|
104 |
/**
|
|
105 |
* Two phased constructor.
|
|
106 |
*/
|
|
107 |
static CCCAppCommLauncherLPadModel* NewL(
|
|
108 |
CCCAppCommLauncherContainer& aContainer, CEikListBox& aListBox, CCCAppCommLauncherPlugin& aPlugin );
|
|
109 |
|
|
110 |
/**
|
|
111 |
* Destructor.
|
|
112 |
*/
|
|
113 |
~CCCAppCommLauncherLPadModel();
|
|
114 |
|
|
115 |
/**
|
|
116 |
* See more details from MDesCArray.
|
|
117 |
*
|
|
118 |
* @since S60 v5.0
|
|
119 |
*/
|
|
120 |
TInt MdcaCount() const;
|
|
121 |
|
|
122 |
protected:
|
|
123 |
|
|
124 |
/**
|
|
125 |
* See more details from MDesCArray.
|
|
126 |
*
|
|
127 |
* @since S60 v5.0
|
|
128 |
*/
|
|
129 |
TPtrC MdcaPoint(TInt aIndex) const;
|
|
130 |
|
|
131 |
public: // New
|
|
132 |
|
|
133 |
/**
|
|
134 |
* Fills the communication button related data based on
|
|
135 |
* CCmsContactFieldInfo. Initial layout is created based
|
|
136 |
* on this.
|
|
137 |
*
|
|
138 |
* @since S60 v5.0
|
|
139 |
*/
|
|
140 |
void FillButtonArrayL();
|
|
141 |
|
|
142 |
/**
|
|
143 |
* Loads all the icons needed for listbox.
|
|
144 |
*
|
|
145 |
* @since S60 v5.0
|
|
146 |
*/
|
|
147 |
void LoadIconArrayL();
|
|
148 |
|
|
149 |
/**
|
|
150 |
* Loads one particular icon.
|
|
151 |
*
|
|
152 |
* @since S60 v5.0
|
|
153 |
* @param aBmpId for the icon
|
|
154 |
* @param aBmpId for the icon mask
|
|
155 |
*/
|
|
156 |
CGulIcon* LoadIconLC( TInt aBmpId, TInt aMaskId );
|
|
157 |
|
|
158 |
/**
|
|
159 |
* Mapping of icons in iButtonIconArray.
|
|
160 |
*
|
|
161 |
* @since S60 v5.0
|
|
162 |
*/
|
|
163 |
enum TIconIndex
|
|
164 |
{
|
|
165 |
ECallIconIndex,
|
|
166 |
EMsgIconIndex,
|
|
167 |
EEmailIconIndex,
|
|
168 |
EVoipIconIndex,
|
|
169 |
EInstMsgIconIndex,
|
|
170 |
EUrlIconIndex,
|
|
171 |
EVideocallIconIndex,
|
|
172 |
EAddressValIconIndex,
|
|
173 |
EAddressNotValIconIndex,
|
|
174 |
EMultiIconIndex,
|
|
175 |
EPresenceIconIndex
|
|
176 |
};
|
|
177 |
|
|
178 |
/**
|
|
179 |
* Getter for icon array.
|
|
180 |
*
|
|
181 |
* @since S60 v5.0
|
|
182 |
* @return CAknIconArray containing the icons
|
|
183 |
*/
|
|
184 |
CAknIconArray* IconArray();
|
|
185 |
|
|
186 |
/**
|
|
187 |
* Getter for TCommLauncherButtonData
|
|
188 |
*
|
|
189 |
* @since S60 v5.0
|
|
190 |
* @param Index of wanted buttondata
|
|
191 |
* @return TCommLauncherButtonData
|
|
192 |
*/
|
|
193 |
TCommLauncherButtonData& ButtonData( TInt aIndex );
|
|
194 |
|
|
195 |
/**
|
|
196 |
* Similar as in MCCAppContactHandlerNotifier, but this is
|
|
197 |
* forwarded by container-class.
|
|
198 |
*
|
|
199 |
* @since S60 v5.0
|
|
200 |
* @param aContactField
|
|
201 |
*/
|
|
202 |
void ContactFieldFetchedNotifyL(
|
|
203 |
const CCmsContactField& aContactField );
|
|
204 |
|
|
205 |
/**
|
|
206 |
* Getter for popup-texts
|
|
207 |
*
|
|
208 |
* @since S60 v5.0
|
|
209 |
* @param aButtonIndex
|
|
210 |
* @return descriptor containing text to be shown
|
|
211 |
*/
|
|
212 |
TPtrC TextForPopUpL( TInt aButtonIndex );
|
|
213 |
|
|
214 |
/**
|
|
215 |
* Returns address information for popup-texts
|
|
216 |
*
|
|
217 |
* @param aButtonIndex
|
|
218 |
* @return descriptor containing text to be shown
|
|
219 |
*/
|
|
220 |
TPtrC AddressTextForPopUpL();
|
|
221 |
|
|
222 |
/**
|
|
223 |
* Resets the model, does not unload icons
|
|
224 |
*
|
|
225 |
* @since S60 v5.0
|
|
226 |
*/
|
|
227 |
void Reset();
|
|
228 |
|
|
229 |
/**
|
|
230 |
* Notifies of presence change
|
|
231 |
*
|
|
232 |
* @param aContactField
|
|
233 |
*/
|
|
234 |
void ContactPresenceChangedL( const CCmsContactField& aContactField );
|
|
235 |
|
|
236 |
/**
|
|
237 |
* Updates information if addresses are validated
|
|
238 |
*
|
|
239 |
* @param aContactFieldInfo
|
|
240 |
*/
|
|
241 |
void UpdateAddressesValidationL( const CCmsContactFieldInfo& aContactFieldInfo );
|
|
242 |
|
|
243 |
|
|
244 |
/**
|
|
245 |
* Handle resource change
|
|
246 |
*
|
|
247 |
*/
|
|
248 |
void ResourceChangedL();
|
|
249 |
|
|
250 |
|
|
251 |
private: // New
|
|
252 |
|
|
253 |
/**
|
|
254 |
* Maps communication methods to icons in launchpad-listbox.
|
|
255 |
*
|
|
256 |
* @since S60 v5.0
|
|
257 |
* @param aContactAction communication method
|
|
258 |
* @return icon array index of the icon
|
|
259 |
*/
|
|
260 |
TInt MapCommMethodToIcon(
|
|
261 |
VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aContactAction ) const;
|
|
262 |
|
|
263 |
/**
|
|
264 |
* Updates button's popup text
|
|
265 |
*
|
|
266 |
* @since S60 v5.0
|
|
267 |
* @param aButtonIndex
|
|
268 |
* @param aContactAction communication method
|
|
269 |
* @param aContactField method
|
|
270 |
*/
|
|
271 |
void CheckPopupTextL(
|
|
272 |
const TInt aButtonIndex,
|
|
273 |
const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aContactAction,
|
|
274 |
const CCmsContactField& aContactField );
|
|
275 |
|
|
276 |
/**
|
|
277 |
* Getter for button label text
|
|
278 |
*
|
|
279 |
* @since S60 v5.0
|
|
280 |
* @param aContactAction communication method
|
|
281 |
* @param aText descriptor the text will be copied to, needs size of at least KCCAppCommLauncherMaxButtonDataTextLength
|
|
282 |
*/
|
|
283 |
void ButtonTextL(
|
|
284 |
VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aContactAction,
|
|
285 |
TDes& aText );
|
|
286 |
|
|
287 |
/**
|
|
288 |
* Updates addresses button popup text
|
|
289 |
*
|
|
290 |
* @since S60 v5.0
|
|
291 |
* @param aButtonIndex
|
|
292 |
* @param aContactAction communication method
|
|
293 |
* @param aContactField method
|
|
294 |
*/
|
|
295 |
void CheckAddressesPopupTextL(
|
|
296 |
const TInt aButtonIndex,
|
|
297 |
const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aContactAction,
|
|
298 |
const CCmsContactField& aContactField );
|
|
299 |
|
|
300 |
private:
|
|
301 |
|
|
302 |
/**
|
|
303 |
* Private constructor
|
|
304 |
*/
|
|
305 |
CCCAppCommLauncherLPadModel( CCCAppCommLauncherContainer& aContainer,
|
|
306 |
CEikListBox& aListBox,
|
|
307 |
CCCAppCommLauncherPlugin& aPlugin );
|
|
308 |
|
|
309 |
/**
|
|
310 |
* ConstructL
|
|
311 |
*/
|
|
312 |
void ConstructL();
|
|
313 |
|
|
314 |
/**
|
|
315 |
* Finds the number of services that support internet call
|
|
316 |
* by scanning all the services in the SPSettings Table.
|
|
317 |
* @param aServiceId - Stores the last matched service id
|
|
318 |
* @return - Total Number of services on which Internet call is possible
|
|
319 |
*/
|
|
320 |
TInt GetSupportedVOIPServicesL( TServiceId& aServiceId );
|
|
321 |
|
|
322 |
/**
|
|
323 |
* Loads the Branded VOIP icon & Localised ServiceName
|
|
324 |
* from PBK2 service manager interface
|
|
325 |
* @param aServiceId - Service Id of the Service that supports InternetCall
|
|
326 |
* @param aBitmap - Contains the Retreived BrandIcon Bitmap. Ownership
|
|
327 |
* is passed to the caller
|
|
328 |
* @param aMask - Contains the Retreived BrandIcon Bitmap MAsk. Ownership
|
|
329 |
* is passed to the caller
|
|
330 |
* @param aLocalisedServiceName - Contains the localised service name
|
|
331 |
* @return None
|
|
332 |
*/
|
|
333 |
void LoadVoipButtonInfoFromPbkL(
|
|
334 |
TServiceId aServiceId,
|
|
335 |
CFbsBitmap*& aBitmap, CFbsBitmap*& aMask, HBufC*& aLocalisedServiceName );
|
|
336 |
|
|
337 |
/**
|
|
338 |
* Handles SPSettings Changes
|
|
339 |
*/
|
|
340 |
void DoHandleNotifyChangeL() ;
|
|
341 |
|
|
342 |
/**
|
|
343 |
* Loads the VOIP Button Icon & Label
|
|
344 |
* Usecase : If we have only one voip service, the voip(Internet Call)
|
|
345 |
* button should have the Branded Icon of that Service and the label
|
|
346 |
* must be "ServiceName" appended with "Call".
|
|
347 |
* eg : If we have a service named SKYPE installed in the Phone
|
|
348 |
* and if SKYPE supports VOIP, then the VOIP Button Icon should be
|
|
349 |
* the Branded Icon of SKYPE and the Button Label should be
|
|
350 |
* "SKYPE CALL".
|
|
351 |
* @return TInt - Stores the Info regd whether Image/Text was set for the
|
|
352 |
* VOIP Buttton or not. We use KVOIPButtonImageSet && with the returnval
|
|
353 |
* to know whether Image has been set or not
|
|
354 |
* Will be used in HandleNotifyChange
|
|
355 |
*/
|
|
356 |
TInt LoadVoipButtonInfoL();
|
|
357 |
|
|
358 |
/*
|
|
359 |
* Calculate the layout size
|
|
360 |
*/
|
|
361 |
void CalculateLayoutSize();
|
|
362 |
|
|
363 |
|
|
364 |
private:
|
|
365 |
//From MSPNotifyChangeObserver
|
|
366 |
void HandleNotifyChange( TServiceId aServiceId );
|
|
367 |
void HandleError( TInt aError );
|
|
368 |
|
|
369 |
private:
|
|
370 |
|
|
371 |
/* Check if multi icon should be show
|
|
372 |
* @param aButtonIndex - The button index
|
|
373 |
* @return - EFalse for not show, ETrue for show the icon
|
|
374 |
*/
|
|
375 |
TBool IfShowMultiIcon(TInt aButtonIndex) const;
|
|
376 |
|
|
377 |
|
|
378 |
/* Set clip direction for label text
|
|
379 |
* @param aContactAction: The action type
|
|
380 |
* @param aCmsFieldType: Cms field type
|
|
381 |
* @return - none
|
|
382 |
*/
|
|
383 |
void SetTextClipDirection(
|
|
384 |
VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aContactAction,
|
|
385 |
TInt aButtonIndex
|
|
386 |
/*CCmsContactFieldItem::TCmsContactField aCmsFieldType*/ );
|
|
387 |
|
|
388 |
/* Clip the text from begining
|
|
389 |
* @param aBuffer
|
|
390 |
* @param aItemIndex
|
|
391 |
* @param aSubCellNumber
|
|
392 |
* @return - the result of clipping
|
|
393 |
*/
|
|
394 |
TBool ClipFromBeginning(
|
|
395 |
TDes& aBuffer,
|
|
396 |
TInt aItemIndex,
|
|
397 |
TInt aSubCellNumber) const;
|
|
398 |
|
|
399 |
/*
|
|
400 |
* In Arabic variant the displaying of numbers in phonebook should follow
|
|
401 |
* the Arabic/Latin number setting that is found in General Settings >
|
|
402 |
* Phone > Language, So the second row text must be digits.
|
|
403 |
* @param aContactField method
|
|
404 |
*/
|
|
405 |
TBool IsPhoneNumber( const CCmsContactField& iContactField );
|
|
406 |
|
|
407 |
private: // Data
|
|
408 |
|
|
409 |
/**
|
|
410 |
* Array of button data
|
|
411 |
* Own.
|
|
412 |
*/
|
|
413 |
RArray<TCommLauncherButtonData> iButtonDataArray;
|
|
414 |
/**
|
|
415 |
* Array of icons used in listbox
|
|
416 |
* Own.
|
|
417 |
*/
|
|
418 |
CAknIconArray* iButtonIconArray;
|
|
419 |
/**
|
|
420 |
* For storing the texts
|
|
421 |
* Own.
|
|
422 |
*/
|
|
423 |
HBufC* iTempText;
|
|
424 |
/**
|
|
425 |
* Ref to container class
|
|
426 |
* Not own.
|
|
427 |
*/
|
|
428 |
CCCAppCommLauncherContainer& iContainer;
|
|
429 |
/**
|
|
430 |
* Addresses validation status
|
|
431 |
* Own.
|
|
432 |
*/
|
|
433 |
TBool iAddressesValidated;
|
|
434 |
/**
|
|
435 |
* For storing the address text
|
|
436 |
* Own.
|
|
437 |
*/
|
|
438 |
RHashMap<TInt, TPtrC> iAddressFields;
|
|
439 |
|
|
440 |
/**
|
|
441 |
* Launching performance logger
|
|
442 |
* Will be removed (hopefully) when launching performance is sufficient.
|
|
443 |
*/
|
|
444 |
TBool iPerfLauncherCalled;
|
|
445 |
|
|
446 |
/**
|
|
447 |
* Environment.
|
|
448 |
* Not Own.
|
|
449 |
*/
|
|
450 |
CCoeEnv& iCoeEnv;
|
|
451 |
|
|
452 |
/*
|
|
453 |
* Reference to list box control
|
|
454 |
*/
|
|
455 |
CEikListBox& iListBox;
|
|
456 |
|
|
457 |
/**
|
|
458 |
* Ref to plugin.
|
|
459 |
* Not own.
|
|
460 |
*/
|
|
461 |
CCCAppCommLauncherPlugin& iPlugin;
|
|
462 |
|
|
463 |
/// Own: CCCAppCommLauncherPbkCmd
|
|
464 |
// used to get the instance of the Phonebook 2 application services.
|
|
465 |
CCCAppCommLauncherPbkCmd* iPbkCmd;
|
|
466 |
|
|
467 |
//Owns - Instance to spSettings
|
|
468 |
CSPSettings* iSettings;
|
|
469 |
|
|
470 |
//Owns - Service provider settings change notifer
|
|
471 |
CSPNotifyChange* iSPNotifyChange;
|
|
472 |
|
|
473 |
// Owns - Text buffer
|
|
474 |
HBufC* iTextBuf;
|
|
475 |
|
|
476 |
// Size for service icon
|
|
477 |
TSize iServiceIconSize;
|
|
478 |
|
|
479 |
// Size for presence icon
|
|
480 |
TSize iPresenceIconSize;
|
|
481 |
|
|
482 |
inline void RunLaunchLogger()
|
|
483 |
{
|
|
484 |
#ifdef PERF_LAUNCH
|
|
485 |
if(!iPerfLauncherCalled)
|
|
486 |
{
|
|
487 |
WriteToPerfLaunchLog(_L(" Ready"));
|
|
488 |
iPerfLauncherCalled = ETrue;
|
|
489 |
}
|
|
490 |
#endif // PERF_LAUNCH
|
|
491 |
}
|
|
492 |
};
|
|
493 |
|
|
494 |
|
|
495 |
|
|
496 |
#endif // __CCAPPCOMMLAUNCHERLPADMODEL_H__
|
|
497 |
//End of file
|