wlanutilities/wlansettingsui/src/wlansettingsuiimpl.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 CWlanSettingsUiImpl.   
       
    16 *      
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 
       
    23 #include <eikenv.h>
       
    24 #include <bautils.h>
       
    25 #include <centralrepository.h>
       
    26 #include <data_caging_path_literals.hrh>
       
    27 #include <wlanmgmtclient.h>
       
    28 #include <internetconnectivitycrkeys.h>
       
    29 #include <f32file.h>
       
    30 #include <mpmconnectscreenid.h>
       
    31 #include <wlandevicesettingsinternalcrkeys.h>
       
    32 
       
    33 #include "wlansettingsuiimpl.h"
       
    34 #include "wlansettingsuimainviewdlg.h"
       
    35 #include "wlansettingsuimodel.h"
       
    36 #include "wlansettingsuistatuspane.h"
       
    37 
       
    38 // CONSTANTS
       
    39 
       
    40 /// WLAN Settings UI resource file path.
       
    41 _LIT( KWlanSettingsUiResourceFile, "z:wlansettingsui.rsc" );
       
    42 
       
    43 // ================= MEMBER FUNCTIONS =======================
       
    44 
       
    45 // ---------------------------------------------------------
       
    46 // CWlanSettingsUiImpl::NewLC
       
    47 // ---------------------------------------------------------
       
    48 //
       
    49 CWlanSettingsUiImpl* CWlanSettingsUiImpl::NewL( CEikonEnv& aEikEnv )
       
    50     {
       
    51     CWlanSettingsUiImpl* ui = new ( ELeave ) CWlanSettingsUiImpl( aEikEnv );
       
    52     CleanupStack::PushL( ui );
       
    53     ui->ConstructL();
       
    54     CleanupStack::Pop( ui ); 
       
    55     return ui;    
       
    56     }
       
    57 
       
    58 // ---------------------------------------------------------
       
    59 // CWlanSettingsUiImpl::~CWlanSettingsUiImpl
       
    60 // ---------------------------------------------------------
       
    61 //
       
    62 CWlanSettingsUiImpl::~CWlanSettingsUiImpl()
       
    63     {    
       
    64     iResources.Close();
       
    65     
       
    66 #ifndef __WINS__
       
    67     delete iWlanMgmtClient;
       
    68 #endif
       
    69     delete iRepository;
       
    70     }
       
    71 
       
    72 // ---------------------------------------------------------
       
    73 // CWlanSettingsUiImpl::CWlanSettingsUiImpl
       
    74 // ---------------------------------------------------------
       
    75 //
       
    76 CWlanSettingsUiImpl::CWlanSettingsUiImpl( CEikonEnv& aEikEnv )
       
    77 : iEikEnv( &aEikEnv ), 
       
    78   iResources( *CCoeEnv::Static() ) 
       
    79     {
       
    80     }
       
    81 
       
    82 // ---------------------------------------------------------
       
    83 // CWlanSettingsUiImpl::ConstructL
       
    84 // ---------------------------------------------------------
       
    85 //
       
    86 void CWlanSettingsUiImpl::ConstructL()
       
    87     {
       
    88     RFs fsSession;
       
    89     User::LeaveIfError( fsSession.Connect() );
       
    90 
       
    91     // Find the resource file:
       
    92     TParse parse;
       
    93     parse.Set( KWlanSettingsUiResourceFile, &KDC_RESOURCE_FILES_DIR, NULL );
       
    94     TFileName fileName( parse.FullName() );
       
    95 
       
    96     // Get language of resource file:
       
    97     BaflUtils::NearestLanguageFile( fsSession, fileName );
       
    98 
       
    99     // Open resource file:
       
   100     iResources.OpenL( fileName );
       
   101 
       
   102     // If leave occurs before this, close is called automatically when the
       
   103     // thread exits.
       
   104     fsSession.Close();
       
   105 
       
   106 
       
   107 #ifndef __WINS__
       
   108     iWlanMgmtClient = CWlanMgmtClient::NewL();
       
   109 #endif
       
   110     iRepository = CRepository::NewL( KCRUidInternetConnectivitySettings );
       
   111     }
       
   112 
       
   113 // ---------------------------------------------------------
       
   114 // CWlanSettingsUiImpl::RunSettingsL
       
   115 // ---------------------------------------------------------
       
   116 //
       
   117 void CWlanSettingsUiImpl::RunSettingsL( CMDBSession* aSession )
       
   118     {
       
   119     CWlanSettingsUiModel* model = CWlanSettingsUiModel::NewL( 
       
   120                                 aSession, 
       
   121                                 iWlanMgmtClient,
       
   122                                 iRepository);
       
   123     
       
   124     CleanupStack::PushL( model );
       
   125     
       
   126     model->LoadSettingsL();
       
   127     CWlanSettingsUiStatusPane* statusPane =
       
   128         CWlanSettingsUiStatusPane::NewLC( iEikEnv, R_WLAN_SETTINGS_UI_TITLE );
       
   129     CWlanSettingsUiMainViewDlg* dlg =
       
   130         new ( ELeave ) CWlanSettingsUiMainViewDlg( model );
       
   131     dlg->ExecuteLD();
       
   132     
       
   133     CleanupStack::PopAndDestroy( statusPane );
       
   134     CleanupStack::PopAndDestroy( model );
       
   135     }
       
   136