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