wlanutilities/wlansettingsui/src/wlansettingsuidlg.cpp
branchRCL_3
changeset 24 63be7eb3fc78
parent 23 b852595f5cbe
child 25 f28ada11abbf
equal deleted inserted replaced
23:b852595f5cbe 24:63be7eb3fc78
     1 /*
       
     2 * Copyright (c) 2004 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: 
       
    15 *      Implementation of class CWlanSettingsUiDlg.   
       
    16 *      
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 
       
    23 #include "wlansettingsuidlg.h"
       
    24 #include "wlansettingsuisettingitemlist.h"
       
    25 #include "wlansettingsuipanic.h"
       
    26 #include "wlansettingsui.hrh"
       
    27 
       
    28 #include <aknappui.h>
       
    29 #include <featmgr.h>
       
    30 
       
    31 #include <hlplch.h>
       
    32 
       
    33 // ================= MEMBER FUNCTIONS =======================
       
    34 
       
    35 // ---------------------------------------------------------
       
    36 // CWlanSettingsUiDlg::ExecuteLD
       
    37 // ---------------------------------------------------------
       
    38 //
       
    39 TInt CWlanSettingsUiDlg::ExecuteLD()
       
    40     {
       
    41     CleanupStack::PushL( this );
       
    42     ConstructL( MenuBarResourceId() );
       
    43     CleanupStack::Pop( this );
       
    44     return CAknDialog::ExecuteLD( DialogResourceId() );
       
    45     }
       
    46 
       
    47 // ---------------------------------------------------------
       
    48 // CWlanSettingsUiDlg::CreateCustomControlL
       
    49 // ---------------------------------------------------------
       
    50 //
       
    51 SEikControlInfo CWlanSettingsUiDlg::CreateCustomControlL( TInt aControlType )
       
    52     {
       
    53     SEikControlInfo controlInfo;
       
    54     controlInfo.iControl = NULL;
       
    55     controlInfo.iTrailerTextId = 0;
       
    56     controlInfo.iFlags = 0;
       
    57     switch ( aControlType )
       
    58         {
       
    59         case EWlanSettingsUiSettingItemList:
       
    60             {
       
    61             controlInfo.iControl = new (ELeave) CWlanSettingsUiSettingItemList(
       
    62                     iModel );
       
    63             break;
       
    64             }
       
    65 
       
    66         default:
       
    67             {
       
    68             __ASSERT_DEBUG( EFalse, \
       
    69                 WlanSettingsUiPanic( EWlanSettingsUiBadControl ) );
       
    70             break;
       
    71             }
       
    72         }
       
    73     return controlInfo;
       
    74     }
       
    75 
       
    76 // ---------------------------------------------------------
       
    77 // CWlanSettingsUiDlg::ProcessCommandL
       
    78 // ---------------------------------------------------------
       
    79 //
       
    80 void CWlanSettingsUiDlg::ProcessCommandL( TInt aCommandId )
       
    81     {
       
    82     if ( MenuShowing() ) 
       
    83         {
       
    84         HideMenu();
       
    85         }
       
    86 
       
    87     switch( aCommandId )
       
    88         {
       
    89         case EWlanSettingsUiCmdChange: 
       
    90             {
       
    91             SettingItemList().EditCurrentItemL( ETrue );
       
    92             break;
       
    93             }
       
    94             
       
    95         case EAknSoftkeyChange:
       
    96             {
       
    97             SettingItemList().EditCurrentItemL( EFalse );
       
    98             break;
       
    99             }
       
   100 
       
   101         case EAknSoftkeyBack:
       
   102             {
       
   103             TryExitL( aCommandId );
       
   104             break;
       
   105             }
       
   106             
       
   107         case EAknCmdHelp:
       
   108             {
       
   109             if( IsHelpSupported() )
       
   110                 {
       
   111                 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
       
   112                     iEikonEnv->EikAppUi()->AppHelpContextL() );
       
   113                 }
       
   114             break;
       
   115             }
       
   116 
       
   117         case EAknCmdExit:
       
   118         case EEikCmdExit:
       
   119             {
       
   120             ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->
       
   121                                            ProcessCommandL( aCommandId );
       
   122             break;
       
   123             }
       
   124 
       
   125         default:
       
   126             {
       
   127             CAknDialog::ProcessCommandL( aCommandId );
       
   128             }
       
   129         }
       
   130     }
       
   131   
       
   132 // ---------------------------------------------------------
       
   133 // CWlanSettingsUiDlg::OkToExitL
       
   134 // ---------------------------------------------------------
       
   135 //  
       
   136 TBool CWlanSettingsUiDlg::OkToExitL( TInt aButtonId )
       
   137     {
       
   138     if ( aButtonId == EAknSoftkeyChange )
       
   139         {
       
   140         ProcessCommandL( aButtonId );
       
   141         return EFalse;
       
   142         }
       
   143         
       
   144     return CAknDialog::OkToExitL( aButtonId );  
       
   145     }
       
   146     
       
   147 // ---------------------------------------------------------
       
   148 // CWlanSettingsUiDlg::SettingItemList
       
   149 // ---------------------------------------------------------
       
   150 //
       
   151 CWlanSettingsUiSettingItemList& CWlanSettingsUiDlg::SettingItemList() const
       
   152     {
       
   153     return *( STATIC_CAST( CWlanSettingsUiSettingItemList*, \
       
   154         Control( EWlanSettingsUiDlgSettingList ) ) );
       
   155     }
       
   156 
       
   157 // ---------------------------------------------------------
       
   158 // CWlanSettingsUiDlg::IsHelpSupported
       
   159 // ---------------------------------------------------------
       
   160 //
       
   161 TBool CWlanSettingsUiDlg::IsHelpSupported()
       
   162     {
       
   163     TBool isHelpSupported = EFalse;
       
   164     
       
   165     TRAPD( error, FeatureManager::InitializeLibL() );
       
   166     
       
   167     if( !error )
       
   168         {
       
   169         isHelpSupported = 
       
   170             FeatureManager::FeatureSupported( KFeatureIdHelp );
       
   171         
       
   172         FeatureManager::UnInitializeLib();
       
   173         }
       
   174     
       
   175     return isHelpSupported;
       
   176     }