19 // INCLUDE FILES |
19 // INCLUDE FILES |
20 #include "ccappcommlauncherheaders.h" |
20 #include "ccappcommlauncherheaders.h" |
21 #include "spbcontentprovider.h" |
21 #include "spbcontentprovider.h" |
22 #include "ccappcommlaunchercustomlistbox.h" |
22 #include "ccappcommlaunchercustomlistbox.h" |
23 #include <Pbk2PresentationUtils.h> |
23 #include <Pbk2PresentationUtils.h> |
24 #include <cpbk2applicationservices.h> |
24 #include <CPbk2ApplicationServices.h> |
25 #include <cvpbkcontactmanager.h> |
25 #include <CVPbkContactManager.h> |
26 #include <utf.h> |
26 #include <utf.h> |
27 #include <gulicon.h> |
27 #include <gulicon.h> |
28 #include "ccaextensionfactory.h" |
28 #include "ccaextensionfactory.h" |
29 #include "ccaextensionfactory.hrh" |
29 #include "ccaextensionfactory.hrh" |
30 #include <phonebook2ece.mbg> |
30 #include <phonebook2ece.mbg> |
35 #include <TVPbkContactStoreUriPtr.h> |
35 #include <TVPbkContactStoreUriPtr.h> |
36 #include <MVPbkContactStore.h> |
36 #include <MVPbkContactStore.h> |
37 #include "ccafactoryextensionnotifier.h" |
37 #include "ccafactoryextensionnotifier.h" |
38 #include <featmgr.h> |
38 #include <featmgr.h> |
39 |
39 |
40 |
40 namespace { |
41 const TInt KSocialPhonebookDisabled = 2; |
41 const TInt KSocialPhonebookDisabled = 2; |
42 const TInt KSocialPhonebookEnabled = 3; |
42 const TInt KSocialPhonebookEnabled = 3; |
43 const TText KReplacedChars = ' '; |
|
44 |
|
45 _LIT( KCcaIconDefaultFileName, "\\resource\\apps\\phonebook2ece.mif" ); |
43 _LIT( KCcaIconDefaultFileName, "\\resource\\apps\\phonebook2ece.mif" ); |
|
44 } |
46 |
45 |
47 // =========================== MEMBER FUNCTIONS =============================== |
46 // =========================== MEMBER FUNCTIONS =============================== |
48 |
47 |
49 // ---------------------------------------------------------------------------- |
48 // ---------------------------------------------------------------------------- |
50 // CCCAppCommLauncherContainer::CCCAppCommLauncherContainer() |
49 // CCCAppCommLauncherContainer::CCCAppCommLauncherContainer() |
113 if( contactArray->Count() > 0 ) |
112 if( contactArray->Count() > 0 ) |
114 { |
113 { |
115 link = contactArray->At( 0 ).CloneLC(); |
114 link = contactArray->At( 0 ).CloneLC(); |
116 } |
115 } |
117 |
116 |
118 const MVPbkContactStoreProperties& storeProperties = link->ContactStore().StoreProperties(); |
117 if ( link ) |
119 TVPbkContactStoreUriPtr uri = storeProperties.Uri(); |
118 { |
|
119 const MVPbkContactStoreProperties& storeProperties = link->ContactStore().StoreProperties(); |
|
120 TVPbkContactStoreUriPtr uri = storeProperties.Uri(); |
120 |
121 |
121 isSame = uri.Compare( VPbkContactStoreUris::DefaultCntDbUri(), |
122 isSame = uri.Compare( VPbkContactStoreUris::DefaultCntDbUri(), |
122 TVPbkContactStoreUriPtr::EContactStoreUriAllComponents ); |
123 TVPbkContactStoreUriPtr::EContactStoreUriAllComponents ); |
|
124 } |
123 } |
125 } |
124 |
126 |
125 if( isSame == 0 ) |
127 if( isSame == 0 ) |
126 { |
128 { |
127 iStatusControl = CCCAppStatusControl::NewL( *iProvider, *this ); |
129 iStatusControl = CCCAppStatusControl::NewL( *iProvider, *this ); |
128 iStatusControl->SetContainerWindowL( *this ); |
130 iStatusControl->SetContainerWindowL( *this ); |
129 iStatusControl->MakeVisible( EFalse ); |
131 iStatusControl->MakeVisible( EFalse ); |
130 |
132 iHeaderCtrl->SetStatusButtonVisibility( EFalse ); |
131 CFbsBitmap* bmp = NULL; |
133 CFbsBitmap* bmp = NULL; |
132 CFbsBitmap* bmpMask = NULL; |
134 CFbsBitmap* bmpMask = NULL; |
133 |
135 |
134 AknIconUtils::CreateIconL( |
136 AknIconUtils::CreateIconL( |
135 bmp, |
137 bmp, |
137 KCcaIconDefaultFileName, |
139 KCcaIconDefaultFileName, |
138 EMbmPhonebook2eceQgn_prop_wml_bm_ovi, |
140 EMbmPhonebook2eceQgn_prop_wml_bm_ovi, |
139 EMbmPhonebook2eceQgn_prop_wml_bm_ovi_mask ); |
141 EMbmPhonebook2eceQgn_prop_wml_bm_ovi_mask ); |
140 |
142 |
141 CGulIcon* guiIcon = CGulIcon::NewL( bmp, bmpMask ); |
143 CGulIcon* guiIcon = CGulIcon::NewL( bmp, bmpMask ); |
142 iStatusControl->SetDefaultStatusL( R_QTN_CCA_DEFAULT_STATUS, guiIcon ); |
144 iStatusControl->SetDefaultStatusIconL( guiIcon ); |
143 iStatusControl->SetContactLinkL( *link ); |
145 iStatusControl->SetContactLinkL( *link ); |
144 |
146 |
145 iFactoryExtensionNotifier = CCCaFactoryExtensionNotifier::NewL(); |
147 iFactoryExtensionNotifier = CCCaFactoryExtensionNotifier::NewL(); |
146 TCallBack callBack( CCCAppCommLauncherContainer::CheckExtensionFactoryL, this ); |
148 TCallBack callBack( CCCAppCommLauncherContainer::CheckExtensionFactoryL, this ); |
147 iFactoryExtensionNotifier->ObserveExtensionFactory( callBack ); |
149 iFactoryExtensionNotifier->ObserveExtensionFactoryL( callBack ); |
148 } |
150 } |
149 |
151 |
150 if( link ) |
152 if( link ) |
151 { |
153 { |
152 CleanupStack::PopAndDestroy(); //link |
154 CleanupStack::PopAndDestroy(); //link |
171 // CCCAppCommLauncherContainer::CreateListboxControlL() |
173 // CCCAppCommLauncherContainer::CreateListboxControlL() |
172 // ---------------------------------------------------------------------------- |
174 // ---------------------------------------------------------------------------- |
173 // |
175 // |
174 void CCCAppCommLauncherContainer::CreateListboxControlL() |
176 void CCCAppCommLauncherContainer::CreateListboxControlL() |
175 { |
177 { |
176 // Will use customed list box later |
178 // Use customized list box |
177 // iListBox = CCCAppCommLauncherCustomListBox::NewL(); |
179 iListBox = CCCAppCommLauncherCustomListBox::NewL(); |
178 iListBox = new (ELeave) CAknDoubleLargeStyleListBox(); |
|
179 iListBox->ConstructL(this, EAknListBoxLoopScrolling); |
180 iListBox->ConstructL(this, EAknListBoxLoopScrolling); |
180 iListBox->SetContainerWindowL(*this); |
181 iListBox->SetContainerWindowL(*this); |
181 iListBox->CreateScrollBarFrameL(ETrue); |
182 iListBox->CreateScrollBarFrameL(ETrue); |
182 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
183 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
183 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); |
184 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); |
213 // CCCAppCommLauncherContainer::SizeChanged() |
214 // CCCAppCommLauncherContainer::SizeChanged() |
214 // ---------------------------------------------------------------------------- |
215 // ---------------------------------------------------------------------------- |
215 // |
216 // |
216 void CCCAppCommLauncherContainer::SizeChanged() |
217 void CCCAppCommLauncherContainer::SizeChanged() |
217 { |
218 { |
218 const TRect drawRect(Rect()); |
219 const TRect rect(Rect()); |
219 const TBool isLandscape(Layout_Meta_Data::IsLandscapeOrientation()); |
220 const TBool isLandscape(Layout_Meta_Data::IsLandscapeOrientation()); |
220 |
221 |
221 // Header, Status and Listbox |
222 // contact card pane layout |
222 TAknLayoutRect headerRect; |
223 TAknWindowComponentLayout contactCardPaneLayout( |
223 headerRect.LayoutRect(drawRect, AknLayoutScalable_Apps::cl_header_pane(isLandscape)); |
224 TAknWindowComponentLayout::Compose( |
224 iHeaderCtrl->SetRect(headerRect.Rect()); |
225 AknLayoutScalable_Apps::main_phob2_pane( 0 ), |
225 |
226 AknLayoutScalable_Apps::phob2_contact_card_pane( 1 ) ) ); |
226 AknLayoutUtils::LayoutControl( |
227 |
227 iListBox, drawRect, AknLayoutScalable_Apps::cl_listscroll_pane(isLandscape)); |
228 |
228 |
229 TInt option( isLandscape ? 3 : 2 ); // (w/o button) |
229 TRect listRect = iListBox->Rect(); |
230 if( iStatusControl && iStatusControl->IsVisible() ) |
230 |
231 { |
231 if (!isLandscape) |
232 // (w button) |
232 { |
233 if( isLandscape ) |
233 listRect.iTl.iX = drawRect.iTl.iX; |
234 { |
234 listRect.iBr.iX = drawRect.iBr.iX; |
235 option = 1; |
235 } |
236 } |
236 |
237 else |
237 if( iStatusControl && iStatusControl->IsVisible() ) |
238 { |
238 { |
239 option = 0; |
239 // status control (similar to list_double2_graphic_pane) |
240 } |
240 TAknLayoutRect statusLayout; |
241 |
241 statusLayout.LayoutRect( listRect, |
242 // Status control layout |
242 AknLayoutScalable_Avkon::list_double2_graphic_pane( 0 ) ); |
243 TAknWindowComponentLayout statusPaneLayout( |
243 TRect statusRect( statusLayout.Rect() ); |
244 TAknWindowComponentLayout::Compose( |
244 |
245 TAknWindowComponentLayout::Compose( |
245 // list gives space for status control (top of list) |
246 contactCardPaneLayout, |
246 listRect.Move( 0, statusRect.Height() ); |
247 AknLayoutScalable_Apps::phob2_cc_data_pane( option ) ), |
247 listRect.Resize( 0, -statusRect.Height() ); |
248 AknLayoutScalable_Apps::phob2_cc_button_pane( option ) ) ); |
248 |
249 |
249 // status control |
250 TAknLayoutRect statusPaneLayoutRect; |
250 statusRect.Shrink( 10, 5 ); |
251 statusPaneLayoutRect.LayoutRect( rect, statusPaneLayout.LayoutLine() ); |
251 iStatusControl->SetRect( statusRect ); |
252 TRect statusPaneRect( statusPaneLayoutRect.Rect() ); |
252 } |
253 iStatusControl->SetRect( statusPaneRect ); |
253 |
254 } |
254 iListBox->SetRect( listRect ); |
255 // Header and Listbox |
|
256 |
|
257 // header layout |
|
258 TAknWindowComponentLayout headerPaneLayout( |
|
259 TAknWindowComponentLayout::Compose( |
|
260 contactCardPaneLayout, |
|
261 AknLayoutScalable_Apps::phob2_cc_data_pane( option ) ) ); |
|
262 |
|
263 TAknLayoutRect headerPaneLayoutRect; |
|
264 headerPaneLayoutRect.LayoutRect( rect, headerPaneLayout.LayoutLine() ); |
|
265 TRect headerPaneRect( headerPaneLayoutRect.Rect() ); |
|
266 iHeaderCtrl->SetRect( headerPaneRect ); |
|
267 |
|
268 // list layout |
|
269 TAknWindowComponentLayout listPaneLayout( |
|
270 TAknWindowComponentLayout::Compose( |
|
271 contactCardPaneLayout, |
|
272 AknLayoutScalable_Apps::phob2_cc_listscroll_pane( option ) ) ); |
|
273 |
|
274 TAknLayoutRect listPaneLayoutRect; |
|
275 listPaneLayoutRect.LayoutRect( rect, listPaneLayout.LayoutLine() ); |
|
276 TRect listPaneRect( listPaneLayoutRect.Rect() ); |
|
277 iListBox->SetRect( listPaneRect ); |
255 |
278 |
256 // Background skin |
279 // Background skin |
257 if (iBackground) |
280 if (iBackground) |
258 { |
281 { |
259 iBackground->SetRect(drawRect); |
282 iBackground->SetRect(rect); |
260 } |
283 } |
261 |
284 |
262 DrawNow(); |
285 DrawDeferred(); |
263 } |
286 } |
264 |
287 |
265 // ---------------------------------------------------------------------------- |
288 // ---------------------------------------------------------------------------- |
266 // CCCAppCommLauncherContainer::CountComponentControls() |
289 // CCCAppCommLauncherContainer::CountComponentControls() |
267 // ---------------------------------------------------------------------------- |
290 // ---------------------------------------------------------------------------- |
316 // ---------------------------------------------------------------------------- |
339 // ---------------------------------------------------------------------------- |
317 // |
340 // |
318 TKeyResponse CCCAppCommLauncherContainer::OfferKeyEventL( |
341 TKeyResponse CCCAppCommLauncherContainer::OfferKeyEventL( |
319 const TKeyEvent& aKeyEvent, TEventCode aType) |
342 const TKeyEvent& aKeyEvent, TEventCode aType) |
320 { |
343 { |
|
344 // Make sure timer can be canceled before user do any operation. |
|
345 iPlugin.CancelTimer(); |
|
346 |
321 // Forward the key-event 1st to base-class |
347 // Forward the key-event 1st to base-class |
322 TKeyResponse returnValue = |
348 TKeyResponse returnValue = |
323 CCCAppViewPluginAknContainer::OfferKeyEventL(aKeyEvent, aType); |
349 CCCAppViewPluginAknContainer::OfferKeyEventL(aKeyEvent, aType); |
324 |
350 |
325 // Offer event to header control. |
351 // Offer event to header control. |
422 |
451 |
423 // ---------------------------------------------------------------------------- |
452 // ---------------------------------------------------------------------------- |
424 // CCCAppCommLauncherContainer::HandleLongTapEventL() |
453 // CCCAppCommLauncherContainer::HandleLongTapEventL() |
425 // ---------------------------------------------------------------------------- |
454 // ---------------------------------------------------------------------------- |
426 // |
455 // |
427 void CCCAppCommLauncherContainer::HandleLongTapEventL( const TPoint& aPenEventLocation, |
456 void CCCAppCommLauncherContainer::HandleLongTapEventL( const TPoint& /*aPenEventLocation*/, |
428 const TPoint& aPenEventScreenLocation ) |
457 const TPoint& /*aPenEventScreenLocation*/ ) |
429 { |
458 { |
430 CCAContactorService* contactorService = iPlugin.ContactorService(); |
459 CCAContactorService* contactorService = iPlugin.ContactorService(); |
431 |
460 if ( contactorService ) |
432 if ( contactorService && contactorService->IsBusy() ) |
461 { |
433 { |
462 if ( contactorService->IsBusy() ) |
434 return; |
463 { |
435 } |
464 return; |
436 else if ( CommMethodsAvailable() ) |
465 } |
437 { |
466 else if ( CommMethodsAvailable() ) |
438 TPtrC fullName; |
467 { |
439 iPlugin.ContactHandler().ContactFieldItemDataL( |
468 TPtrC fullName; |
440 CCmsContactFieldItem::ECmsFullName, fullName ); |
469 iPlugin.ContactHandler().ContactFieldItemDataL( |
441 |
470 CCmsContactFieldItem::ECmsFullName, fullName ); |
442 TUint paramFlag = 0;//CCAContactorService::TCSParameter::EEnableDefaults; |
471 |
443 CCAContactorService::TCSParameter param( |
472 TUint paramFlag = 0;//CCAContactorService::TCSParameter::EEnableDefaults; |
444 iPlugin.Container().SelectedCommunicationMethod(), |
473 |
445 *iPlugin.ContactHandler().ContactIdentifierLC(),//contactlinkarray |
474 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector |
446 paramFlag, |
475 contactActionType = iPlugin.Container().SelectedCommunicationMethod(); |
447 fullName ); |
476 CCAContactorService::TCSParameter param( |
448 contactorService->ExecuteServiceL( param ); |
477 contactActionType, |
449 |
478 *iPlugin.ContactHandler().ContactIdentifierLC(),//contactlinkarray |
450 CleanupStack::PopAndDestroy( 1 );// contactlinkarray |
479 paramFlag, |
|
480 fullName ); |
|
481 |
|
482 if ( contactActionType == VPbkFieldTypeSelectorFactory::EVoiceCallSelector || |
|
483 contactActionType == VPbkFieldTypeSelectorFactory::EVideoCallSelector || |
|
484 contactActionType == VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) |
|
485 { |
|
486 iPlugin.StartTimerL(); |
|
487 } |
|
488 |
|
489 contactorService->ExecuteServiceL( param ); |
|
490 |
|
491 CleanupStack::PopAndDestroy( 1 );// contactlinkarray |
|
492 } |
451 } |
493 } |
452 } |
494 } |
453 |
495 |
454 // ---------------------------------------------------------------------------- |
496 // ---------------------------------------------------------------------------- |
455 // CCCAppCommLauncherContainer::HandleListBoxEventL() |
497 // CCCAppCommLauncherContainer::HandleListBoxEventL() |
506 CCmsContactFieldItem::ECmsFullName, fullName); |
551 CCmsContactFieldItem::ECmsFullName, fullName); |
507 |
552 |
508 TUint paramFlag = CCAContactorService::TCSParameter::EEnableDefaults; |
553 TUint paramFlag = CCAContactorService::TCSParameter::EEnableDefaults; |
509 |
554 |
510 CCAContactorService::TCSParameter param( |
555 CCAContactorService::TCSParameter param( |
511 iPlugin.Container().SelectedCommunicationMethod(), |
556 contactActionType, |
512 *iPlugin.ContactHandler().ContactIdentifierLC(),//contactlinkarray |
557 *iPlugin.ContactHandler().ContactIdentifierLC(),//contactlinkarray |
513 paramFlag, |
558 paramFlag, |
514 fullName); |
559 fullName); |
515 |
560 |
|
561 if ( contactActionType == VPbkFieldTypeSelectorFactory::EVoiceCallSelector || |
|
562 contactActionType == VPbkFieldTypeSelectorFactory::EVideoCallSelector || |
|
563 contactActionType == VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) |
|
564 { |
|
565 iPlugin.StartTimerL(); |
|
566 } |
|
567 |
516 contactorService->ExecuteServiceL(param); |
568 contactorService->ExecuteServiceL(param); |
517 |
569 |
518 CleanupStack::PopAndDestroy(1);// contactlinkarray |
570 CleanupStack::PopAndDestroy(1);// contactlinkarray |
519 } |
571 } |
520 } |
572 } |
597 TBool CCCAppCommLauncherContainer::CommMethodsAvailable() |
659 TBool CCCAppCommLauncherContainer::CommMethodsAvailable() |
598 { |
660 { |
599 return (KErrNotFound == iListBox->CurrentItemIndex()) |
661 return (KErrNotFound == iListBox->CurrentItemIndex()) |
600 ? EFalse : ETrue; |
662 ? EFalse : ETrue; |
601 } |
663 } |
|
664 |
|
665 // --------------------------------------------------------------------------- |
|
666 // CCCAppCommLauncherContainer::IsHighlight |
|
667 // --------------------------------------------------------------------------- |
|
668 // |
|
669 const TBool CCCAppCommLauncherContainer::IsListBoxHighlightEnabled() |
|
670 { |
|
671 return !( iListBox->ItemDrawer()->Flags() & |
|
672 CListItemDrawer::ESingleClickDisabledHighlight ); |
|
673 } |
|
674 |
602 |
675 |
603 // --------------------------------------------------------------------------- |
676 // --------------------------------------------------------------------------- |
604 // CCCAppCommLauncherContainer::SelectedCommunicationMethod |
677 // CCCAppCommLauncherContainer::SelectedCommunicationMethod |
605 // --------------------------------------------------------------------------- |
678 // --------------------------------------------------------------------------- |
606 // |
679 // |
693 iLongTapDetector = CAknLongTapDetector::NewL( this ); |
766 iLongTapDetector = CAknLongTapDetector::NewL( this ); |
694 } |
767 } |
695 return *iLongTapDetector; |
768 return *iLongTapDetector; |
696 } |
769 } |
697 |
770 |
|
771 // -------------------------------------------------------------------------- |
|
772 // CCCAppCommLauncherContainer::SetDefaultStatusTextL |
|
773 // -------------------------------------------------------------------------- |
|
774 // |
|
775 void CCCAppCommLauncherContainer::SetDefaultStatusTextL() |
|
776 { |
|
777 TPtrC fullName; |
|
778 iPlugin.ContactHandler().ContactFieldItemDataL( |
|
779 CCmsContactFieldItem::ECmsFullName, |
|
780 fullName ); |
|
781 |
|
782 if( fullName.Size() == 0 ) |
|
783 { |
|
784 return; |
|
785 } |
|
786 |
|
787 HBufC* defaultStatusText = StringLoader::LoadL( |
|
788 R_QTN_CCA_FTU_DISCOVER, fullName, iCoeEnv ); |
|
789 |
|
790 iStatusControl->SetDefaultStatusTextL( defaultStatusText ); |
|
791 } |
698 |
792 |
699 //----------------------------------------------------------------------------- |
793 //----------------------------------------------------------------------------- |
700 // CCCAppCommLauncherContainer::StatusClicked() |
794 // CCCAppCommLauncherContainer::StatusClicked() |
701 //----------------------------------------------------------------------------- |
795 //----------------------------------------------------------------------------- |
702 // |
796 // |