wlansecuritysettings/wlaneapsettingsui/EapMschapv2/ConfigUi/src/EapMschapv2Ui.cpp
branchRCL_3
changeset 46 c74b3d9f6b9e
equal deleted inserted replaced
45:bad0cc58d154 46:c74b3d9f6b9e
       
     1 /*
       
     2 * Copyright (c) 2001-2010 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 the License "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: Implementation of EAP MsChapv2 UI class
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 16 %
       
    20 */
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include "EapMschapv2Ui.h"
       
    24 #include <EapMsChapV2UiConnection.h>
       
    25 #include "EapMschapv2UiView.h"
       
    26 #include <eapmschapv2ui.rsg>
       
    27 #include <bautils.h>
       
    28 #include <coemain.h>
       
    29 #include <aknnotewrappers.h>
       
    30 #include <data_caging_path_literals.hrh>
       
    31 
       
    32 
       
    33 // CONSTANTS
       
    34 _LIT( KDriveZ, "z:" );                               // ROM folder
       
    35 _LIT( KResourceFileName, "eapmschapv2ui.rsc" );
       
    36 
       
    37 
       
    38 // CLASS DECLARATION
       
    39 class TResourceFileCleanupItem
       
    40     {
       
    41     public:
       
    42         CCoeEnv* iCoeEnv;
       
    43         TInt iResourceFileOffset;
       
    44     }; 
       
    45 
       
    46 
       
    47 // ============================= LOCAL FUNCTIONS ===============================
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // CleanupResourceFile
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 static void CleanupResourceFile( TAny* aObject )
       
    54     {
       
    55     TResourceFileCleanupItem* item = 
       
    56                         REINTERPRET_CAST( TResourceFileCleanupItem*, aObject );
       
    57     item->iCoeEnv->DeleteResourceFile( item->iResourceFileOffset );
       
    58     delete item;
       
    59     }
       
    60 
       
    61 
       
    62 // ============================ MEMBER FUNCTIONS ===============================
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CEapMsChapV2Ui::CEapMsChapV2Ui
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 CEapMsChapV2Ui::CEapMsChapV2Ui( CEapMsChapV2UiConnection* aConnection ) 
       
    69 : iConnection( aConnection )
       
    70     {
       
    71     }
       
    72 
       
    73 
       
    74 // -----------------------------------------------------------------------------
       
    75 // CEapMsChapV2Ui::NewL
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 CEapMsChapV2Ui* CEapMsChapV2Ui::NewL( CEapMsChapV2UiConnection* aConnection )
       
    79     {
       
    80     CEapMsChapV2Ui* self = new ( ELeave ) CEapMsChapV2Ui( aConnection );
       
    81     CleanupStack::PushL( self );
       
    82     self->ConstructL();
       
    83     CleanupStack::Pop( self );    
       
    84     return self;
       
    85     }
       
    86 
       
    87 
       
    88 // -----------------------------------------------------------------------------
       
    89 // CEapMsChapV2Ui::ConstructL
       
    90 // -----------------------------------------------------------------------------
       
    91 //
       
    92 void CEapMsChapV2Ui::ConstructL()
       
    93     {
       
    94     }
       
    95 
       
    96 
       
    97 // -----------------------------------------------------------------------------
       
    98 // CEapMsChapV2Ui::~CEapMsChapV2Ui
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 CEapMsChapV2Ui::~CEapMsChapV2Ui()
       
   102     {
       
   103     }
       
   104 
       
   105 
       
   106 // -----------------------------------------------------------------------------
       
   107 // CEapMsChapV2Ui::InvokeUiL
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 TInt CEapMsChapV2Ui::InvokeUiL()
       
   111     {
       
   112     TFileName fileName;
       
   113 
       
   114     fileName.Append( KDriveZ );
       
   115     fileName.Append( KDC_RESOURCE_FILES_DIR );
       
   116     fileName.Append( KResourceFileName );
       
   117 
       
   118     CCoeEnv* coeEnv = CCoeEnv::Static();
       
   119     BaflUtils::NearestLanguageFile( coeEnv->FsSession(), fileName );
       
   120 
       
   121     TResourceFileCleanupItem* item = new( ELeave ) TResourceFileCleanupItem;
       
   122 
       
   123     item->iCoeEnv = coeEnv;
       
   124     CleanupStack::PushL( TCleanupItem( CleanupResourceFile, item ) );
       
   125     item->iResourceFileOffset = coeEnv->AddResourceFileL( fileName );
       
   126 
       
   127     TInt buttonId;
       
   128     CEapMsChapV2UiDialog* settingsDlg = new( ELeave ) CEapMsChapV2UiDialog(
       
   129                                                     iConnection, buttonId );
       
   130     settingsDlg->ConstructAndRunLD( R_MSCHAPV2_SETTING_DIALOG );
       
   131 
       
   132     CleanupStack::PopAndDestroy();  // For resource file
       
   133 
       
   134     return buttonId;
       
   135     }
       
   136 
       
   137 //  End of File