codhandler/codui/src/CodUiResource.cpp
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     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 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 class CCodUiResource.   
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 
       
    21 #include <eikenv.h>
       
    22 #include <bautils.h>
       
    23 #include <data_caging_path_literals.hrh>
       
    24 
       
    25 #include "CodUiResource.h"
       
    26 #include "CodLogger.h"
       
    27 
       
    28 // CONSTANTS
       
    29 
       
    30 /// CodUi resource file name.
       
    31 _LIT( KCodUiResourceFile, "CodUi.rsc" );
       
    32 
       
    33 // ================= MEMBER FUNCTIONS =======================
       
    34 
       
    35 // ---------------------------------------------------------
       
    36 // CCodUiResource::NewL
       
    37 // ---------------------------------------------------------
       
    38 //
       
    39 CCodUiResource* CCodUiResource::NewL( CEikonEnv& aEikEnv )
       
    40     {
       
    41     CCodUiResource* ui = new ( ELeave ) CCodUiResource( aEikEnv );
       
    42     CleanupStack::PushL( ui );
       
    43     ui->ConstructL();
       
    44     CleanupStack::Pop( ui ); 
       
    45     return ui;    
       
    46     }
       
    47 
       
    48 // ---------------------------------------------------------
       
    49 // CCodUiResource::~CCodUiResource
       
    50 // ---------------------------------------------------------
       
    51 //
       
    52 CCodUiResource::~CCodUiResource()
       
    53     {    
       
    54     CLOG(( 2, _L("*** -> CCodUiResource::~CCodUiResource") ));
       
    55     if ( iResourceOffset )
       
    56         {
       
    57         iEikEnv->DeleteResourceFile( iResourceOffset );
       
    58         }
       
    59     CLOG(( 2, _L("*** <- CCodUiResource::~CCodUiResource") ));
       
    60     }
       
    61 
       
    62 // ---------------------------------------------------------
       
    63 // CCodUiResource::CCodUiResource
       
    64 // ---------------------------------------------------------
       
    65 //
       
    66 CCodUiResource::CCodUiResource( CEikonEnv& aEikEnv )
       
    67 : iEikEnv( &aEikEnv )
       
    68     {
       
    69     CLOG(( 2, _L("*** CCodUiResource::CCodUiResource") ));
       
    70     }
       
    71 
       
    72 // ---------------------------------------------------------
       
    73 // CCodUiResource::ConstructL
       
    74 // ---------------------------------------------------------
       
    75 //
       
    76 void CCodUiResource::ConstructL()
       
    77     {
       
    78     TFileName resourceFile;
       
    79     resourceFile.Append( TDriveUnit( EDriveZ ).Name() );
       
    80     resourceFile.Append( KDC_RESOURCE_FILES_DIR );
       
    81     resourceFile.Append( KCodUiResourceFile );
       
    82     BaflUtils::NearestLanguageFile( iEikEnv->FsSession(), resourceFile );
       
    83     iResourceOffset = iEikEnv->AddResourceFileL( resourceFile );
       
    84     }