|
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: Implementation of commlauncher plugin control container |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "ccappcommlauncherheaders.h" |
|
21 #include "spbcontentprovider.h" |
|
22 #include "ccappcommlaunchercustomlistbox.h" |
|
23 #include <Pbk2PresentationUtils.h> |
|
24 #include <cpbk2applicationservices.h> |
|
25 #include <cvpbkcontactmanager.h> |
|
26 #include <utf.h> |
|
27 #include <gulicon.h> |
|
28 #include "ccaextensionfactory.h" |
|
29 #include "ccaextensionfactory.hrh" |
|
30 #include <phonebook2ece.mbg> |
|
31 #include <aknlayoutscalable_avkon.cdl.h> |
|
32 #include <AknsUtils.h> |
|
33 #include <MVPbkContactStoreProperties.h> |
|
34 #include <VPbkContactStoreUris.h> |
|
35 #include <TVPbkContactStoreUriPtr.h> |
|
36 #include <MVPbkContactStore.h> |
|
37 #include "ccafactoryextensionnotifier.h" |
|
38 #include <featmgr.h> |
|
39 |
|
40 |
|
41 const TInt KSocialPhonebookDisabled = 2; |
|
42 const TInt KSocialPhonebookEnabled = 3; |
|
43 const TText KReplacedChars = ' '; |
|
44 |
|
45 _LIT( KCcaIconDefaultFileName, "\\resource\\apps\\phonebook2ece.mif" ); |
|
46 |
|
47 // =========================== MEMBER FUNCTIONS =============================== |
|
48 |
|
49 // ---------------------------------------------------------------------------- |
|
50 // CCCAppCommLauncherContainer::CCCAppCommLauncherContainer() |
|
51 // ---------------------------------------------------------------------------- |
|
52 // |
|
53 CCCAppCommLauncherContainer::CCCAppCommLauncherContainer( |
|
54 CCCAppCommLauncherPlugin& aPlugin) |
|
55 : iPlugin (aPlugin) |
|
56 { |
|
57 } |
|
58 |
|
59 // ---------------------------------------------------------------------------- |
|
60 // CCCAppCommLauncherContainer::~CCCAppCommLauncherContainer() |
|
61 // ---------------------------------------------------------------------------- |
|
62 // |
|
63 CCCAppCommLauncherContainer::~CCCAppCommLauncherContainer() |
|
64 { |
|
65 delete iListBox; |
|
66 delete iBackground; |
|
67 delete iModel; |
|
68 delete iHeaderCtrl; |
|
69 delete iPbkCmd; |
|
70 delete iStatusControl; |
|
71 delete iProvider; |
|
72 Release( iAppServices ); |
|
73 delete iViewLauncher; |
|
74 delete iLongTapDetector; |
|
75 delete iFactoryExtensionNotifier; |
|
76 } |
|
77 |
|
78 // ---------------------------------------------------------------------------- |
|
79 // CCCAppCommLauncherContainer::ConstructL() |
|
80 // ---------------------------------------------------------------------------- |
|
81 // |
|
82 void CCCAppCommLauncherContainer::ConstructL() |
|
83 { |
|
84 // Create the listbox |
|
85 CreateListboxControlL(); |
|
86 // Create the header |
|
87 iHeaderCtrl = CCCAppCommLauncherHeaderControl::NewL( iPlugin ); |
|
88 iHeaderCtrl->SetContainerWindowL(*this); |
|
89 |
|
90 FeatureManager::InitializeLibL(); |
|
91 if( FeatureManager::FeatureSupported( KFeatureIdFfContactsSocial ) ) |
|
92 { |
|
93 MVPbkContactLink* link = NULL; |
|
94 MVPbkContactLinkArray* contactArray = NULL; |
|
95 TInt isSame = KErrNotFound; |
|
96 |
|
97 iAppServices = CPbk2ApplicationServices::InstanceL(); |
|
98 iProvider = CSpbContentProvider::NewL( iAppServices->ContactManager(), |
|
99 iAppServices->StoreManager(), |
|
100 CSpbContentProvider::EStatusMessage | CSpbContentProvider::EServiceIcon ); |
|
101 |
|
102 HBufC& contactData = iPlugin.AppEngine()->Parameter().ContactDataL(); |
|
103 HBufC8* contactData8 = HBufC8::NewLC( contactData.Size() ); |
|
104 TPtr8 contactData8Ptr( contactData8->Des() ); |
|
105 contactData8Ptr.Copy( contactData.Des() ); |
|
106 |
|
107 CVPbkContactManager* vPbkContactManager = &iAppServices->ContactManager(); |
|
108 |
|
109 if( vPbkContactManager ) |
|
110 { |
|
111 contactArray = vPbkContactManager->CreateLinksLC( contactData8Ptr ); |
|
112 |
|
113 if( contactArray->Count() > 0 ) |
|
114 { |
|
115 link = contactArray->At( 0 ).CloneLC(); |
|
116 } |
|
117 |
|
118 const MVPbkContactStoreProperties& storeProperties = link->ContactStore().StoreProperties(); |
|
119 TVPbkContactStoreUriPtr uri = storeProperties.Uri(); |
|
120 |
|
121 isSame = uri.Compare( VPbkContactStoreUris::DefaultCntDbUri(), |
|
122 TVPbkContactStoreUriPtr::EContactStoreUriAllComponents ); |
|
123 } |
|
124 |
|
125 if( isSame == 0 ) |
|
126 { |
|
127 iStatusControl = CCCAppStatusControl::NewL( *iProvider, *this ); |
|
128 iStatusControl->SetContainerWindowL( *this ); |
|
129 iStatusControl->MakeVisible( EFalse ); |
|
130 |
|
131 CFbsBitmap* bmp = NULL; |
|
132 CFbsBitmap* bmpMask = NULL; |
|
133 |
|
134 AknIconUtils::CreateIconL( |
|
135 bmp, |
|
136 bmpMask, |
|
137 KCcaIconDefaultFileName, |
|
138 EMbmPhonebook2eceQgn_prop_wml_bm_ovi, |
|
139 EMbmPhonebook2eceQgn_prop_wml_bm_ovi_mask ); |
|
140 |
|
141 CGulIcon* guiIcon = CGulIcon::NewL( bmp, bmpMask ); |
|
142 iStatusControl->SetDefaultStatusL( R_QTN_CCA_DEFAULT_STATUS, guiIcon ); |
|
143 iStatusControl->SetContactLinkL( *link ); |
|
144 |
|
145 iFactoryExtensionNotifier = CCCaFactoryExtensionNotifier::NewL(); |
|
146 TCallBack callBack( CCCAppCommLauncherContainer::CheckExtensionFactoryL, this ); |
|
147 iFactoryExtensionNotifier->ObserveExtensionFactory( callBack ); |
|
148 } |
|
149 |
|
150 if( link ) |
|
151 { |
|
152 CleanupStack::PopAndDestroy(); //link |
|
153 } |
|
154 |
|
155 if( contactArray ) |
|
156 { |
|
157 CleanupStack::PopAndDestroy(); // contactArray |
|
158 } |
|
159 |
|
160 CleanupStack::PopAndDestroy(); // contactData8 |
|
161 } // KFeatureIdFfContactsSocial |
|
162 FeatureManager::UnInitializeLib(); |
|
163 |
|
164 // Get the skin background for the view |
|
165 iBackground = CAknsBasicBackgroundControlContext::NewL( |
|
166 KAknsIIDQsnBgAreaMain, TRect(0, 0, 0, 0), EFalse); |
|
167 LongTapDetectorL(); |
|
168 } |
|
169 |
|
170 // ---------------------------------------------------------------------------- |
|
171 // CCCAppCommLauncherContainer::CreateListboxControlL() |
|
172 // ---------------------------------------------------------------------------- |
|
173 // |
|
174 void CCCAppCommLauncherContainer::CreateListboxControlL() |
|
175 { |
|
176 // Will use customed list box later |
|
177 // iListBox = CCCAppCommLauncherCustomListBox::NewL(); |
|
178 iListBox = new (ELeave) CAknDoubleLargeStyleListBox(); |
|
179 iListBox->ConstructL(this, EAknListBoxLoopScrolling); |
|
180 iListBox->SetContainerWindowL(*this); |
|
181 iListBox->CreateScrollBarFrameL(ETrue); |
|
182 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
183 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); |
|
184 // Set empty text |
|
185 iListBox->View()->SetListEmptyTextL(KNullDesC()); |
|
186 |
|
187 // Creating the model |
|
188 iModel = CCCAppCommLauncherLPadModel::NewL(*this, *iListBox, iPlugin); |
|
189 iListBox->Model()->SetItemTextArray(iModel); |
|
190 iListBox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); |
|
191 iListBox->ItemDrawer()->ColumnData()->SetIconArray(iModel->IconArray()); |
|
192 |
|
193 //Set listbox observer |
|
194 iListBox->SetListBoxObserver(this); |
|
195 iListBox->ActivateL(); |
|
196 } |
|
197 |
|
198 // ---------------------------------------------------------------------------- |
|
199 // CCCAppCommLauncherContainer::Draw() |
|
200 // ---------------------------------------------------------------------------- |
|
201 // |
|
202 void CCCAppCommLauncherContainer::Draw(const TRect& /*aRect*/) const |
|
203 { |
|
204 // Draw the background using skin |
|
205 if (iBackground) |
|
206 { |
|
207 AknsDrawUtils::Background( |
|
208 AknsUtils::SkinInstance(), iBackground, this, SystemGc(), Rect()); |
|
209 } |
|
210 } |
|
211 |
|
212 // ---------------------------------------------------------------------------- |
|
213 // CCCAppCommLauncherContainer::SizeChanged() |
|
214 // ---------------------------------------------------------------------------- |
|
215 // |
|
216 void CCCAppCommLauncherContainer::SizeChanged() |
|
217 { |
|
218 const TRect drawRect(Rect()); |
|
219 const TBool isLandscape(Layout_Meta_Data::IsLandscapeOrientation()); |
|
220 |
|
221 // Header, Status and Listbox |
|
222 TAknLayoutRect headerRect; |
|
223 headerRect.LayoutRect(drawRect, AknLayoutScalable_Apps::cl_header_pane(isLandscape)); |
|
224 iHeaderCtrl->SetRect(headerRect.Rect()); |
|
225 |
|
226 AknLayoutUtils::LayoutControl( |
|
227 iListBox, drawRect, AknLayoutScalable_Apps::cl_listscroll_pane(isLandscape)); |
|
228 |
|
229 TRect listRect = iListBox->Rect(); |
|
230 |
|
231 if (!isLandscape) |
|
232 { |
|
233 listRect.iTl.iX = drawRect.iTl.iX; |
|
234 listRect.iBr.iX = drawRect.iBr.iX; |
|
235 } |
|
236 |
|
237 if( iStatusControl && iStatusControl->IsVisible() ) |
|
238 { |
|
239 // status control (similar to list_double2_graphic_pane) |
|
240 TAknLayoutRect statusLayout; |
|
241 statusLayout.LayoutRect( listRect, |
|
242 AknLayoutScalable_Avkon::list_double2_graphic_pane( 0 ) ); |
|
243 TRect statusRect( statusLayout.Rect() ); |
|
244 |
|
245 // list gives space for status control (top of list) |
|
246 listRect.Move( 0, statusRect.Height() ); |
|
247 listRect.Resize( 0, -statusRect.Height() ); |
|
248 |
|
249 // status control |
|
250 statusRect.Shrink( 10, 5 ); |
|
251 iStatusControl->SetRect( statusRect ); |
|
252 } |
|
253 |
|
254 iListBox->SetRect( listRect ); |
|
255 |
|
256 // Background skin |
|
257 if (iBackground) |
|
258 { |
|
259 iBackground->SetRect(drawRect); |
|
260 } |
|
261 |
|
262 DrawNow(); |
|
263 } |
|
264 |
|
265 // ---------------------------------------------------------------------------- |
|
266 // CCCAppCommLauncherContainer::CountComponentControls() |
|
267 // ---------------------------------------------------------------------------- |
|
268 // |
|
269 TInt CCCAppCommLauncherContainer::CountComponentControls() const |
|
270 { |
|
271 if( iStatusControl ) |
|
272 { |
|
273 return KSocialPhonebookEnabled; |
|
274 } |
|
275 else |
|
276 { |
|
277 return KSocialPhonebookDisabled; |
|
278 } |
|
279 } |
|
280 |
|
281 // ---------------------------------------------------------------------------- |
|
282 // CCCAppCommLauncherContainer::ComponentControl() |
|
283 // ---------------------------------------------------------------------------- |
|
284 // |
|
285 CCoeControl* CCCAppCommLauncherContainer::ComponentControl(TInt aIndex) const |
|
286 { |
|
287 switch (aIndex) |
|
288 { |
|
289 case 0: |
|
290 return iHeaderCtrl; |
|
291 case 1: |
|
292 if( iStatusControl ) |
|
293 { |
|
294 return iStatusControl; |
|
295 } |
|
296 else |
|
297 { |
|
298 return iListBox; |
|
299 } |
|
300 case 2: |
|
301 if( iStatusControl ) |
|
302 { |
|
303 return iListBox; |
|
304 } |
|
305 else |
|
306 { |
|
307 return NULL; |
|
308 } |
|
309 default: |
|
310 return NULL; |
|
311 } |
|
312 } |
|
313 |
|
314 // ---------------------------------------------------------------------------- |
|
315 // CCCAppCommLauncherContainer::OfferKeyEventL() |
|
316 // ---------------------------------------------------------------------------- |
|
317 // |
|
318 TKeyResponse CCCAppCommLauncherContainer::OfferKeyEventL( |
|
319 const TKeyEvent& aKeyEvent, TEventCode aType) |
|
320 { |
|
321 // Forward the key-event 1st to base-class |
|
322 TKeyResponse returnValue = |
|
323 CCCAppViewPluginAknContainer::OfferKeyEventL(aKeyEvent, aType); |
|
324 |
|
325 // Offer event to header control. |
|
326 if (EEventKey == aType |
|
327 && EKeyWasNotConsumed == returnValue) |
|
328 { |
|
329 returnValue = iHeaderCtrl->OfferKeyEventL(aKeyEvent, aType); |
|
330 } |
|
331 |
|
332 /* Uncomment this code if it is necessary to enable navigation hardware keys |
|
333 * on devices which have these keys (its Map Extension feature) |
|
334 if( aKeyEvent.iScanCode == EStdKeyApplicationD && aType == EEventKeyUp ) |
|
335 { |
|
336 DoShowMapCmdL( (TPbk2CommandId)EPbk2ExtensionAssignFromMap ); |
|
337 returnValue = EKeyWasConsumed; |
|
338 } |
|
339 |
|
340 if( aKeyEvent.iScanCode == EStdKeyApplicationE && aType == EEventKeyUp ) |
|
341 { |
|
342 DoShowMapCmdL( (TPbk2CommandId)EPbk2ExtensionShowOnMap ); |
|
343 returnValue = EKeyWasConsumed; |
|
344 }*/ |
|
345 |
|
346 if (EEventKey == aType |
|
347 && EKeyWasNotConsumed == returnValue) |
|
348 { |
|
349 // Make send key work as the select key for the list |
|
350 TKeyEvent keyToList = aKeyEvent; |
|
351 if (EKeyYes == aKeyEvent.iCode && IsFocused()) |
|
352 { |
|
353 keyToList.iCode = EKeyEnter; |
|
354 } |
|
355 returnValue = iListBox->OfferKeyEventL(keyToList, aType); |
|
356 // Update popup when moving up or down in the list |
|
357 switch(aKeyEvent.iCode) |
|
358 { |
|
359 case EKeyUpArrow: |
|
360 case EKeyDownArrow: |
|
361 returnValue = EKeyWasConsumed; |
|
362 break; |
|
363 } |
|
364 } |
|
365 |
|
366 return returnValue; |
|
367 } |
|
368 |
|
369 // ---------------------------------------------------------------------------- |
|
370 // CCCAppCommLauncherContainer::MopSupplyObject() |
|
371 // ---------------------------------------------------------------------------- |
|
372 // |
|
373 TTypeUid::Ptr CCCAppCommLauncherContainer::MopSupplyObject(TTypeUid aId) |
|
374 { |
|
375 // For skinning |
|
376 if (iBackground && aId.iUid == MAknsControlContext::ETypeId) |
|
377 { |
|
378 return MAknsControlContext::SupplyMopObject(aId, iBackground); |
|
379 } |
|
380 |
|
381 return CCoeControl::MopSupplyObject(aId); |
|
382 } |
|
383 |
|
384 // ---------------------------------------------------------------------------- |
|
385 // CCCAppCommLauncherContainer::FocusChanged() |
|
386 // ---------------------------------------------------------------------------- |
|
387 // |
|
388 void CCCAppCommLauncherContainer::FocusChanged(TDrawNow aDrawNow) |
|
389 { |
|
390 // For enabling animated hilight (if in skin supports it) |
|
391 CCoeControl::FocusChanged(aDrawNow); |
|
392 if(iListBox) |
|
393 { |
|
394 iListBox->SetFocus(IsFocused(), aDrawNow); |
|
395 } |
|
396 } |
|
397 |
|
398 // ---------------------------------------------------------------------------- |
|
399 // CCCAppCommLauncherContainer::HandlePointerEventL() |
|
400 // ---------------------------------------------------------------------------- |
|
401 // |
|
402 void CCCAppCommLauncherContainer::HandlePointerEventL( |
|
403 const TPointerEvent& aPointerEvent) |
|
404 { |
|
405 TInt index; |
|
406 if ( iListBox->View()->XYPosToItemIndex( aPointerEvent.iPosition, index ) ) |
|
407 { |
|
408 if ( iLongTapDetector ) |
|
409 { |
|
410 iLongTapDetector->PointerEventL( aPointerEvent ); |
|
411 } |
|
412 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
413 { |
|
414 // Pressed Down Effect |
|
415 iListBox->View()->ItemDrawer()->SetFlags( |
|
416 CListItemDrawer::EPressedDownState ); |
|
417 } |
|
418 } |
|
419 |
|
420 CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
421 } |
|
422 |
|
423 // ---------------------------------------------------------------------------- |
|
424 // CCCAppCommLauncherContainer::HandleLongTapEventL() |
|
425 // ---------------------------------------------------------------------------- |
|
426 // |
|
427 void CCCAppCommLauncherContainer::HandleLongTapEventL( const TPoint& aPenEventLocation, |
|
428 const TPoint& aPenEventScreenLocation ) |
|
429 { |
|
430 CCAContactorService* contactorService = iPlugin.ContactorService(); |
|
431 |
|
432 if ( contactorService && contactorService->IsBusy() ) |
|
433 { |
|
434 return; |
|
435 } |
|
436 else if ( CommMethodsAvailable() ) |
|
437 { |
|
438 TPtrC fullName; |
|
439 iPlugin.ContactHandler().ContactFieldItemDataL( |
|
440 CCmsContactFieldItem::ECmsFullName, fullName ); |
|
441 |
|
442 TUint paramFlag = 0;//CCAContactorService::TCSParameter::EEnableDefaults; |
|
443 CCAContactorService::TCSParameter param( |
|
444 iPlugin.Container().SelectedCommunicationMethod(), |
|
445 *iPlugin.ContactHandler().ContactIdentifierLC(),//contactlinkarray |
|
446 paramFlag, |
|
447 fullName ); |
|
448 contactorService->ExecuteServiceL( param ); |
|
449 |
|
450 CleanupStack::PopAndDestroy( 1 );// contactlinkarray |
|
451 } |
|
452 } |
|
453 |
|
454 // ---------------------------------------------------------------------------- |
|
455 // CCCAppCommLauncherContainer::HandleListBoxEventL() |
|
456 // ---------------------------------------------------------------------------- |
|
457 // |
|
458 void CCCAppCommLauncherContainer::HandleListBoxEventL( |
|
459 CEikListBox* /*aListBox*/, TListBoxEvent aEventType) |
|
460 { |
|
461 // Handle pointer events |
|
462 TBool executeContactAction = EFalse; |
|
463 |
|
464 if (aEventType == EEventItemDraggingActioned) |
|
465 { |
|
466 iHasBeenDragged = ETrue; |
|
467 } |
|
468 else if (aEventType == EEventItemSingleClicked) |
|
469 { |
|
470 if (!iHasBeenDragged) |
|
471 { |
|
472 executeContactAction = ETrue; |
|
473 } |
|
474 else |
|
475 { |
|
476 iHasBeenDragged = EFalse; |
|
477 } |
|
478 } |
|
479 else if (aEventType == EEventEnterKeyPressed) |
|
480 { |
|
481 executeContactAction = ETrue; |
|
482 iHasBeenDragged = EFalse; |
|
483 } |
|
484 |
|
485 CCAContactorService* contactorService = iPlugin.ContactorService(); |
|
486 |
|
487 if ( executeContactAction && contactorService && contactorService->IsBusy()) |
|
488 { |
|
489 executeContactAction = EFalse; |
|
490 } |
|
491 |
|
492 if (executeContactAction) |
|
493 { |
|
494 if ( iPlugin.Container().SelectedCommunicationMethod() |
|
495 == VPbkFieldTypeSelectorFactory::EFindOnMapSelector ) |
|
496 { |
|
497 DoShowMapCmdL( (TPbk2CommandId)EPbk2ExtensionShowOnMap ); |
|
498 } |
|
499 else |
|
500 { |
|
501 if(contactorService) |
|
502 { |
|
503 TPtrC fullName; |
|
504 |
|
505 iPlugin.ContactHandler().ContactFieldItemDataL( |
|
506 CCmsContactFieldItem::ECmsFullName, fullName); |
|
507 |
|
508 TUint paramFlag = CCAContactorService::TCSParameter::EEnableDefaults; |
|
509 |
|
510 CCAContactorService::TCSParameter param( |
|
511 iPlugin.Container().SelectedCommunicationMethod(), |
|
512 *iPlugin.ContactHandler().ContactIdentifierLC(),//contactlinkarray |
|
513 paramFlag, |
|
514 fullName); |
|
515 |
|
516 contactorService->ExecuteServiceL(param); |
|
517 |
|
518 CleanupStack::PopAndDestroy(1);// contactlinkarray |
|
519 } |
|
520 } |
|
521 } |
|
522 } |
|
523 |
|
524 // ---------------------------------------------------------------------------- |
|
525 // CCCAppCommLauncherContainer::ContactInfoFetchedNotifyL() |
|
526 // ---------------------------------------------------------------------------- |
|
527 // |
|
528 void CCCAppCommLauncherContainer::ContactInfoFetchedNotifyL( |
|
529 const CCmsContactFieldInfo& aContactFieldInfo) |
|
530 { |
|
531 // update buttons |
|
532 iModel->UpdateAddressesValidationL( aContactFieldInfo ); |
|
533 iModel->FillButtonArrayL(); |
|
534 iListBox->HandleItemAdditionL(); |
|
535 iHeaderCtrl->ContactInfoFetchedNotifyL(aContactFieldInfo); |
|
536 |
|
537 if (!CommMethodsAvailable()) |
|
538 { |
|
539 // update the empty string now to avoid flickering |
|
540 HBufC* string = StringLoader::LoadLC( |
|
541 R_QTN_CCA_NO_COMMUNICATION_METHODS, iCoeEnv); |
|
542 iListBox->View()->SetListEmptyTextL(*string); |
|
543 CleanupStack::PopAndDestroy(string); |
|
544 } |
|
545 } |
|
546 |
|
547 // ---------------------------------------------------------------------------- |
|
548 // CCCAppCommLauncherContainer::ContactFieldFetchedNotifyL() |
|
549 // ---------------------------------------------------------------------------- |
|
550 // |
|
551 void CCCAppCommLauncherContainer::ContactFieldFetchedNotifyL( |
|
552 const CCmsContactField& aContactField) |
|
553 { |
|
554 // Forwarding to header-part |
|
555 iHeaderCtrl->ContactFieldFetchedNotifyL(aContactField); |
|
556 // Forwarding to listbox-model |
|
557 iModel->ContactFieldFetchedNotifyL(aContactField); |
|
558 } |
|
559 |
|
560 // ---------------------------------------------------------------------------- |
|
561 // CCCAppCommLauncherContainer::ContactFieldFetchedNotifyL() |
|
562 // ---------------------------------------------------------------------------- |
|
563 // |
|
564 void CCCAppCommLauncherContainer::ContactFieldFetchingCompletedL() |
|
565 { |
|
566 //PERFORMANCE LOGGING: 12. Plugin ready |
|
567 WriteToPerfLog(); |
|
568 iHeaderCtrl->ContactFieldFetchingCompletedL(); |
|
569 |
|
570 iHeaderCtrl->SetContactStoreL(iPlugin.ContactHandler().ContactStore()); |
|
571 |
|
572 //Reset focused row in listbox if items removed/added. |
|
573 TInt mdlCount = iModel->MdcaCount(); |
|
574 if (iMdlRowCount != mdlCount) |
|
575 { |
|
576 iListBox->SetCurrentItemIndexAndDraw(0); |
|
577 } |
|
578 iListBox->DrawDeferred(); |
|
579 |
|
580 iMdlRowCount = mdlCount; |
|
581 } |
|
582 |
|
583 // --------------------------------------------------------------------------- |
|
584 // CCCAppCommLauncherContainer::Plugin |
|
585 // --------------------------------------------------------------------------- |
|
586 // |
|
587 CCCAppCommLauncherPlugin& CCCAppCommLauncherContainer::Plugin() |
|
588 { |
|
589 CCA_DP(KCommLauncherLogFile, CCA_L("CCCAppCommLauncherContainer::Plugin()")); |
|
590 return iPlugin; |
|
591 } |
|
592 |
|
593 // --------------------------------------------------------------------------- |
|
594 // CCCAppCommLauncherContainer::CommMethodsAvailable |
|
595 // --------------------------------------------------------------------------- |
|
596 // |
|
597 TBool CCCAppCommLauncherContainer::CommMethodsAvailable() |
|
598 { |
|
599 return (KErrNotFound == iListBox->CurrentItemIndex()) |
|
600 ? EFalse : ETrue; |
|
601 } |
|
602 |
|
603 // --------------------------------------------------------------------------- |
|
604 // CCCAppCommLauncherContainer::SelectedCommunicationMethod |
|
605 // --------------------------------------------------------------------------- |
|
606 // |
|
607 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector |
|
608 CCCAppCommLauncherContainer::SelectedCommunicationMethod() |
|
609 { |
|
610 return iModel->ButtonData(iListBox->CurrentItemIndex()).iContactAction; |
|
611 } |
|
612 |
|
613 // --------------------------------------------------------------------------- |
|
614 // CCCAppCommLauncherContainer::ContactsChangedL |
|
615 // --------------------------------------------------------------------------- |
|
616 // |
|
617 void CCCAppCommLauncherContainer::ContactsChangedL() |
|
618 { |
|
619 iModel->Reset(); |
|
620 iListBox->HandleItemRemovalL(); |
|
621 iHeaderCtrl->ClearL(); |
|
622 } |
|
623 |
|
624 // --------------------------------------------------------------------------- |
|
625 // CCCAppCommLauncherContainer::ContactPresenceChangedL |
|
626 // --------------------------------------------------------------------------- |
|
627 // |
|
628 void CCCAppCommLauncherContainer::ContactPresenceChangedL( |
|
629 const CCmsContactField& aContactField) |
|
630 { |
|
631 iModel->ContactPresenceChangedL(aContactField); |
|
632 DrawDeferred(); |
|
633 } |
|
634 |
|
635 // --------------------------------------------------------------------------- |
|
636 // CCCAppCommLauncherContainer::MapCommMethodToClipDirection |
|
637 // --------------------------------------------------------------------------- |
|
638 // |
|
639 AknTextUtils::TClipDirection CCCAppCommLauncherContainer::MapCommMethodToClipDirection( |
|
640 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aContactAction) |
|
641 { |
|
642 switch (aContactAction) |
|
643 { |
|
644 case VPbkFieldTypeSelectorFactory::EEmailEditorSelector: |
|
645 case VPbkFieldTypeSelectorFactory::EInstantMessagingSelector: |
|
646 case VPbkFieldTypeSelectorFactory::EVOIPCallSelector: |
|
647 case VPbkFieldTypeSelectorFactory::EVideoCallSelector: |
|
648 case VPbkFieldTypeSelectorFactory::EVoiceCallSelector: |
|
649 case VPbkFieldTypeSelectorFactory::EUniEditorSelector: |
|
650 return AknTextUtils::EClipFromBeginning; |
|
651 case VPbkFieldTypeSelectorFactory::EURLSelector: |
|
652 return AknTextUtils::EClipFromEnd; |
|
653 default: |
|
654 return AknTextUtils::EClipFromEnd; |
|
655 } |
|
656 } |
|
657 |
|
658 // ---------------------------------------------------------------------------- |
|
659 // CCCAppCommLauncherContainer::GetHelpContext() |
|
660 // ---------------------------------------------------------------------------- |
|
661 // |
|
662 void CCCAppCommLauncherContainer::GetHelpContext(TCoeHelpContext& aContext) const |
|
663 { |
|
664 aContext.iMajor.iUid = KPbk2UID3; |
|
665 aContext.iContext = KHLP_CCA_LAUNCHER; |
|
666 } |
|
667 |
|
668 // --------------------------------------------------------------------------- |
|
669 // CCCAppCommLauncherContainer::DoShowMapCmdL |
|
670 // --------------------------------------------------------------------------- |
|
671 // |
|
672 void CCCAppCommLauncherContainer::DoShowMapCmdL( TPbk2CommandId aCommandId ) |
|
673 { |
|
674 if( !iPbkCmd ) |
|
675 { |
|
676 iPbkCmd = CCCAppCommLauncherPbkCmd::NewL( iPlugin ); |
|
677 } |
|
678 |
|
679 iPbkCmd->ExecutePbk2CmdShowMapL( |
|
680 iPlugin.ContactHandler().ContactIdentifierLC(), aCommandId ); |
|
681 |
|
682 CleanupStack::PopAndDestroy( 1 ); // ContactIdentifierLC |
|
683 } |
|
684 |
|
685 // -------------------------------------------------------------------------- |
|
686 // CCCAppCommLauncherContainer::LongTapDetectorL |
|
687 // -------------------------------------------------------------------------- |
|
688 // |
|
689 CAknLongTapDetector& CCCAppCommLauncherContainer::LongTapDetectorL() |
|
690 { |
|
691 if ( !iLongTapDetector ) |
|
692 { |
|
693 iLongTapDetector = CAknLongTapDetector::NewL( this ); |
|
694 } |
|
695 return *iLongTapDetector; |
|
696 } |
|
697 |
|
698 |
|
699 //----------------------------------------------------------------------------- |
|
700 // CCCAppCommLauncherContainer::StatusClicked() |
|
701 //----------------------------------------------------------------------------- |
|
702 // |
|
703 void CCCAppCommLauncherContainer::StatusClickedL() |
|
704 { |
|
705 if ( iViewLauncher ) |
|
706 { |
|
707 HBufC& contactData = iPlugin.AppEngine()->Parameter().ContactDataL(); |
|
708 HBufC8* contactData8 = HBufC8::NewLC( contactData.Size() ); |
|
709 TPtr8 contactData8Ptr( contactData8->Des() ); |
|
710 contactData8Ptr.Copy( contactData.Des() ); |
|
711 iViewLauncher->LaunchViewL( MCCAViewLauncher::ECCAView, &contactData8Ptr ); |
|
712 CleanupStack::PopAndDestroy( contactData8 ); |
|
713 } |
|
714 } |
|
715 |
|
716 //----------------------------------------------------------------------------- |
|
717 // CCCAppCommLauncherContainer::CheckExtensionFactoryL() |
|
718 //----------------------------------------------------------------------------- |
|
719 // |
|
720 TInt CCCAppCommLauncherContainer::CheckExtensionFactoryL(TAny* aPtr) |
|
721 { |
|
722 CCCAppCommLauncherContainer* self = static_cast<CCCAppCommLauncherContainer*>( aPtr ); |
|
723 self->DoCheckExtensionFactoryL(); |
|
724 return 0; |
|
725 } |
|
726 |
|
727 //----------------------------------------------------------------------------- |
|
728 // CCCAppCommLauncherContainer::DoCheckExtensionFactoryL() |
|
729 //----------------------------------------------------------------------------- |
|
730 // |
|
731 void CCCAppCommLauncherContainer::DoCheckExtensionFactoryL() |
|
732 { |
|
733 CCCAExtensionFactory* extension = iFactoryExtensionNotifier->ExtensionFactory(); |
|
734 // if extension is not null, extensionfactory plugins are available -> |
|
735 // show statuscontrol |
|
736 if( extension ) |
|
737 { |
|
738 if ( !iViewLauncher ) |
|
739 { |
|
740 iViewLauncher = extension->CreateViewLauncherL(); |
|
741 } |
|
742 iStatusControl->MakeVisible( ETrue ); |
|
743 } |
|
744 else |
|
745 { |
|
746 delete iViewLauncher; |
|
747 iViewLauncher = NULL; |
|
748 iStatusControl->MakeVisible( EFalse ); |
|
749 } |
|
750 |
|
751 } |
|
752 |
|
753 // End of File |