|
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 #include "ccappcommlauncherheaders.h" |
|
20 #include <phonebook2ece.mbg> |
|
21 |
|
22 #include <CPbk2ApplicationServices.h> |
|
23 #include <CPbk2ServiceManager.h> |
|
24 |
|
25 #include <aknlayoutscalable_avkon.cdl.h> |
|
26 #include <aknlayoutscalable_apps.cdl.h> |
|
27 //SpSettings |
|
28 #include <spsettings.h> |
|
29 #include <spentry.h> |
|
30 #include <mnproviderfinder.h> |
|
31 #include <StringLoader.h> |
|
32 |
|
33 #include <spproperty.h> |
|
34 #include <spnotifychange.h> |
|
35 |
|
36 //Bitmap |
|
37 #include <bitdev.h> |
|
38 #include <cbsbitmap.h> |
|
39 #include <AknIconUtils.h> |
|
40 |
|
41 #include <AknBidiTextUtils.h> |
|
42 |
|
43 namespace { |
|
44 |
|
45 #define KOneVOIPServiceAvailable 1 |
|
46 #define KVOIPButtonImageSet 0x1 |
|
47 #define KVOIPButtonTextSet 0x2 |
|
48 const TText KCCASpaceChar = ' '; |
|
49 |
|
50 /** |
|
51 * Compares entry service name to scheme. |
|
52 * |
|
53 * @param aEntry entry to be analyzed |
|
54 * @param aScheme to be compared with |
|
55 */ |
|
56 TBool CompareService(CSPEntry& aEntry, const TDesC& aScheme) |
|
57 { |
|
58 const TDesC& name = aEntry.GetServiceName(); |
|
59 if (name.CompareF(aScheme) == KErrNone) |
|
60 { |
|
61 return ETrue; |
|
62 } |
|
63 return EFalse; |
|
64 } |
|
65 |
|
66 TPtrC ParseService(const TDesC& aData) |
|
67 { |
|
68 TPtrC result = KNullDesC(); |
|
69 TInt index = aData.Locate(':'); |
|
70 if (index > 0) |
|
71 { |
|
72 result.Set(aData.Left(index)); |
|
73 } |
|
74 return result; |
|
75 } |
|
76 |
|
77 /** |
|
78 * Returns index of a first IM field. |
|
79 */ |
|
80 TInt SelectIMIndexL(const CCmsContactField& aContactField) |
|
81 { |
|
82 TInt result = 0; // by default returns 0 |
|
83 CSPSettings* settings = CSPSettings::NewLC(); |
|
84 RIdArray idArray; |
|
85 TBool found = EFalse; |
|
86 CleanupClosePushL(idArray); |
|
87 |
|
88 TInt error = settings->FindServiceIdsL(idArray); |
|
89 if (error == KErrNone) |
|
90 { |
|
91 for (TInt i = 0; !found && i < idArray.Count(); ++i) |
|
92 { |
|
93 CSPEntry* entry = CSPEntry::NewLC(); |
|
94 settings->FindEntryL(idArray[i], *entry); |
|
95 |
|
96 const CSPProperty* prop = NULL; |
|
97 if (entry->GetProperty(prop, ESubPropertyIMLaunchUid) == KErrNone) |
|
98 { |
|
99 for (TInt i = 0; i < aContactField.ItemCount(); ++i) |
|
100 { |
|
101 const CCmsContactFieldItem& item = aContactField.ItemL(i); |
|
102 TPtrC data = item.Data(); |
|
103 TPtrC scheme = ParseService(data); |
|
104 if (CompareService(*entry, scheme)) |
|
105 { |
|
106 result = i; |
|
107 found = ETrue; |
|
108 break; |
|
109 } |
|
110 } |
|
111 } |
|
112 CleanupStack::PopAndDestroy(); // entry |
|
113 } |
|
114 } |
|
115 |
|
116 CleanupStack::PopAndDestroy(2); // idArray, settings |
|
117 return result; |
|
118 } |
|
119 |
|
120 |
|
121 /** |
|
122 * Returns index of a first VOIP field. |
|
123 */ |
|
124 TInt SelectVOIPIndexL(const CCmsContactField& aContactField) |
|
125 { |
|
126 TInt result = 0; // by default returns 0 |
|
127 CSPSettings* settings = CSPSettings::NewLC(); |
|
128 RIdArray idArray; |
|
129 TBool found = EFalse; |
|
130 CleanupClosePushL(idArray); |
|
131 |
|
132 TInt error = settings->FindServiceIdsL(idArray); |
|
133 if (error == KErrNone) |
|
134 { |
|
135 for (TInt i = 0; !found && i < idArray.Count(); ++i) |
|
136 { |
|
137 CSPEntry* entry = CSPEntry::NewLC(); |
|
138 settings->FindEntryL(idArray[i], *entry); |
|
139 |
|
140 const CSPProperty* prop = NULL; |
|
141 |
|
142 if (entry->GetProperty(prop, EPropertyServiceAttributeMask) == KErrNone) |
|
143 { |
|
144 TInt value = 0; |
|
145 prop->GetValue(value); |
|
146 |
|
147 if ( value & ESupportsInternetCall ) |
|
148 { |
|
149 for (TInt i = 0; i < aContactField.ItemCount(); ++i) |
|
150 { |
|
151 const CCmsContactFieldItem& item = aContactField.ItemL(i); |
|
152 TPtrC data = item.Data(); |
|
153 TPtrC scheme = ParseService(data); |
|
154 if (CompareService(*entry, scheme)) |
|
155 { |
|
156 result = i; |
|
157 found = ETrue; |
|
158 break; |
|
159 } |
|
160 } |
|
161 } |
|
162 } |
|
163 CleanupStack::PopAndDestroy(); // entry |
|
164 } |
|
165 } |
|
166 |
|
167 CleanupStack::PopAndDestroy(2); // idArray, settings |
|
168 return result; |
|
169 } |
|
170 |
|
171 |
|
172 /** |
|
173 * Clones the Bitmap |
|
174 * This is better than Duplicating the bitmap |
|
175 */ |
|
176 CFbsBitmap* CloneBitmapLC(TSize aSize, CFbsBitmap* aBitmap) |
|
177 { |
|
178 CFbsBitmap* bitmap = new (ELeave) CFbsBitmap(); |
|
179 CleanupStack::PushL( bitmap ); |
|
180 bitmap->Create( aSize, aBitmap->DisplayMode() ); |
|
181 CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL( bitmap ); |
|
182 CleanupStack::PushL( bitmapDevice ); |
|
183 CFbsBitGc* graphicsContext = NULL; |
|
184 User::LeaveIfError( bitmapDevice->CreateContext( graphicsContext ) ); |
|
185 CleanupStack::PushL( graphicsContext ); |
|
186 graphicsContext->BitBlt( TPoint(0, 0), aBitmap ); |
|
187 CleanupStack::PopAndDestroy( 2 );//graphicsContext,bitmapDevice |
|
188 return bitmap; |
|
189 } |
|
190 |
|
191 |
|
192 } |
|
193 |
|
194 // ======== MEMBER FUNCTIONS ======== |
|
195 |
|
196 // --------------------------------------------------------------------------- |
|
197 // CCCAppCommLauncherLPadModel::CCCAppCommLauncherLPadModel |
|
198 // --------------------------------------------------------------------------- |
|
199 // |
|
200 CCCAppCommLauncherLPadModel::CCCAppCommLauncherLPadModel( |
|
201 CCCAppCommLauncherContainer& aContainer, |
|
202 CEikListBox& aListBox, |
|
203 CCCAppCommLauncherPlugin& aPlugin ) |
|
204 : |
|
205 iContainer ( aContainer ), |
|
206 iPerfLauncherCalled(EFalse), |
|
207 iCoeEnv(*CCoeEnv::Static()), |
|
208 iListBox(aListBox), |
|
209 iPlugin(aPlugin) |
|
210 { |
|
211 CCA_DP( KCommLauncherLogFile, CCA_L("CCCAppCommLauncherLPadModel::CCCAppCommLauncherLPadModel")); |
|
212 } |
|
213 |
|
214 // --------------------------------------------------------------------------- |
|
215 // CCCAppCommLauncherLPadModel::~CCCAppCommLauncherLPadModel |
|
216 // --------------------------------------------------------------------------- |
|
217 // |
|
218 CCCAppCommLauncherLPadModel::~CCCAppCommLauncherLPadModel() |
|
219 { |
|
220 CCA_DP( KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherLPadModel::~CCCAppCommLauncherLPadModel")); |
|
221 |
|
222 if(iSPNotifyChange) |
|
223 { |
|
224 iSPNotifyChange->NotifyChangeCancel(); |
|
225 } |
|
226 |
|
227 delete iSPNotifyChange; |
|
228 delete iSettings; |
|
229 |
|
230 delete iPbkCmd; |
|
231 |
|
232 iButtonDataArray.Reset(); |
|
233 delete iTempText; |
|
234 iAddressFields.Close(); |
|
235 |
|
236 |
|
237 delete iTextBuf; |
|
238 |
|
239 CCA_DP( KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherLPadModel::~CCCAppCommLauncherLPadModel")); |
|
240 } |
|
241 |
|
242 // --------------------------------------------------------------------------- |
|
243 // CCCAppCommLauncherLPadModel::NewL |
|
244 // --------------------------------------------------------------------------- |
|
245 // |
|
246 CCCAppCommLauncherLPadModel* CCCAppCommLauncherLPadModel::NewL( |
|
247 CCCAppCommLauncherContainer& aContainer, CEikListBox& aListBox, CCCAppCommLauncherPlugin& aPlugin ) |
|
248 { |
|
249 CCA_DP( KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherLPadModel::NewL")); |
|
250 CCCAppCommLauncherLPadModel* self = |
|
251 new( ELeave ) CCCAppCommLauncherLPadModel( aContainer, aListBox, aPlugin ); |
|
252 CleanupStack::PushL( self ); |
|
253 self->ConstructL(); |
|
254 CleanupStack::Pop( self ); |
|
255 CCA_DP( KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherLPadModel::NewL")); |
|
256 return self; |
|
257 } |
|
258 |
|
259 // --------------------------------------------------------------------------- |
|
260 // CCCAppCommLauncherLPadModel::ConstructL |
|
261 // --------------------------------------------------------------------------- |
|
262 // |
|
263 void CCCAppCommLauncherLPadModel::ConstructL() |
|
264 { |
|
265 CCA_DP( KCommLauncherLogFile, CCA_L("CCCAppCommLauncherLPadModel::ConstructL")); |
|
266 iTempText = HBufC::NewL( KCCAppCommLauncherMaxButtonDataTextLength ); |
|
267 iTextBuf = HBufC::NewL( KCCAppCommLauncherMaxButtonDataTextLength ); |
|
268 iAddressFields.Close(); |
|
269 iButtonIconArray = new (ELeave) CAknIconArray( 2 ); |
|
270 iAddressesValidated = EFalse; |
|
271 iPbkCmd = CCCAppCommLauncherPbkCmd::NewL( iPlugin ); |
|
272 iSettings = CSPSettings::NewL(); |
|
273 iSPNotifyChange = CSPNotifyChange::NewL(*this); |
|
274 RIdArray idArray; |
|
275 CleanupClosePushL(idArray); |
|
276 User::LeaveIfError( iSettings->FindServiceIdsL(idArray) ); |
|
277 //Listen for any changes to these settings |
|
278 iSPNotifyChange->NotifyChangeL( idArray ); |
|
279 CleanupStack::PopAndDestroy(); //idArray |
|
280 } |
|
281 |
|
282 // --------------------------------------------------------------------------- |
|
283 // CCCAppCommLauncherLPadModel::MdcaCount |
|
284 // --------------------------------------------------------------------------- |
|
285 // |
|
286 TInt CCCAppCommLauncherLPadModel::MdcaCount() const |
|
287 { |
|
288 return iButtonDataArray.Count(); |
|
289 } |
|
290 |
|
291 // --------------------------------------------------------------------------- |
|
292 // CCCAppCommLauncherLPadModel::MdcaPoint |
|
293 // --------------------------------------------------------------------------- |
|
294 // |
|
295 TPtrC CCCAppCommLauncherLPadModel::MdcaPoint( TInt aIndex ) const |
|
296 { |
|
297 TPtr tempText = iTempText->Des(); |
|
298 tempText.Zero(); |
|
299 |
|
300 if ( iButtonDataArray.Count() > aIndex ) |
|
301 { |
|
302 TPtr textPtr(iTextBuf->Des()); |
|
303 textPtr.Zero(); |
|
304 TPtrC popupText; |
|
305 TRAPD( error, popupText.Set( |
|
306 const_cast <CCCAppCommLauncherLPadModel*>(this)->TextForPopUpL( aIndex ) ) ); |
|
307 if ( KErrNone == error ) |
|
308 { |
|
309 textPtr.Copy( popupText ); |
|
310 } |
|
311 else |
|
312 { |
|
313 textPtr.Copy( iButtonDataArray[ aIndex ].iPopupText ); |
|
314 } |
|
315 |
|
316 if ( iButtonDataArray[ aIndex ].iClipFromBegining ) |
|
317 { |
|
318 // Clip for second row text |
|
319 ClipFromBeginning( textPtr, aIndex, 2 ); |
|
320 } |
|
321 |
|
322 tempText.AppendNum( MapCommMethodToIcon( |
|
323 iButtonDataArray[ aIndex ].iContactAction )); |
|
324 tempText.Append( KColumnListSeparator ); |
|
325 tempText.Append( iButtonDataArray[ aIndex ].iText ); |
|
326 tempText.Append( KColumnListSeparator ); |
|
327 if( textPtr.Length() + tempText.Length() >= |
|
328 KCCAppCommLauncherMaxButtonDataTextLength ) |
|
329 { |
|
330 tempText.Append( textPtr.Left( |
|
331 KCCAppCommLauncherMaxButtonDataTextLength - tempText.Length() - 4 ) ); |
|
332 } |
|
333 else |
|
334 { |
|
335 tempText.Append( textPtr ); |
|
336 } |
|
337 tempText.Append( KColumnListSeparator ); |
|
338 |
|
339 // Check presence icon |
|
340 if ( iButtonDataArray[ aIndex ].iFlags & |
|
341 TCommLauncherButtonData::EHasPresenceIcon ) |
|
342 { |
|
343 tempText.AppendNum( EPresenceIconIndex ); |
|
344 } |
|
345 tempText.Append( KColumnListSeparator ); |
|
346 |
|
347 // Check if show multi icon at the right end of second row |
|
348 if ( IfShowMultiIcon( aIndex ) ) |
|
349 { |
|
350 tempText.AppendNum( EMultiIconIndex ); |
|
351 } |
|
352 } |
|
353 |
|
354 return tempText; |
|
355 } |
|
356 |
|
357 // --------------------------------------------------------------------------- |
|
358 // CCCAppCommLauncherLPadModel::MapCommMethodToIcon |
|
359 // --------------------------------------------------------------------------- |
|
360 // |
|
361 TInt CCCAppCommLauncherLPadModel::MapCommMethodToIcon( |
|
362 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aContactAction ) const |
|
363 { |
|
364 TInt iconIndex = KErrNotFound; |
|
365 |
|
366 switch( aContactAction ) |
|
367 { |
|
368 case VPbkFieldTypeSelectorFactory::EVoiceCallSelector: |
|
369 iconIndex = ECallIconIndex; |
|
370 break; |
|
371 case VPbkFieldTypeSelectorFactory::EUniEditorSelector: |
|
372 iconIndex = EMsgIconIndex; |
|
373 break; |
|
374 case VPbkFieldTypeSelectorFactory::EEmailEditorSelector: |
|
375 iconIndex = EEmailIconIndex; |
|
376 break; |
|
377 case VPbkFieldTypeSelectorFactory::EVOIPCallSelector: |
|
378 iconIndex = EVoipIconIndex; |
|
379 break; |
|
380 case VPbkFieldTypeSelectorFactory::EInstantMessagingSelector: |
|
381 iconIndex = EInstMsgIconIndex; |
|
382 break; |
|
383 case VPbkFieldTypeSelectorFactory::EURLSelector: |
|
384 iconIndex = EUrlIconIndex; |
|
385 break; |
|
386 case VPbkFieldTypeSelectorFactory::EVideoCallSelector: |
|
387 iconIndex = EVideocallIconIndex; |
|
388 break; |
|
389 case VPbkFieldTypeSelectorFactory::EFindOnMapSelector: |
|
390 if ( iAddressesValidated ) |
|
391 { |
|
392 iconIndex = EAddressValIconIndex; |
|
393 } |
|
394 else |
|
395 { |
|
396 iconIndex = EAddressNotValIconIndex; |
|
397 } |
|
398 break; |
|
399 default: |
|
400 break; |
|
401 } |
|
402 |
|
403 return iconIndex; |
|
404 } |
|
405 |
|
406 // --------------------------------------------------------------------------- |
|
407 // CCCAppCommLauncherLPadModel::FillButtonArrayL |
|
408 // --------------------------------------------------------------------------- |
|
409 // |
|
410 void CCCAppCommLauncherLPadModel::FillButtonArrayL() |
|
411 { |
|
412 CalculateLayoutSize(); |
|
413 |
|
414 RArray<VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector>& |
|
415 preferredCommMethods = iContainer.Plugin().PreferredCommMethods();//not owned |
|
416 const TInt buttonCount = preferredCommMethods.Count(); |
|
417 |
|
418 for ( TInt i = 0; i < buttonCount; i++ ) |
|
419 { |
|
420 const TInt numberOfAddresses = |
|
421 iContainer.Plugin().ContactHandler().AddressAmount( |
|
422 preferredCommMethods[i] ); |
|
423 |
|
424 if ( numberOfAddresses ) |
|
425 { |
|
426 const TBool isServiceAvailable = |
|
427 iContainer.Plugin().ContactHandler().IsServiceAvailable( |
|
428 preferredCommMethods[i] ); |
|
429 if ( isServiceAvailable ) |
|
430 { |
|
431 TCommLauncherButtonData buttonData = |
|
432 TCommLauncherButtonData( preferredCommMethods[i] ); |
|
433 ButtonTextL(preferredCommMethods[i], buttonData.iText); |
|
434 buttonData.iNumberOfAddresses = numberOfAddresses; |
|
435 iButtonDataArray.AppendL( buttonData ); |
|
436 } |
|
437 } |
|
438 } |
|
439 |
|
440 LoadIconArrayL(); |
|
441 |
|
442 //Load Specialised Voip Icons if only one voip service is available |
|
443 //CCA spec will be updated with this necessary change |
|
444 |
|
445 //Usecase : If we have only one voip service, the voip(Internet Call) |
|
446 //button should have the Branded Icon of that Service and the label |
|
447 //must be "ServiceName" appended with "Call". |
|
448 //eg : If we have a service named SKYPE installed in the Phone |
|
449 //and if SKYPE supports VOIP, then the VOIP Button Icon should be |
|
450 //the Branded Icon of SKYPE and the Button Label should be |
|
451 //"SKYPE CALL". |
|
452 //If we have more than one voip service, then the VOIP button should |
|
453 //show the default voip button EMbmPhonebook2eceQgn_prop_pb_comm_voip |
|
454 //(Globe with Phone) and the Button label should be r_qtn_cca_voip_call |
|
455 //as defined in the rss |
|
456 LoadVoipButtonInfoL(); |
|
457 |
|
458 // Update CBA with MSK "Select" if there are communication methods available. |
|
459 TBool communicationMethodsAvailable = ( iButtonDataArray.Count() > 0 ); |
|
460 iContainer.Plugin().UpdateMSKinCbaL( communicationMethodsAvailable ); |
|
461 |
|
462 } |
|
463 |
|
464 // --------------------------------------------------------------------------- |
|
465 // CCCAppCommLauncherLPadModel::ButtonTextL |
|
466 // --------------------------------------------------------------------------- |
|
467 // |
|
468 void CCCAppCommLauncherLPadModel::ButtonTextL( |
|
469 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aContactAction, |
|
470 TDes& aText) |
|
471 { |
|
472 TInt resId = KErrNotFound; |
|
473 switch( aContactAction ) |
|
474 { |
|
475 case VPbkFieldTypeSelectorFactory::EVoiceCallSelector: |
|
476 resId = R_QTN_CCA_CALL; |
|
477 break; |
|
478 case VPbkFieldTypeSelectorFactory::EUniEditorSelector: |
|
479 resId = R_QTN_CCA_MESSAGE; |
|
480 break; |
|
481 case VPbkFieldTypeSelectorFactory::EEmailEditorSelector: |
|
482 resId = R_QTN_CCA_EMAIL; |
|
483 break; |
|
484 case VPbkFieldTypeSelectorFactory::EInstantMessagingSelector: |
|
485 resId = R_QTN_CCA_CHAT; |
|
486 break; |
|
487 case VPbkFieldTypeSelectorFactory::EVOIPCallSelector: |
|
488 resId = R_QTN_CCA_VOIP_CALL; |
|
489 break; |
|
490 case VPbkFieldTypeSelectorFactory::EURLSelector: |
|
491 resId = R_QTN_CCA_URL; |
|
492 break; |
|
493 case VPbkFieldTypeSelectorFactory::EVideoCallSelector: |
|
494 resId = R_QTN_CCA_VIDEO_CALL; |
|
495 break; |
|
496 case VPbkFieldTypeSelectorFactory::EFindOnMapSelector: |
|
497 if ( iAddressesValidated ) |
|
498 { |
|
499 resId = R_QTN_PHOB_COMLAUNCHER_SHOW_ON_MAP; |
|
500 } |
|
501 else |
|
502 { |
|
503 resId = R_QTN_PHOB_COMLAUNCHER_FIND_ON_MAP; |
|
504 } |
|
505 break; |
|
506 default: |
|
507 break; |
|
508 } |
|
509 |
|
510 if ( KErrNotFound != resId ) |
|
511 { |
|
512 aText.Copy( StringLoader::LoadLC( resId, &iCoeEnv ) |
|
513 ->Left( KCCAppCommLauncherMaxButtonDataTextLength )); |
|
514 CleanupStack::PopAndDestroy(); |
|
515 } |
|
516 } |
|
517 |
|
518 // ----------------------------------------------------------------------------- |
|
519 // CCCAppCommLauncherLPadModel::ContactFieldFetchedNotifyL() |
|
520 // ----------------------------------------------------------------------------- |
|
521 // |
|
522 void CCCAppCommLauncherLPadModel::ContactFieldFetchedNotifyL( |
|
523 const CCmsContactField& aContactField ) |
|
524 { |
|
525 const TInt count = iButtonDataArray.Count(); |
|
526 CCmsContactFieldItem::TCmsContactField dataType = aContactField.Type(); |
|
527 CCCAppCommLauncherContactHandler& contactHandler = |
|
528 iContainer.Plugin().ContactHandler();//not owned |
|
529 |
|
530 if ( contactHandler.ContactFieldTypeAndContactActionMatch( dataType, |
|
531 VPbkFieldTypeSelectorFactory::EVoiceCallSelector )) |
|
532 {// voice call |
|
533 for ( TInt i = 0; i < count; i++ ) |
|
534 { |
|
535 CheckPopupTextL( |
|
536 i, VPbkFieldTypeSelectorFactory::EVoiceCallSelector, aContactField ); |
|
537 } |
|
538 |
|
539 //PERFORMANCE LOGGING: 11. Phonenumber data received & consumed |
|
540 WriteToPerfLog(); |
|
541 |
|
542 RunLaunchLogger(); |
|
543 |
|
544 } |
|
545 if ( contactHandler.ContactFieldTypeAndContactActionMatch( dataType, |
|
546 VPbkFieldTypeSelectorFactory::EUniEditorSelector )) |
|
547 {// unieditor |
|
548 for ( TInt i = 0; i < count; i++ ) |
|
549 { |
|
550 CheckPopupTextL( |
|
551 i, VPbkFieldTypeSelectorFactory::EUniEditorSelector, aContactField ); |
|
552 } |
|
553 } |
|
554 if ( contactHandler.ContactFieldTypeAndContactActionMatch( dataType, |
|
555 VPbkFieldTypeSelectorFactory::EEmailEditorSelector )) |
|
556 {// email |
|
557 for ( TInt i = 0; i < count; i++ ) |
|
558 { |
|
559 CheckPopupTextL( |
|
560 i, VPbkFieldTypeSelectorFactory::EEmailEditorSelector, aContactField ); |
|
561 } |
|
562 } |
|
563 if ( contactHandler.ContactFieldTypeAndContactActionMatch( dataType, |
|
564 VPbkFieldTypeSelectorFactory::EVOIPCallSelector )) |
|
565 {// voip |
|
566 for ( TInt i = 0; i < count; i++ ) |
|
567 { |
|
568 CheckPopupTextL( |
|
569 i, VPbkFieldTypeSelectorFactory::EVOIPCallSelector, aContactField ); |
|
570 } |
|
571 } |
|
572 if ( contactHandler.ContactFieldTypeAndContactActionMatch( dataType, |
|
573 VPbkFieldTypeSelectorFactory::EInstantMessagingSelector )) |
|
574 {// im |
|
575 for ( TInt i = 0; i < count; i++ ) |
|
576 { |
|
577 CheckPopupTextL( |
|
578 i, VPbkFieldTypeSelectorFactory::EInstantMessagingSelector, aContactField ); |
|
579 } |
|
580 } |
|
581 if ( contactHandler.ContactFieldTypeAndContactActionMatch( dataType, |
|
582 VPbkFieldTypeSelectorFactory::EURLSelector )) |
|
583 {// url |
|
584 for ( TInt i = 0; i < count; i++ ) |
|
585 { |
|
586 CheckPopupTextL( |
|
587 i, VPbkFieldTypeSelectorFactory::EURLSelector, aContactField ); |
|
588 } |
|
589 } |
|
590 if ( contactHandler.ContactFieldTypeAndContactActionMatch( dataType, |
|
591 VPbkFieldTypeSelectorFactory::EFindOnMapSelector )) |
|
592 {// address |
|
593 for ( TInt i = 0; i < count; i++ ) |
|
594 { |
|
595 CheckPopupTextL( i, |
|
596 VPbkFieldTypeSelectorFactory::EFindOnMapSelector, |
|
597 aContactField ); |
|
598 } |
|
599 } |
|
600 if ( contactHandler.ContactFieldTypeAndContactActionMatch( dataType, |
|
601 VPbkFieldTypeSelectorFactory::EVideoCallSelector )) |
|
602 {// video call |
|
603 for ( TInt i = 0; i < count; i++ ) |
|
604 { |
|
605 CheckPopupTextL( |
|
606 i, VPbkFieldTypeSelectorFactory::EVideoCallSelector, aContactField ); |
|
607 } |
|
608 } |
|
609 |
|
610 // Presence data |
|
611 if (dataType == CCmsContactFieldItem::ECmsPresenceData) |
|
612 {// Presence is one of the most complex data types and |
|
613 // not always working. TRAPping this is just a precaution |
|
614 // to ensure that other fields are updated correctly to |
|
615 // to the screen.. |
|
616 TRAP_IGNORE( ContactPresenceChangedL( aContactField )); |
|
617 } |
|
618 } |
|
619 |
|
620 // --------------------------------------------------------------------------- |
|
621 // CCCAppCommLauncherLPadModel::CheckPopupTextL |
|
622 // --------------------------------------------------------------------------- |
|
623 // |
|
624 void CCCAppCommLauncherLPadModel::CheckPopupTextL( |
|
625 const TInt aButtonIndex, |
|
626 const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aContactAction, |
|
627 const CCmsContactField& aContactField ) |
|
628 { |
|
629 CCA_DP( KCommLauncherLogFile, CCA_L("CCCAppCommLauncherLPadModel::CheckPopupTextL")); |
|
630 TCommLauncherButtonData& buttonData = iButtonDataArray[ aButtonIndex ]; |
|
631 |
|
632 if ( aContactAction == buttonData.iContactAction ) |
|
633 { |
|
634 CCA_DP( KCommLauncherLogFile, CCA_L("buttonData.iContactAction: %d"), buttonData.iContactAction); |
|
635 |
|
636 CCCAppCommLauncherContactHandler& contactHandler = |
|
637 iContainer.Plugin().ContactHandler();//not owned |
|
638 buttonData.iNumberOfAddresses = |
|
639 contactHandler.AddressAmount( buttonData.iContactAction ); |
|
640 |
|
641 CCA_DP( KCommLauncherLogFile, CCA_L("buttonData.iNumberOfAddresses: %d"), buttonData.iNumberOfAddresses); |
|
642 |
|
643 const CCmsContactFieldItem::TCmsDefaultAttributeTypes cmsDefault = |
|
644 contactHandler.MapContactorTypeToCMSDefaultType( buttonData.iContactAction ); |
|
645 |
|
646 |
|
647 if ( contactHandler.ContactFieldTypeAndContactActionMatch( |
|
648 aContactField.Type(), |
|
649 VPbkFieldTypeSelectorFactory::EFindOnMapSelector ) ) |
|
650 {// addresses case is handled here |
|
651 CheckAddressesPopupTextL( |
|
652 aButtonIndex, aContactAction, aContactField ); |
|
653 return; |
|
654 } |
|
655 |
|
656 // has default, multiple entries |
|
657 if ( aContactField.HasDefaultAttribute( cmsDefault ) && 1 < buttonData.iNumberOfAddresses ) |
|
658 {// has default, multiple entries |
|
659 CCA_DP( KCommLauncherLogFile, CCA_L("aContactField.HasDefaultAttribute(): true")); |
|
660 |
|
661 const CCmsContactFieldItem& item = aContactField.ItemL( cmsDefault );//not own |
|
662 buttonData.iPopupText.Zero(); |
|
663 buttonData.iFlags |= TCommLauncherButtonData::EDefaultSet; |
|
664 buttonData.iPopupText.Append(item.Data().Left( |
|
665 KCCAppCommLauncherMaxButtonDataTextLength )); |
|
666 |
|
667 SetTextClipDirection(aContactAction, aButtonIndex); |
|
668 } |
|
669 |
|
670 // no default, multiple entries |
|
671 else if ( 1 < buttonData.iNumberOfAddresses |
|
672 && !( buttonData.iFlags & TCommLauncherButtonData::EDefaultSet )) |
|
673 { |
|
674 CCA_DP( KCommLauncherLogFile, CCA_L("no default, multiple numbers")); |
|
675 |
|
676 buttonData.iPopupText.Zero(); |
|
677 if ( contactHandler.IsItNumberAddress( aContactAction )) |
|
678 { |
|
679 if ( aContactAction == VPbkFieldTypeSelectorFactory::EUniEditorSelector ) |
|
680 { |
|
681 // x numbers/addresses |
|
682 buttonData.iPopupText.Append(*StringLoader::LoadLC( |
|
683 R_QTN_CCA_MULTIPLE_NUMBERS_ADDRESSES, |
|
684 buttonData.iNumberOfAddresses, |
|
685 &iCoeEnv)); |
|
686 } |
|
687 else |
|
688 { |
|
689 // x numbers |
|
690 buttonData.iPopupText.Append(*StringLoader::LoadLC( |
|
691 R_QTN_CCA_MULTIPLE_NUMBERS, |
|
692 buttonData.iNumberOfAddresses, |
|
693 &iCoeEnv)); |
|
694 } |
|
695 } |
|
696 else if ( aContactAction == VPbkFieldTypeSelectorFactory::EInstantMessagingSelector ) |
|
697 { |
|
698 buttonData.iPopupText.Append(*StringLoader::LoadLC( |
|
699 R_QTN_CCA_MULTIPLE_ACCOUNTS, |
|
700 buttonData.iNumberOfAddresses, |
|
701 &iCoeEnv)); |
|
702 } |
|
703 else |
|
704 { |
|
705 buttonData.iPopupText.Append(*StringLoader::LoadLC( |
|
706 R_QTN_CCA_MULTIPLE_ADDRESSES, |
|
707 buttonData.iNumberOfAddresses, |
|
708 &iCoeEnv)); |
|
709 } |
|
710 CleanupStack::PopAndDestroy(); |
|
711 } |
|
712 |
|
713 // one entry |
|
714 else if ( 1 == buttonData.iNumberOfAddresses ) |
|
715 { |
|
716 CCA_DP( KCommLauncherLogFile, CCA_L("one address")); |
|
717 |
|
718 SetTextClipDirection(aContactAction, aButtonIndex); |
|
719 |
|
720 |
|
721 TInt index = 0; // by default select first |
|
722 if ( aContactAction == VPbkFieldTypeSelectorFactory::EInstantMessagingSelector ) |
|
723 { |
|
724 // in IM case IMPP field might contain voip and im service |
|
725 // fields. Need to filter out voip fields in case of IM |
|
726 // commmunication type |
|
727 index = SelectIMIndexL(aContactField); |
|
728 } |
|
729 |
|
730 if ( VPbkFieldTypeSelectorFactory::EVOIPCallSelector == aContactAction ) |
|
731 { |
|
732 index = SelectVOIPIndexL( aContactField ); |
|
733 } |
|
734 |
|
735 if ( aContactAction == VPbkFieldTypeSelectorFactory::EUniEditorSelector |
|
736 && buttonData.iPopupText.Length() > 0 |
|
737 && aContactField.Type() != CCmsContactFieldItem::ECmsMobilePhoneGeneric |
|
738 && aContactField.Type() != CCmsContactFieldItem::ECmsMobilePhoneHome |
|
739 && aContactField.Type() != CCmsContactFieldItem::ECmsMobilePhoneWork ) |
|
740 { |
|
741 // Already has a number |
|
742 } |
|
743 else |
|
744 { |
|
745 buttonData.iPopupText.Zero(); |
|
746 buttonData.iPopupText.Append( |
|
747 aContactField.ItemL( index ).Data().Left( |
|
748 KCCAppCommLauncherMaxButtonDataTextLength )); |
|
749 } |
|
750 } |
|
751 |
|
752 if( IsPhoneNumber( aContactField ) ) |
|
753 { |
|
754 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( buttonData.iPopupText ); |
|
755 } |
|
756 |
|
757 } |
|
758 } |
|
759 |
|
760 // --------------------------------------------------------------------------- |
|
761 // CCCAppCommLauncherLPadModel::IsPhoneNumber |
|
762 // --------------------------------------------------------------------------- |
|
763 // |
|
764 TBool CCCAppCommLauncherLPadModel::IsPhoneNumber( const CCmsContactField& aContactField ) |
|
765 { |
|
766 TBool isPhoneNumber = EFalse; |
|
767 |
|
768 switch( aContactField.Type() ) |
|
769 { |
|
770 case CCmsContactFieldItem::ECmsLandPhoneGeneric: |
|
771 case CCmsContactFieldItem::ECmsLandPhoneHome: |
|
772 case CCmsContactFieldItem::ECmsGroupVoice: |
|
773 case CCmsContactFieldItem::ECmsAssistantNumber: |
|
774 case CCmsContactFieldItem::ECmsDefaultTypePhoneNumber: |
|
775 case CCmsContactFieldItem::ECmsFaxNumberHome: |
|
776 case CCmsContactFieldItem::ECmsFaxNumberWork: |
|
777 case CCmsContactFieldItem::ECmsMobilePhoneGeneric: |
|
778 case CCmsContactFieldItem::ECmsMobilePhoneHome: |
|
779 case CCmsContactFieldItem::ECmsMobilePhoneWork: |
|
780 case CCmsContactFieldItem::ECmsVideoNumberGeneric: |
|
781 case CCmsContactFieldItem::ECmsVideoNumberHome: |
|
782 case CCmsContactFieldItem::ECmsVideoNumberWork: |
|
783 case CCmsContactFieldItem::ECmsVoipNumberGeneric: |
|
784 case CCmsContactFieldItem::ECmsVoipNumberHome: |
|
785 case CCmsContactFieldItem::ECmsVoipNumberWork: |
|
786 case CCmsContactFieldItem::ECmsCarPhone: |
|
787 case CCmsContactFieldItem::ECmsPagerNumber: |
|
788 isPhoneNumber = ETrue; |
|
789 break; |
|
790 default: |
|
791 isPhoneNumber = EFalse; |
|
792 break; |
|
793 } |
|
794 |
|
795 return isPhoneNumber; |
|
796 } |
|
797 |
|
798 // --------------------------------------------------------------------------- |
|
799 // CCCAppCommLauncherLPadModel::LoadIconArrayL |
|
800 // --------------------------------------------------------------------------- |
|
801 // |
|
802 void CCCAppCommLauncherLPadModel::LoadIconArrayL() |
|
803 { |
|
804 // todo; currently icons are just temporary/hardcoded, but they |
|
805 // could be loaded directly from resources (or dynamically based on |
|
806 // what icons are needed). |
|
807 |
|
808 // ECallIconIndex |
|
809 iButtonIconArray->AppendL( LoadIconLC( |
|
810 EMbmPhonebook2eceQgn_prop_pb_comm_call, |
|
811 EMbmPhonebook2eceQgn_prop_pb_comm_call_mask )); |
|
812 CleanupStack::Pop(); // icon |
|
813 |
|
814 // EMsgIconIndex |
|
815 iButtonIconArray->AppendL( LoadIconLC( |
|
816 EMbmPhonebook2eceQgn_prop_pb_comm_message, |
|
817 EMbmPhonebook2eceQgn_prop_pb_comm_message_mask )); |
|
818 CleanupStack::Pop(); // icon |
|
819 |
|
820 // EEmailIconIndex |
|
821 iButtonIconArray->AppendL( LoadIconLC( |
|
822 EMbmPhonebook2eceQgn_prop_pb_comm_email, |
|
823 EMbmPhonebook2eceQgn_prop_pb_comm_email_mask )); |
|
824 CleanupStack::Pop(); // icon |
|
825 |
|
826 // EVoipIconIndex |
|
827 iButtonIconArray->AppendL( LoadIconLC( |
|
828 EMbmPhonebook2eceQgn_prop_pb_comm_voip, |
|
829 EMbmPhonebook2eceQgn_prop_pb_comm_voip_mask )); |
|
830 CleanupStack::Pop(); // icon |
|
831 |
|
832 // EIMIconIndex |
|
833 iButtonIconArray->AppendL( LoadIconLC( |
|
834 EMbmPhonebook2eceQgn_prop_pb_comm_chat, |
|
835 EMbmPhonebook2eceQgn_prop_pb_comm_chat_mask )); |
|
836 CleanupStack::Pop(); // icon |
|
837 |
|
838 // EUrlIconIndex |
|
839 iButtonIconArray->AppendL( LoadIconLC( |
|
840 EMbmPhonebook2eceQgn_prop_pb_comm_url, |
|
841 EMbmPhonebook2eceQgn_prop_pb_comm_url_mask )); |
|
842 CleanupStack::Pop(); // icon |
|
843 |
|
844 // EVideocallIconIndex |
|
845 iButtonIconArray->AppendL( LoadIconLC( |
|
846 EMbmPhonebook2eceQgn_prop_pb_comm_vcall, |
|
847 EMbmPhonebook2eceQgn_prop_pb_comm_vcall_mask )); |
|
848 CleanupStack::Pop(); // icon |
|
849 |
|
850 // EAddressValIconIndex |
|
851 iButtonIconArray->AppendL( LoadIconLC( |
|
852 EMbmPhonebook2eceQgn_prop_pb_comm_valid_lm, |
|
853 EMbmPhonebook2eceQgn_prop_pb_comm_valid_lm_mask )); |
|
854 CleanupStack::Pop(); // icon |
|
855 |
|
856 // EAddressNotValIconIndex |
|
857 iButtonIconArray->AppendL( LoadIconLC( |
|
858 EMbmPhonebook2eceQgn_prop_pb_comm_no_valid_lm, |
|
859 EMbmPhonebook2eceQgn_prop_pb_comm_no_valid_lm_mask )); |
|
860 CleanupStack::Pop(); // icon |
|
861 |
|
862 // EMultiIconIndex |
|
863 iButtonIconArray->AppendL( LoadIconLC( |
|
864 EMbmPhonebook2eceQgn_indi_many_items_add, |
|
865 EMbmPhonebook2eceQgn_indi_many_items_add_mask )); |
|
866 CleanupStack::Pop(); // icon |
|
867 |
|
868 } |
|
869 |
|
870 // --------------------------------------------------------------------------- |
|
871 // CCCAppCommLauncherLPadModel::LoadIconLC |
|
872 // --------------------------------------------------------------------------- |
|
873 // |
|
874 CGulIcon* CCCAppCommLauncherLPadModel::LoadIconLC( TInt aBmpId, TInt aMaskId ) |
|
875 { |
|
876 CFbsBitmap* bmp = NULL; |
|
877 CFbsBitmap* mask = NULL; |
|
878 CGulIcon* icon = CGulIcon::NewLC(); |
|
879 |
|
880 // The color of Icon "many items" should be adjusted to the theme background |
|
881 if( EMbmPhonebook2eceQgn_indi_many_items_add == aBmpId) |
|
882 { |
|
883 TAknsItemID skin; |
|
884 skin.Set( EAknsMajorGeneric, EAknsMinorGenericQgnIndiManyItemsAdd ); |
|
885 TAknsItemID color; |
|
886 color.Set( EAknsMajorSkin, EAknsMinorQsnIconColors ); |
|
887 |
|
888 AknsUtils::CreateColorIconLC( |
|
889 AknsUtils::SkinInstance(),skin, |
|
890 color, EAknsCIQsnIconColorsCG13, |
|
891 bmp, mask, |
|
892 KPbk2ECEIconFileName, |
|
893 aBmpId, aMaskId, |
|
894 AKN_LAF_COLOR_STATIC( 215 ) ); |
|
895 } |
|
896 else |
|
897 { |
|
898 AknIconUtils::CreateIconLC( |
|
899 bmp, mask, KPbk2ECEIconFileName, aBmpId, aMaskId ); |
|
900 } |
|
901 |
|
902 icon->SetBitmap( bmp ); |
|
903 icon->SetMask( mask ); |
|
904 CleanupStack::Pop( 2 ); // bmp, mask |
|
905 |
|
906 return icon; |
|
907 } |
|
908 |
|
909 // --------------------------------------------------------------------------- |
|
910 // CCCAppCommLauncherLPadModel::IconArray |
|
911 // --------------------------------------------------------------------------- |
|
912 // |
|
913 CAknIconArray* CCCAppCommLauncherLPadModel::IconArray() |
|
914 { |
|
915 return iButtonIconArray; |
|
916 } |
|
917 |
|
918 // --------------------------------------------------------------------------- |
|
919 // CCCAppCommLauncherLPadModel::ButtonData |
|
920 // --------------------------------------------------------------------------- |
|
921 // |
|
922 TCommLauncherButtonData& CCCAppCommLauncherLPadModel::ButtonData( TInt aIndex ) |
|
923 { |
|
924 return iButtonDataArray[ aIndex ]; |
|
925 } |
|
926 |
|
927 // --------------------------------------------------------------------------- |
|
928 // CCCAppCommLauncherLPadModel::TextForPopUpL |
|
929 // --------------------------------------------------------------------------- |
|
930 // |
|
931 TPtrC CCCAppCommLauncherLPadModel::TextForPopUpL( TInt aButtonIndex ) |
|
932 { |
|
933 TPtr tempText = iTempText->Des(); |
|
934 tempText.Zero(); |
|
935 if ( iButtonDataArray[ aButtonIndex ].iContactAction |
|
936 == VPbkFieldTypeSelectorFactory::EFindOnMapSelector |
|
937 && iButtonDataArray[ aButtonIndex ].iNumberOfAddresses == 1 ) |
|
938 { |
|
939 return AddressTextForPopUpL(); |
|
940 } |
|
941 else |
|
942 { |
|
943 tempText.Append( iButtonDataArray[ aButtonIndex ].iPopupText ); |
|
944 } |
|
945 |
|
946 return *iTempText; |
|
947 } |
|
948 |
|
949 // --------------------------------------------------------------------------- |
|
950 // CCCAppCommLauncherLPadModel::Reset |
|
951 // --------------------------------------------------------------------------- |
|
952 // |
|
953 void CCCAppCommLauncherLPadModel::Reset() |
|
954 { |
|
955 iButtonDataArray.Reset(); |
|
956 iAddressFields.Close(); |
|
957 iButtonIconArray->ResetAndDestroy(); |
|
958 } |
|
959 |
|
960 // --------------------------------------------------------------------------- |
|
961 // CCCAppCommLauncherLPadModel::ContactPresenceChangedL |
|
962 // --------------------------------------------------------------------------- |
|
963 // |
|
964 void CCCAppCommLauncherLPadModel::ContactPresenceChangedL( |
|
965 const CCmsContactField& aContactField ) |
|
966 { |
|
967 const TInt count = aContactField.ItemCount(); |
|
968 for (TUint i=0; i < count; i++) |
|
969 { |
|
970 CCmsPresenceData& presData = ( CCmsPresenceData& )aContactField.ItemL( i ); |
|
971 presData.PreparePresenceDataL( iPresenceIconSize ); |
|
972 TUint32 serviceType = presData.ServiceType(); |
|
973 |
|
974 if ( serviceType == CCmsContactFieldItem::ECmsPresenceChatNotification ) |
|
975 { |
|
976 CFbsBitmap* mask = presData.Mask(); |
|
977 CFbsBitmap* bitmap = presData.Bitmap(); |
|
978 |
|
979 // Find the index for chat item |
|
980 TInt index = KErrNotFound; |
|
981 const TInt dataCount = iButtonDataArray.Count(); |
|
982 for ( TInt i = 0; i < dataCount; i++ ) |
|
983 { |
|
984 if ( iButtonDataArray[ i ].iContactAction |
|
985 == VPbkFieldTypeSelectorFactory::EInstantMessagingSelector ) |
|
986 { |
|
987 index = i; |
|
988 break; |
|
989 } |
|
990 } |
|
991 |
|
992 if ( index != KErrNotFound ) |
|
993 { |
|
994 TBool hasPresenceIcon = iButtonDataArray[ index ].iFlags & |
|
995 TCommLauncherButtonData::EHasPresenceIcon; |
|
996 |
|
997 if ( bitmap && ( NULL == bitmap->Handle() ) ) |
|
998 { |
|
999 if ( hasPresenceIcon ) |
|
1000 { |
|
1001 // Delete presence icon from icon array |
|
1002 iButtonDataArray[ index ].iFlags &= ~(TCommLauncherButtonData::EHasPresenceIcon); |
|
1003 iButtonIconArray->Delete( EPresenceIconIndex ); |
|
1004 } |
|
1005 } |
|
1006 else if ( bitmap ) |
|
1007 { |
|
1008 if ( hasPresenceIcon ) |
|
1009 { |
|
1010 // Update presence icon |
|
1011 iButtonIconArray->At( EPresenceIconIndex )->SetBitmap(bitmap); |
|
1012 iButtonIconArray->At( EPresenceIconIndex )->SetMask(mask); |
|
1013 } |
|
1014 else |
|
1015 { |
|
1016 // Append presence icon to icon array |
|
1017 CGulIcon* icon = CGulIcon::NewLC(); |
|
1018 icon->SetBitmap( bitmap ); |
|
1019 icon->SetMask( mask ); |
|
1020 iButtonIconArray->AppendL( icon ); |
|
1021 iButtonDataArray[ index ].iFlags |= TCommLauncherButtonData::EHasPresenceIcon; |
|
1022 CleanupStack::Pop(); // icon |
|
1023 } |
|
1024 } |
|
1025 } |
|
1026 } |
|
1027 else |
|
1028 { |
|
1029 delete presData.Bitmap(); |
|
1030 delete presData.Mask(); |
|
1031 } |
|
1032 } |
|
1033 } |
|
1034 |
|
1035 // --------------------------------------------------------------------------- |
|
1036 // CCCAppCommLauncherLPadModel::UpdateAddressesValidationL |
|
1037 // --------------------------------------------------------------------------- |
|
1038 // |
|
1039 void CCCAppCommLauncherLPadModel::UpdateAddressesValidationL( |
|
1040 const CCmsContactFieldInfo& aContactFieldInfo ) |
|
1041 { |
|
1042 TInt count = aContactFieldInfo.Fields().Count(); |
|
1043 if ( count ) |
|
1044 { |
|
1045 TBool generalAddress = EFalse; |
|
1046 TBool homeAddress = EFalse; |
|
1047 TBool workAddress = EFalse; |
|
1048 TBool generalGeo = EFalse; |
|
1049 TBool homeGeo = EFalse; |
|
1050 TBool workGeo = EFalse; |
|
1051 for ( TInt i = 0; i < count; i++ ) |
|
1052 { |
|
1053 switch ( aContactFieldInfo.Fields().operator []( i ) ) |
|
1054 { |
|
1055 case CCmsContactFieldItem::ECmsAddrPOGeneric: |
|
1056 case CCmsContactFieldItem::ECmsAddrExtGeneric: |
|
1057 case CCmsContactFieldItem::ECmsAddrStreetGeneric: |
|
1058 case CCmsContactFieldItem::ECmsAddrLocalGeneric: |
|
1059 case CCmsContactFieldItem::ECmsAddrRegionGeneric: |
|
1060 case CCmsContactFieldItem::ECmsAddrPostcodeGeneric: |
|
1061 case CCmsContactFieldItem::ECmsAddrCountryGeneric: |
|
1062 { |
|
1063 generalAddress = ETrue; |
|
1064 break; |
|
1065 } |
|
1066 case CCmsContactFieldItem::ECmsAddrPOHome: |
|
1067 case CCmsContactFieldItem::ECmsAddrExtHome: |
|
1068 case CCmsContactFieldItem::ECmsAddrStreetHome: |
|
1069 case CCmsContactFieldItem::ECmsAddrLocalHome: |
|
1070 case CCmsContactFieldItem::ECmsAddrRegionHome: |
|
1071 case CCmsContactFieldItem::ECmsAddrPostcodeHome: |
|
1072 case CCmsContactFieldItem::ECmsAddrCountryHome: |
|
1073 { |
|
1074 homeAddress = ETrue; |
|
1075 break; |
|
1076 } |
|
1077 case CCmsContactFieldItem::ECmsAddrPOWork: |
|
1078 case CCmsContactFieldItem::ECmsAddrExtWork: |
|
1079 case CCmsContactFieldItem::ECmsAddrStreetWork: |
|
1080 case CCmsContactFieldItem::ECmsAddrLocalWork: |
|
1081 case CCmsContactFieldItem::ECmsAddrRegionWork: |
|
1082 case CCmsContactFieldItem::ECmsAddrPostcodeWork: |
|
1083 case CCmsContactFieldItem::ECmsAddrCountryWork: |
|
1084 { |
|
1085 workAddress = ETrue; |
|
1086 break; |
|
1087 } |
|
1088 case CCmsContactFieldItem::ECmsAddrGeoGeneric: |
|
1089 { |
|
1090 generalGeo = ETrue; |
|
1091 break; |
|
1092 } |
|
1093 case CCmsContactFieldItem::ECmsAddrGeoHome: |
|
1094 { |
|
1095 homeGeo = ETrue; |
|
1096 break; |
|
1097 } |
|
1098 case CCmsContactFieldItem::ECmsAddrGeoWork: |
|
1099 { |
|
1100 workGeo = ETrue; |
|
1101 break; |
|
1102 } |
|
1103 default: |
|
1104 { |
|
1105 // do nothing |
|
1106 break; |
|
1107 } |
|
1108 } |
|
1109 } |
|
1110 if ( ( generalAddress && !generalGeo ) |
|
1111 || ( homeAddress && !homeGeo ) |
|
1112 || ( workAddress && !workGeo ) ) |
|
1113 { |
|
1114 iAddressesValidated = EFalse; |
|
1115 } |
|
1116 else |
|
1117 { |
|
1118 iAddressesValidated = ETrue; |
|
1119 } |
|
1120 } |
|
1121 } |
|
1122 |
|
1123 // --------------------------------------------------------------------------- |
|
1124 // CCCAppCommLauncherLPadModel::CheckAddressesPopupTextL |
|
1125 // --------------------------------------------------------------------------- |
|
1126 // |
|
1127 void CCCAppCommLauncherLPadModel::CheckAddressesPopupTextL( |
|
1128 const TInt aButtonIndex, |
|
1129 const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector |
|
1130 aContactAction, |
|
1131 const CCmsContactField& aContactField ) |
|
1132 { |
|
1133 CCA_DP( KCommLauncherLogFile, CCA_L( |
|
1134 "CCCAppCommLauncherLPadModel::CheckAddressesPopupTextL" ) ); |
|
1135 TCommLauncherButtonData& buttonData = iButtonDataArray[ aButtonIndex ]; |
|
1136 |
|
1137 if ( aContactAction == buttonData.iContactAction ) |
|
1138 { |
|
1139 CCCAppCommLauncherContactHandler& contactHandler = |
|
1140 iContainer.Plugin().ContactHandler();//not owned |
|
1141 buttonData.iNumberOfAddresses = |
|
1142 contactHandler.AddressAmount( buttonData.iContactAction ); |
|
1143 |
|
1144 if ( contactHandler.ContactFieldTypeAndContactActionMatch( |
|
1145 aContactField.Type(), |
|
1146 VPbkFieldTypeSelectorFactory::EFindOnMapSelector ) ) |
|
1147 { |
|
1148 if ( buttonData.iNumberOfAddresses == 1 ) |
|
1149 {// one address case handled here |
|
1150 TInt index = 0; // by default select first |
|
1151 |
|
1152 switch ( aContactField.Type() ) |
|
1153 { |
|
1154 case CCmsContactFieldItem::ECmsAddrPOGeneric: |
|
1155 case CCmsContactFieldItem::ECmsAddrPOHome: |
|
1156 case CCmsContactFieldItem::ECmsAddrPOWork: |
|
1157 { |
|
1158 iAddressFields.InsertL( EAddressPO, |
|
1159 aContactField.ItemL( index ).Data().Left( |
|
1160 KCCAppCommLauncherMaxButtonDataTextLength ) ); |
|
1161 break; |
|
1162 } |
|
1163 case CCmsContactFieldItem::ECmsAddrExtGeneric: |
|
1164 case CCmsContactFieldItem::ECmsAddrExtHome: |
|
1165 case CCmsContactFieldItem::ECmsAddrExtWork: |
|
1166 { |
|
1167 iAddressFields.InsertL( EAddressExt, |
|
1168 aContactField.ItemL( index ).Data().Left( |
|
1169 KCCAppCommLauncherMaxButtonDataTextLength ) ); |
|
1170 break; |
|
1171 } |
|
1172 case CCmsContactFieldItem::ECmsAddrStreetGeneric: |
|
1173 case CCmsContactFieldItem::ECmsAddrStreetHome: |
|
1174 case CCmsContactFieldItem::ECmsAddrStreetWork: |
|
1175 { |
|
1176 iAddressFields.InsertL( EAddressStreet, |
|
1177 aContactField.ItemL( index ).Data().Left( |
|
1178 KCCAppCommLauncherMaxButtonDataTextLength ) ); |
|
1179 break; |
|
1180 } |
|
1181 case CCmsContactFieldItem::ECmsAddrLocalGeneric: |
|
1182 case CCmsContactFieldItem::ECmsAddrLocalHome: |
|
1183 case CCmsContactFieldItem::ECmsAddrLocalWork: |
|
1184 { |
|
1185 iAddressFields.InsertL( EAddressLocal, |
|
1186 aContactField.ItemL( index ).Data().Left( |
|
1187 KCCAppCommLauncherMaxButtonDataTextLength ) ); |
|
1188 break; |
|
1189 } |
|
1190 case CCmsContactFieldItem::ECmsAddrRegionGeneric: |
|
1191 case CCmsContactFieldItem::ECmsAddrRegionHome: |
|
1192 case CCmsContactFieldItem::ECmsAddrRegionWork: |
|
1193 { |
|
1194 iAddressFields.InsertL( EAddressRegion, |
|
1195 aContactField.ItemL( index ).Data().Left( |
|
1196 KCCAppCommLauncherMaxButtonDataTextLength ) ); |
|
1197 break; |
|
1198 } |
|
1199 case CCmsContactFieldItem::ECmsAddrPostcodeGeneric: |
|
1200 case CCmsContactFieldItem::ECmsAddrPostcodeHome: |
|
1201 case CCmsContactFieldItem::ECmsAddrPostcodeWork: |
|
1202 { |
|
1203 iAddressFields.InsertL( EAddressPostcode, |
|
1204 aContactField.ItemL( index ).Data().Left( |
|
1205 KCCAppCommLauncherMaxButtonDataTextLength ) ); |
|
1206 break; |
|
1207 } |
|
1208 case CCmsContactFieldItem::ECmsAddrCountryGeneric: |
|
1209 case CCmsContactFieldItem::ECmsAddrCountryHome: |
|
1210 case CCmsContactFieldItem::ECmsAddrCountryWork: |
|
1211 { |
|
1212 iAddressFields.InsertL( EAddressCountry, |
|
1213 aContactField.ItemL( index ).Data().Left( |
|
1214 KCCAppCommLauncherMaxButtonDataTextLength ) ); |
|
1215 break; |
|
1216 } |
|
1217 default: |
|
1218 { |
|
1219 // nothing to do |
|
1220 return; |
|
1221 } |
|
1222 } |
|
1223 } |
|
1224 else |
|
1225 {// multiple addresses case handled here |
|
1226 buttonData.iPopupText.Zero(); |
|
1227 buttonData.iPopupText.Append(*StringLoader::LoadLC( |
|
1228 R_QTN_CCA_MULTIPLE_ADDRESSES, |
|
1229 buttonData.iNumberOfAddresses)); |
|
1230 CleanupStack::PopAndDestroy(); |
|
1231 } |
|
1232 } |
|
1233 } |
|
1234 } |
|
1235 |
|
1236 // --------------------------------------------------------------------------- |
|
1237 // CCCAppCommLauncherLPadModel::AddressTextForPopUpL |
|
1238 // --------------------------------------------------------------------------- |
|
1239 // |
|
1240 TPtrC CCCAppCommLauncherLPadModel::AddressTextForPopUpL() |
|
1241 { |
|
1242 const TInt KGranularity = 4; |
|
1243 CDesCArrayFlat* fields = new ( ELeave ) CDesCArrayFlat( KGranularity ); |
|
1244 CleanupStack::PushL( fields ); |
|
1245 |
|
1246 TPtr tempText = iTempText->Des(); |
|
1247 tempText.Zero(); |
|
1248 |
|
1249 HBufC* formattedText = NULL; |
|
1250 TBool street = EFalse; |
|
1251 TBool local = EFalse; |
|
1252 TBool region = EFalse; |
|
1253 TBool country = EFalse; |
|
1254 |
|
1255 TPtrC* text = iAddressFields.Find( EAddressStreet ); |
|
1256 if ( text ) |
|
1257 { |
|
1258 fields->AppendL( *text ); |
|
1259 street = ETrue; |
|
1260 } |
|
1261 text = iAddressFields.Find( EAddressLocal ); |
|
1262 if ( text ) |
|
1263 { |
|
1264 fields->AppendL( *text ); |
|
1265 local = ETrue; |
|
1266 } |
|
1267 |
|
1268 text = iAddressFields.Find( EAddressCountry ); |
|
1269 if( text ) |
|
1270 { |
|
1271 fields->AppendL( *text ); |
|
1272 country = ETrue; |
|
1273 } |
|
1274 else |
|
1275 { |
|
1276 country = EFalse; |
|
1277 fields->AppendL(KNullDesC16); |
|
1278 } |
|
1279 |
|
1280 text = iAddressFields.Find( EAddressRegion ); |
|
1281 if ( text ) |
|
1282 { |
|
1283 fields->AppendL( *text ); |
|
1284 region = ETrue; |
|
1285 } |
|
1286 else |
|
1287 { |
|
1288 region = EFalse; |
|
1289 fields->AppendL(KNullDesC16); |
|
1290 } |
|
1291 |
|
1292 |
|
1293 if ( street && local) |
|
1294 { |
|
1295 formattedText = StringLoader::LoadLC( |
|
1296 R_QTN_PHOB_COMMLAUNCHER_ONELINEPREVIEW, *fields ); |
|
1297 } |
|
1298 else if( street && country ) |
|
1299 { |
|
1300 formattedText = StringLoader::LoadLC( |
|
1301 R_QTN_PHOB_COMMLAUNCHER_ONELINEPREVIEW, *fields ); |
|
1302 } |
|
1303 else if( region || country ) |
|
1304 { |
|
1305 formattedText = StringLoader::LoadLC( |
|
1306 R_QTN_PHOB_COMMLAUNCHER_ONELINEPREVIEW, *fields ); |
|
1307 } |
|
1308 else |
|
1309 { |
|
1310 formattedText = KNullDesC16().AllocLC(); |
|
1311 } |
|
1312 |
|
1313 tempText.Append( *formattedText ); |
|
1314 CleanupStack::PopAndDestroy( formattedText ); |
|
1315 CleanupStack::PopAndDestroy( fields ); |
|
1316 |
|
1317 return *iTempText; |
|
1318 } |
|
1319 |
|
1320 // --------------------------------------------------------------------------- |
|
1321 // CCCAppCommLauncherLPadModel::LoadVoipButtonInfoL |
|
1322 // --------------------------------------------------------------------------- |
|
1323 // |
|
1324 TInt CCCAppCommLauncherLPadModel::LoadVoipButtonInfoL() |
|
1325 { |
|
1326 TInt returnVal (0); |
|
1327 TServiceId serviceId; //Stores the last found Service Id of VOIP Service |
|
1328 TInt availableVoipServices = GetSupportedVOIPServicesL( serviceId ); |
|
1329 |
|
1330 if ( KOneVOIPServiceAvailable == availableVoipServices ) |
|
1331 { |
|
1332 HBufC* serviceName = NULL; |
|
1333 CFbsBitmap* bitmap(NULL); |
|
1334 CFbsBitmap* mask(NULL); |
|
1335 //Now we have only 1 service which supports VOIP |
|
1336 //hence load the VOIP Button Icon & corresponding label |
|
1337 LoadVoipButtonInfoFromPbkL( serviceId, bitmap, mask, serviceName ); |
|
1338 |
|
1339 CleanupStack::PushL( serviceName ); |
|
1340 |
|
1341 //Replace the default icons with the branded icon |
|
1342 if ( bitmap || mask ) |
|
1343 { |
|
1344 TInt iconInd = MapCommMethodToIcon( |
|
1345 VPbkFieldTypeSelectorFactory::EVOIPCallSelector ); |
|
1346 //we have found the branded icon for voip button |
|
1347 iButtonIconArray->At(iconInd)->SetBitmap(bitmap); |
|
1348 iButtonIconArray->At(iconInd)->SetMask(mask); |
|
1349 |
|
1350 returnVal |= KVOIPButtonImageSet; |
|
1351 } |
|
1352 |
|
1353 //Replace the default button text with the branded servicename |
|
1354 for ( TInt i = 0; i < iButtonDataArray.Count() && serviceName ; i++ ) |
|
1355 { |
|
1356 TCommLauncherButtonData& buttonData ( iButtonDataArray[i] ); |
|
1357 |
|
1358 if ( VPbkFieldTypeSelectorFactory::EVOIPCallSelector == |
|
1359 iButtonDataArray[i].iContactAction ) |
|
1360 { |
|
1361 HBufC* str = StringLoader::LoadLC( R_QTN_CCA_VOIP_CALL_WITH_SERVICENAME, |
|
1362 *serviceName, |
|
1363 &iCoeEnv ); |
|
1364 |
|
1365 buttonData.iText.Copy( str->Left( KCCAppCommLauncherMaxButtonDataTextLength ) ); |
|
1366 CleanupStack::PopAndDestroy(); //str |
|
1367 //Button Text has been set |
|
1368 returnVal |= KVOIPButtonTextSet; |
|
1369 break; |
|
1370 } |
|
1371 } |
|
1372 |
|
1373 CleanupStack::PopAndDestroy(); //serviceName |
|
1374 } |
|
1375 |
|
1376 return returnVal; |
|
1377 } |
|
1378 |
|
1379 |
|
1380 // --------------------------------------------------------------------------- |
|
1381 // CCCAppCommLauncherLPadModel::GetSupportedVOIPServicesL |
|
1382 // --------------------------------------------------------------------------- |
|
1383 // |
|
1384 TInt CCCAppCommLauncherLPadModel::GetSupportedVOIPServicesL( TServiceId& aServiceId ) |
|
1385 { |
|
1386 //Find all services which are voip enabled |
|
1387 TInt availableVoipService (0); |
|
1388 RIdArray idArray; |
|
1389 CleanupClosePushL(idArray); |
|
1390 |
|
1391 User::LeaveIfError( iSettings->FindServiceIdsL(idArray) ); |
|
1392 |
|
1393 for (TInt i = 0; i < idArray.Count(); ++i) |
|
1394 { |
|
1395 TBool supported( EFalse ); |
|
1396 CSPEntry* entry = CSPEntry::NewLC(); |
|
1397 TServiceId id = idArray[i]; |
|
1398 User::LeaveIfError( iSettings->FindEntryL(id, *entry) ); |
|
1399 const CSPProperty* property = NULL; |
|
1400 |
|
1401 if (entry->GetProperty(property, EPropertyServiceAttributeMask) == KErrNone) |
|
1402 { |
|
1403 TInt value = 0; |
|
1404 property->GetValue(value); |
|
1405 supported = value & ESupportsInternetCall; |
|
1406 } |
|
1407 |
|
1408 if ( supported ) |
|
1409 { |
|
1410 availableVoipService++; |
|
1411 aServiceId = id; |
|
1412 } |
|
1413 CleanupStack::PopAndDestroy(); // entry |
|
1414 } |
|
1415 CleanupStack::PopAndDestroy(); //idArray |
|
1416 |
|
1417 return availableVoipService; |
|
1418 } |
|
1419 |
|
1420 // --------------------------------------------------------------------------- |
|
1421 // CCCAppCommLauncherLPadModel::LoadVoipButtonInfoFromPbkL |
|
1422 // --------------------------------------------------------------------------- |
|
1423 // |
|
1424 void CCCAppCommLauncherLPadModel::LoadVoipButtonInfoFromPbkL( |
|
1425 TServiceId aServiceId, |
|
1426 CFbsBitmap*& aBitmap, CFbsBitmap*& aMask, HBufC*& aLocalisedServiceName ) |
|
1427 { |
|
1428 // get the XSP ServiceName |
|
1429 // CPbk2ServiceManager stores all the brandinfo |
|
1430 // related to the services configured to the phone |
|
1431 // use this to show uniform icon & name throughout PhoneBook |
|
1432 CPbk2ApplicationServices& appServices = iPbkCmd->ApplicationServices(); |
|
1433 CPbk2ServiceManager& servMan = appServices.ServiceManager(); |
|
1434 const CPbk2ServiceManager::RServicesArray& services = servMan.Services(); |
|
1435 for ( TInt i = 0; i < services.Count(); i++ ) |
|
1436 { |
|
1437 const CPbk2ServiceManager::TService& service = services[i]; |
|
1438 //Found the appropriate service info |
|
1439 if ( service.iServiceId == aServiceId ) |
|
1440 { |
|
1441 TRect mainPane; |
|
1442 AknLayoutUtils::LayoutMetricsRect( |
|
1443 AknLayoutUtils::EMainPane, mainPane ); |
|
1444 TAknLayoutRect listLayoutRect; |
|
1445 listLayoutRect.LayoutRect( |
|
1446 mainPane, |
|
1447 AknLayoutScalable_Avkon::list_single_graphic_pane_g1(0).LayoutLine() ); |
|
1448 |
|
1449 TSize size(listLayoutRect.Rect().Size()); |
|
1450 |
|
1451 // Set service bitmap size |
|
1452 AknIconUtils::SetSize( service.iBitmap, iServiceIconSize ); |
|
1453 AknIconUtils::SetSize( service.iMask, iServiceIconSize ); |
|
1454 |
|
1455 // Trickiest Bitmap cloning |
|
1456 // No direct way of cloning a bitmap |
|
1457 aBitmap = CloneBitmapLC( iServiceIconSize, service.iBitmap ); |
|
1458 aMask = CloneBitmapLC( iServiceIconSize, service.iMask ); |
|
1459 |
|
1460 // Set preferred size for xsp service icons |
|
1461 AknIconUtils::SetSize( service.iBitmap, size ); |
|
1462 AknIconUtils::SetSize( service.iMask, size ); |
|
1463 |
|
1464 aLocalisedServiceName = service.iDisplayName.AllocL(); |
|
1465 |
|
1466 CleanupStack::Pop( 2 ); //aBitmap, aMask |
|
1467 break; |
|
1468 } |
|
1469 } |
|
1470 } |
|
1471 |
|
1472 // --------------------------------------------------------------------------- |
|
1473 // CCCAppCommLauncherLPadModel::CalculateLayoutSize() |
|
1474 // --------------------------------------------------------------------------- |
|
1475 // |
|
1476 void CCCAppCommLauncherLPadModel::CalculateLayoutSize() |
|
1477 { |
|
1478 /* Calculate the layout size for Voip service icon and presence icon. |
|
1479 * Since the layoutRect is relative to the layoutRect of its parent, so |
|
1480 * we calculate from the topmost-mainPane, then follow below sequence: |
|
1481 * phob2_contact_card_pane |
|
1482 * phob2_cc_listscroll_pane |
|
1483 * phob2_cc_list_pane |
|
1484 * list_double_large_graphic_phob2_cc_pane |
|
1485 * list_double_large_graphic_phob2_cc_pane_g1 |
|
1486 */ |
|
1487 TRect mainPane = iPlugin.ClientRect(); |
|
1488 |
|
1489 TAknLayoutRect listLayoutRect0; |
|
1490 listLayoutRect0.LayoutRect( |
|
1491 mainPane, |
|
1492 AknLayoutScalable_Apps::phob2_contact_card_pane(0).LayoutLine() ); |
|
1493 |
|
1494 TAknLayoutRect listLayoutRect1; |
|
1495 listLayoutRect1.LayoutRect( |
|
1496 listLayoutRect0.Rect(), |
|
1497 AknLayoutScalable_Apps::phob2_cc_listscroll_pane(0).LayoutLine() ); |
|
1498 |
|
1499 TAknLayoutRect listLayoutRect2; |
|
1500 listLayoutRect2.LayoutRect( |
|
1501 listLayoutRect1.Rect(), |
|
1502 AknLayoutScalable_Apps::phob2_cc_list_pane(0).LayoutLine() ); |
|
1503 |
|
1504 TAknLayoutRect listLayoutRect3; |
|
1505 listLayoutRect3.LayoutRect( |
|
1506 listLayoutRect2.Rect(), |
|
1507 AknLayoutScalable_Apps::list_double_large_graphic_phob2_cc_pane(0).LayoutLine() ); |
|
1508 |
|
1509 TAknLayoutRect listLayoutRect4; |
|
1510 listLayoutRect4.LayoutRect( |
|
1511 listLayoutRect3.Rect(), |
|
1512 AknLayoutScalable_Apps::list_double_large_graphic_phob2_cc_pane_g1(0).LayoutLine() ); |
|
1513 |
|
1514 TAknLayoutRect listLayoutRect5; |
|
1515 listLayoutRect5.LayoutRect( |
|
1516 listLayoutRect3.Rect(), |
|
1517 AknLayoutScalable_Apps::list_double_large_graphic_phob2_cc_pane_g2(0).LayoutLine() ); |
|
1518 |
|
1519 // Size for service icon |
|
1520 iServiceIconSize = listLayoutRect4.Rect().Size(); |
|
1521 |
|
1522 // Size for presence icon |
|
1523 iPresenceIconSize = listLayoutRect5.Rect().Size(); |
|
1524 } |
|
1525 // --------------------------------------------------------------------------- |
|
1526 // CCCAppCommLauncherLPadModel::HandleNotifyChange |
|
1527 // --------------------------------------------------------------------------- |
|
1528 // |
|
1529 // from MSPNotifyChangeObserver |
|
1530 void CCCAppCommLauncherLPadModel::HandleNotifyChange( TUint /*aServiceId*/ ) |
|
1531 { |
|
1532 TRAP_IGNORE ( DoHandleNotifyChangeL() ); |
|
1533 } |
|
1534 |
|
1535 // --------------------------------------------------------------------------- |
|
1536 // CCCAppCommLauncherLPadModel::DoHandleNotifyChangeL |
|
1537 // --------------------------------------------------------------------------- |
|
1538 // |
|
1539 void CCCAppCommLauncherLPadModel::DoHandleNotifyChangeL() |
|
1540 { |
|
1541 TInt buttonInfoSet = LoadVoipButtonInfoL(); |
|
1542 |
|
1543 if (!( buttonInfoSet && KVOIPButtonImageSet )) |
|
1544 { |
|
1545 //VOIP Button Image has not been set |
|
1546 //reason could be Branding ServerIssue or something else |
|
1547 //replace with default icon if this is the case |
|
1548 TInt iconInd = MapCommMethodToIcon( |
|
1549 VPbkFieldTypeSelectorFactory::EVOIPCallSelector ); |
|
1550 CGulIcon* icon = LoadIconLC( |
|
1551 EMbmPhonebook2eceQgn_prop_nrtyp_voip, |
|
1552 EMbmPhonebook2eceQgn_prop_nrtyp_voip_mask ); |
|
1553 |
|
1554 icon->SetBitmapsOwnedExternally( ETrue ); |
|
1555 |
|
1556 iButtonIconArray->At(iconInd)->SetBitmap(icon->Bitmap()); |
|
1557 iButtonIconArray->At(iconInd)->SetMask(icon->Mask()); |
|
1558 |
|
1559 CleanupStack::PopAndDestroy( icon ); |
|
1560 } |
|
1561 |
|
1562 if (!( buttonInfoSet && KVOIPButtonTextSet )) |
|
1563 { |
|
1564 //VOIP Button Text has not been set |
|
1565 //reason could be Branding ServerIssue or something else |
|
1566 //replace with default Text if this is the case |
|
1567 |
|
1568 //Replace the default button text with the branded servicename |
|
1569 for ( TInt i = 0; i < iButtonDataArray.Count(); i++ ) |
|
1570 { |
|
1571 TCommLauncherButtonData& buttonData ( iButtonDataArray[i] ); |
|
1572 |
|
1573 if ( VPbkFieldTypeSelectorFactory::EVOIPCallSelector == |
|
1574 iButtonDataArray[i].iContactAction ) |
|
1575 { |
|
1576 HBufC* str = StringLoader::LoadLC( R_QTN_CCA_VOIP_CALL, |
|
1577 &iCoeEnv ); |
|
1578 |
|
1579 buttonData.iText.Copy( str->Left( KCCAppCommLauncherMaxButtonDataTextLength ) ); |
|
1580 CleanupStack::PopAndDestroy(); //str |
|
1581 break; |
|
1582 } |
|
1583 } |
|
1584 } |
|
1585 |
|
1586 iContainer.DrawDeferred(); |
|
1587 } |
|
1588 |
|
1589 |
|
1590 // --------------------------------------------------------------------------- |
|
1591 // CCCAppCommLauncherLPadModel::HandleError |
|
1592 // --------------------------------------------------------------------------- |
|
1593 // |
|
1594 // from MSPNotifyChangeObserver |
|
1595 void CCCAppCommLauncherLPadModel::HandleError( TInt /*aError*/ ) |
|
1596 { |
|
1597 } |
|
1598 |
|
1599 // --------------------------------------------------------------------------- |
|
1600 // CCCAppCommLauncherLPadModel::IfShowMultiIcon |
|
1601 // --------------------------------------------------------------------------- |
|
1602 // |
|
1603 TBool CCCAppCommLauncherLPadModel::IfShowMultiIcon(TInt aButtonIndex) const |
|
1604 { |
|
1605 TBool result = EFalse; |
|
1606 if ( iButtonDataArray[ aButtonIndex ].iNumberOfAddresses > 1 ) |
|
1607 { |
|
1608 result = ETrue; |
|
1609 } |
|
1610 return result; |
|
1611 } |
|
1612 |
|
1613 |
|
1614 // ---------------------------------------------------------- |
|
1615 // CCCAppCommLauncherLPadModel::SetTextClipDirection |
|
1616 // |
|
1617 // ---------------------------------------------------------- |
|
1618 // |
|
1619 void CCCAppCommLauncherLPadModel::SetTextClipDirection( VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aContactAction, |
|
1620 TInt aButtonIndex |
|
1621 /*CCmsContactFieldItem::TCmsContactField aCmsFieldType*/ ) |
|
1622 { |
|
1623 TCommLauncherButtonData& buttonData = iButtonDataArray[ aButtonIndex ]; |
|
1624 |
|
1625 // Phone number, email address, and sip address, clip from begining |
|
1626 if ( VPbkFieldTypeSelectorFactory::EVoiceCallSelector == aContactAction |
|
1627 || VPbkFieldTypeSelectorFactory::EUniEditorSelector == aContactAction |
|
1628 || VPbkFieldTypeSelectorFactory::EVOIPCallSelector == aContactAction |
|
1629 || VPbkFieldTypeSelectorFactory::EVideoCallSelector == aContactAction |
|
1630 || VPbkFieldTypeSelectorFactory::EEmailEditorSelector == aContactAction |
|
1631 || VPbkFieldTypeSelectorFactory::EInstantMessagingSelector == aContactAction ) |
|
1632 { |
|
1633 buttonData.iClipFromBegining = ETrue; |
|
1634 } |
|
1635 else |
|
1636 { |
|
1637 buttonData.iClipFromBegining = EFalse; |
|
1638 } |
|
1639 } |
|
1640 |
|
1641 // ---------------------------------------------------------- |
|
1642 // CCCAppCommLauncherLPadModel::ClipFromBeginning |
|
1643 // |
|
1644 // ---------------------------------------------------------- |
|
1645 // |
|
1646 TBool CCCAppCommLauncherLPadModel::ClipFromBeginning( |
|
1647 TDes& aBuffer, |
|
1648 TInt aItemIndex, |
|
1649 TInt aSubCellNumber) const |
|
1650 { |
|
1651 CAknDoubleLargeStyleListBox* listbox = |
|
1652 static_cast<CAknDoubleLargeStyleListBox*>(&iListBox); |
|
1653 TBool result = EFalse; |
|
1654 if ( IfShowMultiIcon( aItemIndex ) ) |
|
1655 { |
|
1656 TRect mainPane = iPlugin.ClientRect(); |
|
1657 TAknLayoutRect listLayoutRect; |
|
1658 listLayoutRect.LayoutRect( |
|
1659 mainPane, |
|
1660 AknLayoutScalable_Apps::list_double_large_graphic_phob2_cc_pane_g3(0).LayoutLine() ); |
|
1661 TInt multiIconWidth(listLayoutRect.Rect().Width()); |
|
1662 const TInt KCalculationErrors = 1; |
|
1663 CFormattedCellListBoxData *data = listbox->ItemDrawer()->FormattedCellData(); |
|
1664 const CFont *font = data->Font(listbox->ItemDrawer()->Properties(aItemIndex), aSubCellNumber); |
|
1665 TSize cellsize = data->SubCellSize(aSubCellNumber); |
|
1666 TMargins margin = data->SubCellMargins(aSubCellNumber); |
|
1667 TInt width = cellsize.iWidth - margin.iLeft - margin.iRight - |
|
1668 multiIconWidth - KAknBidiExtraSpacePerLine - KCalculationErrors; |
|
1669 TInt clipgap = data->SubCellTextClipGap(aSubCellNumber); |
|
1670 result = AknTextUtils::ClipToFit( |
|
1671 aBuffer, *font, width, AknTextUtils::EClipFromBeginning, width + clipgap); |
|
1672 } |
|
1673 else |
|
1674 { |
|
1675 result = AknTextUtils::ClipToFit( |
|
1676 aBuffer, |
|
1677 AknTextUtils::EClipFromBeginning, |
|
1678 listbox, |
|
1679 aItemIndex, |
|
1680 aSubCellNumber); |
|
1681 } |
|
1682 return result; |
|
1683 } |
|
1684 |
|
1685 // ---------------------------------------------------------- |
|
1686 // CCCAppCommLauncherLPadModel::ResourceChangedL |
|
1687 // |
|
1688 // ---------------------------------------------------------- |
|
1689 void CCCAppCommLauncherLPadModel::ResourceChangedL() |
|
1690 { |
|
1691 // When layout variant changed, calculate the layout size which will be |
|
1692 // used in listbox, eg: the size for service icon and presence icon |
|
1693 CalculateLayoutSize(); |
|
1694 |
|
1695 LoadVoipButtonInfoL(); |
|
1696 } |
|
1697 |
|
1698 // End of File |