email/imum/Utils/Src/IMSWRadiobuttonPage.cpp
branchRCL_3
changeset 60 7fdbb852d323
parent 0 72b543305e3a
equal deleted inserted replaced
57:ebe688cedc25 60:7fdbb852d323
       
     1 /*
       
     2 * Copyright (c) 2006 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:  IMSWRadioButtonPage.cpp
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <aknnavide.h>                      // CAknNavigationDecorator
       
    22 #include <aknEditStateIndicator.h>
       
    23 #include <AknIndicatorContainer.h>
       
    24 #include <e32base.h>
       
    25 
       
    26 #include "IMSSettingsWizard.h"
       
    27 #include "IMSWRadiobuttonPage.h"
       
    28 #include "ImumUtilsLogging.h"
       
    29 
       
    30 // EXTERNAL DATA STRUCTURES
       
    31 // EXTERNAL FUNCTION PROTOTYPES
       
    32 // CONSTANTS
       
    33 // MACROS
       
    34 // LOCAL CONSTANTS AND MACROS
       
    35 // MODULE DATA STRUCTURES
       
    36 // LOCAL FUNCTION PROTOTYPES
       
    37 // FORWARD DECLARATIONS
       
    38 
       
    39 // ============================ MEMBER FUNCTIONS ===============================
       
    40 
       
    41 // ----------------------------------------------------------------------------
       
    42 // CIMSSettingsWizardRadioButtonPage::CIMSSettingsWizardRadioButtonPage()
       
    43 // ----------------------------------------------------------------------------
       
    44 //
       
    45 CIMSSettingsWizardRadioButtonPage::CIMSSettingsWizardRadioButtonPage(
       
    46     CIMSSettingsWizard& aWizard,
       
    47     TInt aResourceId,
       
    48     TInt& aCurrentIndex,
       
    49     const MDesCArray* aItemArray,
       
    50     TDesC& aPageText )
       
    51     :
       
    52     CAknRadioButtonSettingPage( aResourceId, aCurrentIndex, aItemArray ),
       
    53     iWizard( aWizard ),
       
    54     iPageText( aPageText ),
       
    55     iNaviPane( NULL ),
       
    56     iNaviDecorator( NULL )
       
    57     {
       
    58     IMUM_CONTEXT( CIMSSettingsWizardRadioButtonPage::CIMSSettingsWizardRadioButtonPage, 0, KLogUi );
       
    59 
       
    60     }
       
    61 
       
    62 // ----------------------------------------------------------------------------
       
    63 // CIMSSettingsWizardRadioButtonPage::ConstructL()
       
    64 // ----------------------------------------------------------------------------
       
    65 //
       
    66 void CIMSSettingsWizardRadioButtonPage::ConstructL()
       
    67     {
       
    68     IMUM_CONTEXT( CIMSSettingsWizardRadioButtonPage::ConstructL, 0, KLogUi );
       
    69 
       
    70     CAknRadioButtonSettingPage::ConstructL();
       
    71     }
       
    72 
       
    73 // ----------------------------------------------------------------------------
       
    74 // CIMSSettingsWizardRadioButtonPage::PostDisplayCheckL()
       
    75 // ----------------------------------------------------------------------------
       
    76 //
       
    77 TBool CIMSSettingsWizardRadioButtonPage::PostDisplayCheckL()
       
    78     {
       
    79     IMUM_CONTEXT( CIMSSettingsWizardRadioButtonPage::PostDisplayCheckL, 0, KLogUi );
       
    80 
       
    81     // Set the text to navipane
       
    82     UpdateNaviPaneL();
       
    83 
       
    84     // Reset popup
       
    85     iWizard.PostponePopup();
       
    86 
       
    87     return ETrue;
       
    88     }
       
    89 
       
    90 
       
    91 // ----------------------------------------------------------------------------
       
    92 // CIMSSettingsWizardRadioButtonPage::~CIMSSettingsWizardRadioButtonPage()
       
    93 // ----------------------------------------------------------------------------
       
    94 //
       
    95 CIMSSettingsWizardRadioButtonPage::~CIMSSettingsWizardRadioButtonPage()
       
    96     {
       
    97     IMUM_CONTEXT( CIMSSettingsWizardRadioButtonPage::~CIMSSettingsWizardRadioButtonPage, 0, KLogUi );
       
    98     IMUM_IN();
       
    99 
       
   100     // Remove the pages -text from the
       
   101     if ( iNaviPane && iNaviDecorator )
       
   102         {
       
   103         iNaviPane->Pop( iNaviDecorator );
       
   104         }
       
   105 
       
   106     delete iNaviDecorator;
       
   107     iNaviDecorator = NULL;
       
   108     iNaviPane = NULL;
       
   109 
       
   110     IMUM_OUT();
       
   111     }
       
   112 
       
   113 // ----------------------------------------------------------------------------
       
   114 // CIMSSettingsWizardRadioButtonPage::NewL()
       
   115 // ----------------------------------------------------------------------------
       
   116 //
       
   117 CIMSSettingsWizardRadioButtonPage* CIMSSettingsWizardRadioButtonPage::NewL(
       
   118     CIMSSettingsWizard& aWizard,
       
   119     TInt aResourceId,
       
   120     TInt& aCurrentIndex,
       
   121     const MDesCArray* aItemArray,
       
   122     TDesC& aPageText )
       
   123     {
       
   124     IMUM_STATIC_CONTEXT( CIMSSettingsWizardRadioButtonPage::NewL, 0, utils, KLogUi );
       
   125 
       
   126     CIMSSettingsWizardRadioButtonPage* self = NewLC(
       
   127         aWizard, aResourceId, aCurrentIndex, aItemArray, aPageText );
       
   128     CleanupStack::Pop( self );
       
   129 
       
   130     return self;
       
   131     }
       
   132 
       
   133 // ----------------------------------------------------------------------------
       
   134 // CIMSSettingsWizardRadioButtonPage::NewLC()
       
   135 // ----------------------------------------------------------------------------
       
   136 //
       
   137 CIMSSettingsWizardRadioButtonPage* CIMSSettingsWizardRadioButtonPage::NewLC(
       
   138     CIMSSettingsWizard& aWizard,
       
   139     TInt aResourceId,
       
   140     TInt& aCurrentIndex,
       
   141     const MDesCArray* aItemArray,
       
   142     TDesC& aPageText )
       
   143     {
       
   144     IMUM_STATIC_CONTEXT( CIMSSettingsWizardRadioButtonPage::NewLC, 0, utils, KLogUi );
       
   145 
       
   146     CIMSSettingsWizardRadioButtonPage* self =
       
   147         new ( ELeave ) CIMSSettingsWizardRadioButtonPage(
       
   148             aWizard, aResourceId, aCurrentIndex, aItemArray, aPageText );
       
   149     CleanupStack::PushL( self );
       
   150     self->ConstructL();
       
   151 
       
   152     return self;
       
   153     }
       
   154 
       
   155 // ----------------------------------------------------------------------------
       
   156 // CIMSSettingsWizardRadioButtonPage::ProcessCommandL()
       
   157 // ----------------------------------------------------------------------------
       
   158 //
       
   159 void CIMSSettingsWizardRadioButtonPage::ProcessCommandL( TInt aCommandId )
       
   160     {
       
   161     IMUM_CONTEXT( CIMSSettingsWizardRadioButtonPage::ProcessCommandL, 0, KLogUi );
       
   162     IMUM_IN();
       
   163 
       
   164     // Reset info popup
       
   165     iWizard.PostponePopup();
       
   166 
       
   167     switch( aCommandId )
       
   168         {
       
   169         case EAknSoftkeyCancel: // falltrough
       
   170         case EAknCmdExit:
       
   171             // Exit setting page (dialog)
       
   172             AttemptExitL( EFalse );
       
   173             // falltrough
       
   174         case EAknSoftkeyBack: // falltrough
       
   175         case EAknSoftkeyDone:
       
   176             // Move to prev/next wizard page or exit app
       
   177             iWizard.ProcessCommandL( aCommandId );
       
   178             break;
       
   179         case EAknSoftkeyOk:
       
   180         case EAknSoftkeySelect:
       
   181         	// Selection was made, so select the correct protocol
       
   182         	CAknRadioButtonSettingPage::SelectCurrentItemL();
       
   183         	break;
       
   184         default:
       
   185             // Process any other commands. Radio button settings page doesn't
       
   186             // have any though.
       
   187             CAknRadioButtonSettingPage::ProcessCommandL( aCommandId );
       
   188             break;
       
   189         }
       
   190 
       
   191     IMUM_OUT();
       
   192     }
       
   193 
       
   194 // ----------------------------------------------------------------------------
       
   195 // CIMSSettingsWizardRadioButtonPage::KeyPressedNextL()
       
   196 // ----------------------------------------------------------------------------
       
   197 //
       
   198 void CIMSSettingsWizardRadioButtonPage::KeyPressedNextL()
       
   199     {
       
   200     IMUM_CONTEXT( CIMSSettingsWizardRadioButtonPage::KeyPressedNextL, 0, KLogUi );
       
   201 
       
   202     AttemptExitL( ETrue );
       
   203     }
       
   204 
       
   205 // ----------------------------------------------------------------------------
       
   206 // CIMSSettingsWizardRadioButtonPage::KeyPressedBackL()
       
   207 // ----------------------------------------------------------------------------
       
   208 //
       
   209 void CIMSSettingsWizardRadioButtonPage::KeyPressedBackL()
       
   210     {
       
   211     IMUM_CONTEXT( CIMSSettingsWizardRadioButtonPage::KeyPressedBackL, 0, KLogUi );
       
   212 
       
   213     AttemptExitL( EFalse );
       
   214     }
       
   215 
       
   216 // ----------------------------------------------------------------------------
       
   217 // CIMSSettingsWizardRadioButtonPage::KeyPressedSelectL()
       
   218 // ----------------------------------------------------------------------------
       
   219 //
       
   220 void CIMSSettingsWizardRadioButtonPage::KeyPressedSelectL()
       
   221     {
       
   222     IMUM_CONTEXT( CIMSSettingsWizardRadioButtonPage::KeyPressedSelectL, 0, KLogUi );
       
   223 
       
   224     SelectCurrentItemL();
       
   225     }
       
   226 
       
   227 // ----------------------------------------------------------------------------
       
   228 // CIMSSettingsWizardRadioButtonPage::UpdateNaviPaneL()
       
   229 // ----------------------------------------------------------------------------
       
   230 //
       
   231 void CIMSSettingsWizardRadioButtonPage::UpdateNaviPaneL()
       
   232     {
       
   233     IMUM_CONTEXT( CIMSSettingsWizardRadioButtonPage::UpdateNaviPaneL, 0, KLogUi );
       
   234 
       
   235     CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane();
       
   236     iNaviPane = static_cast<CAknNavigationControlContainer*>(
       
   237         sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
       
   238     iNaviDecorator = iNaviPane->CreateNavigationLabelL();
       
   239     iNaviPane->PushL( *iNaviDecorator );
       
   240 
       
   241     // Finally catch the label for showing the text
       
   242     CAknNaviLabel* naviLabel =
       
   243         static_cast<CAknNaviLabel*>( iNaviDecorator->DecoratedControl() );
       
   244     naviLabel->SetTextL( iPageText );
       
   245     }
       
   246 
       
   247 
       
   248 // -----------------------------------------------------------------------------
       
   249 // CIMSSettingsWizardRadioButtonPage::OfferKeyEventL()
       
   250 // This is needed to postpone popup time
       
   251 // when user is writing. Popup should apper
       
   252 // only when user has been "idle" for some time.
       
   253 // -----------------------------------------------------------------------------
       
   254 //
       
   255 TKeyResponse CIMSSettingsWizardRadioButtonPage::OfferKeyEventL(
       
   256     const TKeyEvent& aKeyEvent,
       
   257     TEventCode aType )
       
   258     {
       
   259     IMUM_CONTEXT( CIMSSettingsWizardRadioButtonPage::OfferKeyEventL, 0, KLogUi );
       
   260     IMUM_IN();
       
   261 
       
   262     if ( aType == EEventKeyDown )
       
   263         {
       
   264         iWizard.PostponePopup();
       
   265         }
       
   266 
       
   267     IMUM_OUT();
       
   268     return CAknRadioButtonSettingPage::OfferKeyEventL( aKeyEvent, aType );
       
   269     }
       
   270 
       
   271 
       
   272 // -----------------------------------------------------------------------------
       
   273 // CIMSSettingsWizardRadioButtonPage::HandleListBoxEventL
       
   274 // Handles item selection
       
   275 // -----------------------------------------------------------------------------
       
   276 //
       
   277 void CIMSSettingsWizardRadioButtonPage::HandleListBoxEventL(
       
   278 		CEikListBox* /*aListBox*/,
       
   279         MEikListBoxObserver::TListBoxEvent aEventType )
       
   280 	{
       
   281     IMUM_CONTEXT( CIMSSettingsWizardRadioButtonPage::HandleListBoxEventL, 0, KLogUi );
       
   282     IMUM_IN();
       
   283 
       
   284 	switch( aEventType )
       
   285 		{
       
   286 		case EEventEnterKeyPressed:
       
   287 		case EEventItemClicked:
       
   288 			// Selection was made, so select the correct protocol
       
   289         	CAknRadioButtonSettingPage::SelectCurrentItemL();
       
   290 			break;
       
   291 		case EEventItemDoubleClicked:
       
   292 			{
       
   293 			// Item was selected with a double click
       
   294 			// and Wizard moves to next page
       
   295 			iWizard.ProcessCommandL( EAknSoftkeyDone );
       
   296 			break;
       
   297 			}
       
   298 		default:
       
   299 			// Do nothing
       
   300 			break;
       
   301 		}
       
   302 
       
   303 	IMUM_OUT();
       
   304 	}
       
   305 
       
   306 
       
   307 #ifdef RD_SCALABLE_UI_V2
       
   308 // -----------------------------------------------------------------------------
       
   309 // CIMSSettingsWizardRadioButtonPage::HandlePointerEventL()
       
   310 // This is needed to postpone popup time
       
   311 // when user is tapping with stylus. Popup should apper
       
   312 // only when user has been "idle" for some time.
       
   313 // -----------------------------------------------------------------------------
       
   314 //
       
   315 void CIMSSettingsWizardRadioButtonPage::HandlePointerEventL(
       
   316     const TPointerEvent& aPointerEvent)
       
   317     {
       
   318     IMUM_CONTEXT( CIMSSettingsWizardRadioButtonPage::HandlePointerEventL, 0, KLogUi );
       
   319     IMUM_IN();
       
   320 
       
   321     if( aPointerEvent.iType == TPointerEvent::EButton1Down )
       
   322         {
       
   323         iWizard.PostponePopup();
       
   324         }
       
   325 
       
   326     CAknRadioButtonSettingPage::HandlePointerEventL( aPointerEvent );
       
   327     IMUM_OUT();
       
   328     }
       
   329 #endif  //RD_SCALABLE_UI_V2
       
   330 
       
   331 //  End of File