73 // |
74 // |
74 CmPluginVpnNextLayerSelectDlg::CmPluginVpnNextLayerSelectDlg( |
75 CmPluginVpnNextLayerSelectDlg::CmPluginVpnNextLayerSelectDlg( |
75 CCmPluginBaseEng& aCmPluginBaseEng, |
76 CCmPluginBaseEng& aCmPluginBaseEng, |
76 RArray<TUint32>& aBindableMethods, |
77 RArray<TUint32>& aBindableMethods, |
77 TBool& aSnapSelected, |
78 TBool& aSnapSelected, |
78 TUint32& aNextLayerId ) |
79 TUint32& aNextLayerId, |
79 : iMyEikonEnv( *CEikonEnv::Static() ) |
80 TInt aDummyIndex ) |
|
81 : CAknListQueryDialog( &aDummyIndex ) |
|
82 , iMyEikonEnv( *CEikonEnv::Static() ) |
80 , iCmPluginBaseEng( aCmPluginBaseEng ) |
83 , iCmPluginBaseEng( aCmPluginBaseEng ) |
81 , iSnapSelected( aSnapSelected ) |
84 , iSnapSelected( aSnapSelected ) |
82 , iNextLayerId( aNextLayerId ) |
85 , iNextLayerId( aNextLayerId ) |
83 , iResourceReader( *CCoeEnv::Static() ) |
86 , iResourceReader( *CCoeEnv::Static() ) |
84 , iDestinations( aBindableMethods ) |
87 , iDestinations( aBindableMethods ) |
94 // CmPluginVpnNextLayerSelectDlg::~CmPluginVpnPolicySelectionDlg |
97 // CmPluginVpnNextLayerSelectDlg::~CmPluginVpnPolicySelectionDlg |
95 // -------------------------------------------------------------------------- |
98 // -------------------------------------------------------------------------- |
96 // |
99 // |
97 CmPluginVpnNextLayerSelectDlg::~CmPluginVpnNextLayerSelectDlg() |
100 CmPluginVpnNextLayerSelectDlg::~CmPluginVpnNextLayerSelectDlg() |
98 { |
101 { |
|
102 if ( iAsyncCancel ) |
|
103 { |
|
104 delete iAsyncCancel; |
|
105 iAsyncCancel = NULL; |
|
106 } |
|
107 |
99 iResourceReader.Close(); |
108 iResourceReader.Close(); |
100 |
|
101 if ( iMenuBar ) |
|
102 { |
|
103 HideMenu(); |
|
104 CEikonEnv::Static()->EikAppUi()->RemoveFromStack( iMenuBar ); |
|
105 delete iMenuBar; |
|
106 iMenuBar = NULL; |
|
107 } |
|
108 |
|
109 delete iMyListBox; iMyListBox = NULL; |
|
110 } |
109 } |
111 |
110 |
112 // -------------------------------------------------------------------------- |
111 // -------------------------------------------------------------------------- |
113 // CmPluginVpnNextLayerSelectDlg::ConstructL |
112 // CmPluginVpnNextLayerSelectDlg::ConstructL |
114 // -------------------------------------------------------------------------- |
113 // -------------------------------------------------------------------------- |
115 // |
114 // |
116 void CmPluginVpnNextLayerSelectDlg::ConstructL() |
115 void CmPluginVpnNextLayerSelectDlg::ConstructL() |
117 { |
116 { |
118 LoadResourceL( KPluginVPNResDirAndFileName ); |
117 LoadResourceL( KPluginVPNResDirAndFileName ); |
119 InitialiseL(); |
|
120 SetTextsAndIconsL(); |
|
121 } |
|
122 |
|
123 // -------------------------------------------------------------------------- |
|
124 // CmPluginVpnNextLayerSelectDlg::InitialiseL |
|
125 // -------------------------------------------------------------------------- |
|
126 // |
|
127 void CmPluginVpnNextLayerSelectDlg::InitialiseL() |
|
128 { |
|
129 LOGGER_ENTERFN( "CmPluginVpnNextLayerSelectDlg::InitialiseL" ); |
|
130 |
118 |
131 // get the EasyWlan id if it's supported |
119 // get the EasyWlan id if it's supported |
132 if ( FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ) ) |
120 if ( FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ) ) |
133 { |
121 { |
134 iEasyWlanId = iCmManager.EasyWlanIdL(); |
122 iEasyWlanId = iCmManager.EasyWlanIdL(); |
135 } |
123 } |
136 |
124 } |
137 // Listbox |
125 |
138 iMyListBox = new ( ELeave ) CAknDoubleLargeGraphicPopupMenuStyleListBox; |
126 // --------------------------------------------------------------------------- |
139 |
127 // CmPluginVpnNextLayerSelectDlg::CancelAsynchronouslyL |
140 CAknPopupList::ConstructL( |
128 // --------------------------------------------------------------------------- |
141 iMyListBox, |
129 TInt CmPluginVpnNextLayerSelectDlg::CancelAsynchronouslyL( TAny* aObject ) |
142 R_SOFTKEYS_OPTIONS_CANCEL__SELECT, |
130 { |
143 AknPopupLayouts::EMenuDoubleLargeGraphicWindow ); |
131 CmPluginVpnNextLayerSelectDlg* myself = |
144 |
132 static_cast< CmPluginVpnNextLayerSelectDlg* >( aObject ); |
145 TInt flags = 0; |
133 |
146 iMyListBox->ConstructL( this, flags ); |
134 myself->TryExitL( EAknSoftkeyCancel ); |
147 iMyListBox->CreateScrollBarFrameL( ETrue ); |
135 return 0; |
148 iMyListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
136 } |
149 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
137 |
150 |
138 // ---------------------------------------------------------------------------- |
151 // Menu |
139 // CmPluginVpnNextLayerSelectDlg::PreLayoutDynInitL |
152 CEikMenuBar* newMenuBar = new ( ELeave ) CEikMenuBar(); |
140 // ---------------------------------------------------------------------------- |
153 CleanupStack::PushL( newMenuBar ); |
141 // |
154 newMenuBar->ConstructL( this, NULL, R_VPN_REAL_CM_SELECTION_MENUBAR ); |
142 void CmPluginVpnNextLayerSelectDlg::PreLayoutDynInitL() |
155 iMyEikonEnv.EikAppUi()->AddToStackL( newMenuBar, |
143 { |
156 ECoeStackPriorityMenu, |
144 CAknDialog::ConstructL( R_VPN_REAL_CM_SELECTION_MENUBAR ); |
157 ECoeStackFlagRefusesFocus ); |
145 |
158 iMenuBar = newMenuBar; |
146 // Let the base class do its job first |
159 CleanupStack::Pop( newMenuBar ); // ownership taken by 'this' |
147 CAknListQueryDialog::PreLayoutDynInitL(); |
|
148 |
|
149 SetTextsAndIconsL(); |
|
150 } |
|
151 |
|
152 // ---------------------------------------------------------------------------- |
|
153 // CmPluginVpnNextLayerSelectDlg::OkToExitL |
|
154 // ---------------------------------------------------------------------------- |
|
155 // |
|
156 TBool CmPluginVpnNextLayerSelectDlg::OkToExitL( TInt aButtonId ) |
|
157 { |
|
158 TBool result = EFalse; |
|
159 |
|
160 if ( aButtonId == EAknSoftkeyDone || aButtonId == EAknSoftkeyOk ) |
|
161 { |
|
162 result = ETrue; |
|
163 } |
|
164 else if ( aButtonId == EAknSoftkeySelect ) |
|
165 { |
|
166 ProcessCommandL( ECmManagerUiCmdDestSelect ); |
|
167 } |
|
168 else if ( aButtonId == EAknSoftkeyOptions ) |
|
169 { |
|
170 ProcessCommandL( EAknSoftkeyOptions ); |
|
171 } |
|
172 else if ( aButtonId == EAknSoftkeyBack || aButtonId == EAknSoftkeyCancel ) |
|
173 { |
|
174 result = ETrue; |
|
175 } |
|
176 else |
|
177 { |
|
178 |
|
179 } |
|
180 |
|
181 return result; |
160 } |
182 } |
161 |
183 |
162 // -------------------------------------------------------------------------- |
184 // -------------------------------------------------------------------------- |
163 // CmPluginVpnNextLayerSelectDlg::SetTextsAndIconsL |
185 // CmPluginVpnNextLayerSelectDlg::SetTextsAndIconsL |
164 // -------------------------------------------------------------------------- |
186 // -------------------------------------------------------------------------- |
165 // |
187 // |
166 void CmPluginVpnNextLayerSelectDlg::SetTextsAndIconsL() |
188 void CmPluginVpnNextLayerSelectDlg::SetTextsAndIconsL() |
167 { |
189 { |
168 LOGGER_ENTERFN( "CmPluginVpnNextLayerSelectDlg::SetTextsAndIconsL" ); |
190 LOGGER_ENTERFN( "CmPluginVpnNextLayerSelectDlg::SetTextsAndIconsL" ); |
169 // Title |
|
170 SetTitleL( *StringLoader::LoadLC( |
|
171 R_QTN_NETW_CONSET_PRMPT_VPN_REAL_CONNECTION ) ); |
|
172 CleanupStack::PopAndDestroy(); // header |
|
173 |
191 |
174 // Item text array |
192 // Item text array |
175 CDesCArray* itemArray = |
193 CDesCArray* itemArray = |
176 new ( ELeave ) CDesCArrayFlat( KCmArrayMediumGranularity ); |
194 new ( ELeave ) CDesCArrayFlat( KCmArrayMediumGranularity ); |
177 CleanupStack::PushL( itemArray ); |
195 CleanupStack::PushL( itemArray ); |
178 iMyListBox->Model()->SetItemTextArray( itemArray ); // ownership taken |
196 SetItemTextArray( itemArray ); // ownership taken |
179 iMyListBox->Model()->SetOwnershipType( ELbmOwnsItemArray ); |
197 SetOwnershipType( ELbmOwnsItemArray ); |
180 CleanupStack::Pop( itemArray ); // as ownership is taken |
198 CleanupStack::Pop( itemArray ); // as ownership is taken |
181 |
199 |
182 // Icon array |
200 // Icon array |
183 CArrayPtr<CGulIcon>* icons = |
201 CArrayPtr<CGulIcon>* icons = |
184 new ( ELeave ) CArrayPtrFlat<CGulIcon>( KCmArrayMediumGranularity ); |
202 new ( ELeave ) CArrayPtrFlat<CGulIcon>( KCmArrayMediumGranularity ); |
185 CleanupStack::PushL( icons ); |
203 CleanupStack::PushL( icons ); |
186 iMyListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons ); |
204 SetIconArrayL( icons ); |
187 // ownership taken by SetIconArrayL! |
205 // ownership taken by SetIconArrayL! |
188 CleanupStack::Pop( icons ); // as ownership is taken |
206 CleanupStack::Pop( icons ); // as ownership is taken |
189 |
207 |
190 // Step through the Destinations - do not show: |
208 // Step through the Destinations - do not show: |
191 // Parent Destinations or Destinations with no non-virtual CMs |
209 // Parent Destinations or Destinations with no non-virtual CMs |
435 { |
453 { |
436 attribute = ECmNextLayerIapId; |
454 attribute = ECmNextLayerIapId; |
437 destId = iEasyWlanId; |
455 destId = iEasyWlanId; |
438 } |
456 } |
439 iCmPluginBaseEng.SetIntAttributeL( attribute, destId ); |
457 iCmPluginBaseEng.SetIntAttributeL( attribute, destId ); |
440 AttemptExitL( ETrue ); |
458 |
|
459 // We cannot use TryExitL here, since if the pointer event |
|
460 // handling is ongoing, i.e., we got here from this class's |
|
461 // HandleListBoxEventL, there will be a KERN-EXEC 3 panic. |
|
462 // Calling base class HandleListBoxEventL will exit the |
|
463 // dialog asynchronously with return value ETrue. |
|
464 CAknListQueryDialog::HandleListBoxEventL( ListBox(), |
|
465 EEventItemSingleClicked ); |
441 break; |
466 break; |
442 } |
467 } |
|
468 |
443 // For uncategorised destinations, flow through to ECmManagerUiCmdCMSelect |
469 // For uncategorised destinations, flow through to ECmManagerUiCmdCMSelect |
444 } |
470 } |
445 case ECmManagerUiCmdCMSelect: |
471 case ECmManagerUiCmdCMSelect: |
446 { |
472 { |
447 // select a connection method from the highlighted destination |
473 // select a connection method from the highlighted destination |
448 TUint32 destId = iDestinations[ iListBox->CurrentItemIndex() ]; |
474 TUint32 destId = iDestinations[ ListBox()->CurrentItemIndex() ]; |
449 TUint32 cmId (0); |
475 TUint32 cmId (0); |
450 if ( ShowCMSelectionDlgL( destId, cmId ) ) |
476 if ( ShowCMSelectionDlgL( destId, cmId ) ) |
451 { |
477 { |
452 iCmPluginBaseEng.SetIntAttributeL( ECmNextLayerIapId, cmId ); |
478 iCmPluginBaseEng.SetIntAttributeL( ECmNextLayerIapId, cmId ); |
453 AttemptExitL( ETrue ); |
479 |
|
480 // We cannot use TryExitL here, since if the pointer event |
|
481 // handling is ongoing, i.e., we got here from this class's |
|
482 // HandleListBoxEventL, there will be a KERN-EXEC 3 panic. |
|
483 // Calling base class HandleListBoxEventL will exit the |
|
484 // dialog asynchronously with return value ETrue. |
|
485 CAknListQueryDialog::HandleListBoxEventL( ListBox(), |
|
486 EEventItemSingleClicked ); |
454 } |
487 } |
455 else |
488 else |
456 { |
489 { |
457 CancelPopup(); |
490 // We need to exit asynchronously, in case we ended up here |
|
491 // from HandleListBoxEventL. The callback function will exit |
|
492 // the dialog with return value EFalse. |
|
493 TCallBack cb( CancelAsynchronouslyL, this ); |
|
494 iAsyncCancel = new( ELeave ) CAsyncCallBack( cb, CActive::EPriorityHigh ); |
|
495 iAsyncCancel->CallBack(); |
458 } |
496 } |
459 break; |
497 break; |
460 } |
498 } |
461 case EAknCmdHelp: |
499 case EAknCmdHelp: |
462 { |
500 { |
484 TKeyResponse CmPluginVpnNextLayerSelectDlg::OfferKeyEventL( |
522 TKeyResponse CmPluginVpnNextLayerSelectDlg::OfferKeyEventL( |
485 const TKeyEvent& aKeyEvent, |
523 const TKeyEvent& aKeyEvent, |
486 TEventCode aType ) |
524 TEventCode aType ) |
487 { |
525 { |
488 TKeyResponse retVal ( EKeyWasNotConsumed ); |
526 TKeyResponse retVal ( EKeyWasNotConsumed ); |
489 TUint highlighted = iDestinations[ iListBox->CurrentItemIndex() ]; |
527 TUint highlighted = iDestinations[ ListBox()->CurrentItemIndex() ]; |
490 |
528 |
491 switch ( aKeyEvent.iScanCode ) |
529 switch ( aKeyEvent.iScanCode ) |
492 { |
530 { |
493 case EStdKeyDownArrow: |
531 case EStdKeyDownArrow: |
494 case EStdKeyUpArrow: |
532 case EStdKeyUpArrow: |
495 { |
533 { |
496 // If focus is on the 'uncategorised' destination, |
534 // If focus is on the 'uncategorised' destination, |
497 // change the soft key to 'Open' |
535 // change the soft key to 'Open' |
498 if ( highlighted == KDestItemUncategorized ) |
536 if ( highlighted == KDestItemUncategorized ) |
499 { |
537 { |
500 ButtonGroupContainer()->SetCommandL( |
538 ButtonGroupContainer().SetCommandL( |
501 ECmManagerUiCmdDestSelect, |
539 ECmManagerUiCmdDestSelect, |
502 *( StringLoader::LoadLC( R_QTN_MSK_OPEN ) ) |
540 *( StringLoader::LoadLC( R_QTN_MSK_OPEN ) ) |
503 ); |
541 ); |
504 ButtonGroupContainer()->DrawDeferred(); |
542 ButtonGroupContainer().DrawDeferred(); |
505 CleanupStack::PopAndDestroy(); |
543 CleanupStack::PopAndDestroy(); |
506 } |
544 } |
507 else |
545 else |
508 { |
546 { |
509 ButtonGroupContainer()->SetCommandL( |
547 ButtonGroupContainer().SetCommandL( |
510 ECmManagerUiCmdDestSelect, |
548 ECmManagerUiCmdDestSelect, |
511 *( StringLoader::LoadLC( R_QTN_MSK_SELECT ) ) |
549 *( StringLoader::LoadLC( R_QTN_MSK_SELECT ) ) |
512 ); |
550 ); |
513 ButtonGroupContainer()->DrawDeferred(); |
551 ButtonGroupContainer().DrawDeferred(); |
514 CleanupStack::PopAndDestroy(); |
552 CleanupStack::PopAndDestroy(); |
515 } |
553 } |
516 break; |
554 break; |
517 } |
555 } |
518 case EStdKeyNo: |
556 case EStdKeyNo: |
519 { |
557 { |
520 CancelPopup(); |
558 TryExitL( EAknSoftkeyCancel ); |
521 return EKeyWasConsumed; |
559 return EKeyWasConsumed; |
522 } |
560 } |
523 default: |
561 default: |
524 { |
562 { |
525 // If focus is on the 'uncategorised' destination, |
563 // If focus is on the 'uncategorised' destination, |
526 // change the soft key to 'Open' |
564 // change the soft key to 'Open' |
527 if ( highlighted == KDestItemUncategorized ) |
565 if ( highlighted == KDestItemUncategorized ) |
528 { |
566 { |
529 ButtonGroupContainer()->SetCommandL( |
567 ButtonGroupContainer().SetCommandL( |
530 ECmManagerUiCmdDestSelect, |
568 ECmManagerUiCmdDestSelect, |
531 *( StringLoader::LoadLC( R_QTN_MSK_OPEN ) ) |
569 *( StringLoader::LoadLC( R_QTN_MSK_OPEN ) ) |
532 ); |
570 ); |
533 ButtonGroupContainer()->DrawDeferred(); |
571 ButtonGroupContainer().DrawDeferred(); |
534 CleanupStack::PopAndDestroy(); |
572 CleanupStack::PopAndDestroy(); |
535 } |
573 } |
536 |
574 |
537 if ( aKeyEvent.iCode == EKeyEscape ) |
575 if ( aKeyEvent.iCode == EKeyEscape ) |
538 { |
576 { |
539 CancelPopup(); |
577 TryExitL( EAknSoftkeyCancel ); |
540 return EKeyWasConsumed; |
578 return EKeyWasConsumed; |
541 } |
579 } |
542 } |
580 } |
543 } |
581 } |
544 retVal = iListBox->OfferKeyEventL( aKeyEvent, aType ); |
582 retVal = ListBox()->OfferKeyEventL( aKeyEvent, aType ); |
545 |
583 |
546 return retVal; |
584 return retVal; |
547 } |
585 } |
548 |
586 |
|
587 |
549 // --------------------------------------------------------------------------- |
588 // --------------------------------------------------------------------------- |
550 // CDestDlg::HandleListBoxEventL |
589 // CmPluginVpnNextLayerSelectDlg::HandleListBoxEventL |
551 // --------------------------------------------------------------------------- |
590 // --------------------------------------------------------------------------- |
552 void CmPluginVpnNextLayerSelectDlg::HandleListBoxEventL( CEikListBox* /*aListBox*/, |
591 void CmPluginVpnNextLayerSelectDlg::HandleListBoxEventL( CEikListBox* /*aListBox*/, |
553 TListBoxEvent aEventType ) |
592 TListBoxEvent aEventType ) |
554 { |
593 { |
555 switch ( aEventType ) |
594 switch ( aEventType ) |
556 { |
595 { |
557 case EEventEnterKeyPressed: |
596 case EEventEnterKeyPressed: |
558 case EEventItemDoubleClicked: |
597 case EEventItemSingleClicked: |
559 { |
598 { |
560 ProcessCommandL(ECmManagerUiCmdDestSelect); |
599 ProcessCommandL( ECmManagerUiCmdDestSelect ); |
|
600 |
561 break; |
601 break; |
562 } |
602 } |
563 default: |
603 default: |
564 { |
604 { |
565 break; |
605 break; |
566 }; |
606 }; |
567 }; |
607 }; |
568 } |
608 } |
569 |
609 |
570 // -------------------------------------------------------------------------- |
|
571 // CmPluginVpnNextLayerSelectDlg::SetEmphasis |
|
572 // -------------------------------------------------------------------------- |
|
573 // |
|
574 void CmPluginVpnNextLayerSelectDlg::SetEmphasis( CCoeControl* aMenuControl, |
|
575 TBool aEmphasis ) |
|
576 { |
|
577 CEikAppUi* appUi = iMyEikonEnv.EikAppUi(); |
|
578 appUi->RemoveFromStack( aMenuControl ); |
|
579 |
|
580 TRAP_IGNORE( appUi->AddToStackL ( |
|
581 aMenuControl, |
|
582 aEmphasis ? ECoeStackPriorityDialog : |
|
583 ECoeStackPriorityMenu ) ); |
|
584 |
|
585 appUi->UpdateStackedControlFlags( |
|
586 aMenuControl, |
|
587 aEmphasis ? 0 : ECoeStackFlagRefusesFocus, |
|
588 ECoeStackFlagRefusesFocus ); |
|
589 appUi->HandleStackChanged(); |
|
590 } |
|
591 |
610 |
592 // -------------------------------------------------------------------------- |
611 // -------------------------------------------------------------------------- |
593 // CmPluginVpnNextLayerSelectDlg::LoadResourceL |
612 // CmPluginVpnNextLayerSelectDlg::LoadResourceL |
594 // -------------------------------------------------------------------------- |
613 // -------------------------------------------------------------------------- |
595 // |
614 // |
772 CleanupStack::PopAndDestroy( &cmDataArray ); |
788 CleanupStack::PopAndDestroy( &cmDataArray ); |
773 CleanupStack::PopAndDestroy( items ); |
789 CleanupStack::PopAndDestroy( items ); |
774 return retVal; |
790 return retVal; |
775 } |
791 } |
776 |
792 |
777 // -------------------------------------------------------------------------- |
|
778 // CmPluginVpnNextLayerSelectDlg::DisplayMenuL |
|
779 // -------------------------------------------------------------------------- |
|
780 // |
|
781 void CmPluginVpnNextLayerSelectDlg::DisplayMenuL() |
|
782 { |
|
783 iMenuBar->TryDisplayMenuBarL(); |
|
784 } |
|
785 |
|
786 // -------------------------------------------------------------------------- |
|
787 // CmPluginVpnNextLayerSelectDlg::HideMenu |
|
788 // -------------------------------------------------------------------------- |
|
789 // |
|
790 void CmPluginVpnNextLayerSelectDlg::HideMenu() |
|
791 { |
|
792 iMenuBar->StopDisplayingMenuBar(); |
|
793 } |
|
794 |
|
795 // -------------------------------------------------------------------------- |
|
796 // CmPluginVpnNextLayerSelectDlg::MenuShowing |
|
797 // -------------------------------------------------------------------------- |
|
798 // |
|
799 TBool CmPluginVpnNextLayerSelectDlg::MenuShowing() const |
|
800 { |
|
801 return iMenuBar->IsDisplayed(); |
|
802 } |
|
803 |
793 |
804 // -------------------------------------------------------------------------- |
794 // -------------------------------------------------------------------------- |
805 // CmPluginVpnNextLayerSelectDlg::GetHelpContext |
795 // CmPluginVpnNextLayerSelectDlg::GetHelpContext |
806 // -------------------------------------------------------------------------- |
796 // -------------------------------------------------------------------------- |
807 // |
797 // |