wlansecuritysettings/wlaneapsettingsui/EapPeap/ConfigUi/src/EapPeapUi.cpp
branchRCL_3
changeset 18 bad0cc58d154
parent 17 30e048a7b597
child 19 c74b3d9f6b9e
equal deleted inserted replaced
17:30e048a7b597 18:bad0cc58d154
     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 PEAP UI class
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 15 %
       
    20 */
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include "EapPeapUi.h"
       
    24 #include "EapTlsPeapUiConnection.h"
       
    25 #include "EapPeapUiView.h"
       
    26 #include <eappeapui.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, "eappeapui.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 // CEapPeapUi::CEapPeapUi
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 CEapPeapUi::CEapPeapUi( CEapTlsPeapUiConnection* aConnection, 
       
    69                         TIndexType aIndexType, 
       
    70                         TInt aIndex ) 
       
    71 : iConnection( aConnection ), 
       
    72   iIndexType( aIndexType ), 
       
    73   iIndex( aIndex ) 
       
    74     {
       
    75     }
       
    76 
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // CEapPeapUi::NewL
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 CEapPeapUi* CEapPeapUi::NewL( CEapTlsPeapUiConnection* aConnection, 
       
    83                               TIndexType aIndexType, 
       
    84                               TInt aIndex )
       
    85     {
       
    86     CEapPeapUi* self = 
       
    87                 new( ELeave ) CEapPeapUi( aConnection, aIndexType, aIndex );
       
    88     CleanupStack::PushL( self );
       
    89     self->ConstructL();
       
    90     CleanupStack::Pop( self );    
       
    91     return self;
       
    92     }
       
    93 
       
    94 
       
    95 // -----------------------------------------------------------------------------
       
    96 // CEapPeapUi::ConstructL
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 void CEapPeapUi::ConstructL()
       
   100     {
       
   101     }
       
   102 
       
   103 
       
   104 // -----------------------------------------------------------------------------
       
   105 // CEapPeapUi::~CEapPeapUi
       
   106 // -----------------------------------------------------------------------------
       
   107 //
       
   108 CEapPeapUi::~CEapPeapUi()
       
   109     {
       
   110     }
       
   111 
       
   112 
       
   113 // -----------------------------------------------------------------------------
       
   114 // CEapPeapUi::InvokeUiL
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 TInt CEapPeapUi::InvokeUiL()
       
   118     {
       
   119     TFileName fileName;
       
   120 
       
   121     fileName.Append( KDriveZ );
       
   122     fileName.Append( KDC_RESOURCE_FILES_DIR );
       
   123     fileName.Append( KResourceFileName );
       
   124 
       
   125     CCoeEnv* coeEnv = CCoeEnv::Static();
       
   126     BaflUtils::NearestLanguageFile( coeEnv->FsSession(), fileName );
       
   127 
       
   128     TResourceFileCleanupItem* item = new( ELeave ) TResourceFileCleanupItem;
       
   129 
       
   130     item->iCoeEnv = coeEnv;
       
   131     CleanupStack::PushL( TCleanupItem( CleanupResourceFile, item ) );
       
   132     item->iResourceFileOffset = coeEnv->AddResourceFileL( fileName );
       
   133 
       
   134     TInt buttonId;
       
   135     CEapPeapUiDialog* settingsDlg = new( ELeave ) CEapPeapUiDialog( 
       
   136                                 iConnection, iIndexType, iIndex, buttonId );
       
   137     settingsDlg->ConstructAndRunLD( R_PEAP_SETTING_DIALOG );
       
   138 
       
   139     CleanupStack::PopAndDestroy();  // For resource file
       
   140 
       
   141     return buttonId;
       
   142     }
       
   143 
       
   144 
       
   145 //  End of File