profilesservices/ProfileEngine/WrapperSrc/CProEngEngineImpl.cpp
branchRCL_3
changeset 24 8ee96d21d9bf
parent 23 8bda91a87a00
child 25 7e0eff37aedb
equal deleted inserted replaced
23:8bda91a87a00 24:8ee96d21d9bf
    17 
    17 
    18 
    18 
    19 
    19 
    20 // INCLUDE FILES
    20 // INCLUDE FILES
    21 #include    "CProEngEngineImpl.h"
    21 #include    "CProEngEngineImpl.h"
       
    22 #include    "CProEngProfileImpl.h"
       
    23 #include    "CProEngToneHandler.h"
       
    24 #include    "CProEngProfileNameArrayImpl.h"
    22 #include    <f32file.h>
    25 #include    <f32file.h>
    23 #include    <MProEngProfile.h>
    26 #include    <MProEngProfile.h>
    24 #include    <MProEngProfileNameArray.h>
    27 #include    <MProEngProfileNameArray.h>
    25 #include    <MProfileEngineExtended.h>
    28 #include    <MProfileEngineExtended.h>
    26 #include    <ProfileEngineConstants.h>
    29 #include    <ProfileEngineConstants.h>
    27 #include    "CProEngProfileImpl.h"
    30 
    28 #include    "CProEngToneHandler.h"
       
    29 #include    "CProEngProfileNameArrayImpl.h"
       
    30 #include    <proengwrapper.rsg>
       
    31 #include    <ConeResLoader.h>
       
    32 #include 	<startupdomainpskeys.h>
       
    33 #include    <StringLoader.h>
       
    34 #include    <AknQueryDialog.h>
       
    35 #include    <aknnotewrappers.h>
       
    36 #include    <barsc.h>  // RResourceFile
       
    37 #include    <bautils.h> // BaflUtils
       
    38 
       
    39 namespace
       
    40 	{
       
    41 	// The filename of the resource file
       
    42 	_LIT( KProEngResourceFileName, "Z:ProEngWrapper.RSC" );
       
    43 	}
       
    44 // ============================ MEMBER FUNCTIONS ===============================
    31 // ============================ MEMBER FUNCTIONS ===============================
    45 
    32 
    46 // -----------------------------------------------------------------------------
    33 // -----------------------------------------------------------------------------
    47 // CProEngEngineImpl::CProEngEngineImpl
    34 // CProEngEngineImpl::CProEngEngineImpl
    48 // -----------------------------------------------------------------------------
    35 // -----------------------------------------------------------------------------
   165 MProEngProfile* CProEngEngineImpl::ActiveProfileL()
   152 MProEngProfile* CProEngEngineImpl::ActiveProfileL()
   166     {
   153     {
   167     MProEngProfile* profileWrapper = ActiveProfileLC();
   154     MProEngProfile* profileWrapper = ActiveProfileLC();
   168 
   155 
   169     CleanupStack::Pop(); // profileWrapper
   156     CleanupStack::Pop(); // profileWrapper
   170 
   157     
   171     return profileWrapper;
   158     return profileWrapper;
   172     }
   159     }
   173 
   160 
   174 // -----------------------------------------------------------------------------
   161 // -----------------------------------------------------------------------------
   175 // CProEngEngineImpl::ActiveProfileId
   162 // CProEngEngineImpl::ActiveProfileId
   201 // CProEngEngineImpl::SetActiveProfileL
   188 // CProEngEngineImpl::SetActiveProfileL
   202 // -----------------------------------------------------------------------------
   189 // -----------------------------------------------------------------------------
   203 //
   190 //
   204 void CProEngEngineImpl::SetActiveProfileL( TInt aId )
   191 void CProEngEngineImpl::SetActiveProfileL( TInt aId )
   205     {
   192     {
   206     if ( //  active profile is Off-line
       
   207         ( iProfileEngine->ActiveProfileId() == EProfileOffLineId ) &&
       
   208         // and currently focused profile is not Off-line
       
   209         ( aId != EProfileOffLineId ) )
       
   210         {
       
   211 
       
   212         TInt simCStatus( ESimNotPresent );
       
   213         RProperty simStatus;
       
   214         CleanupClosePushL( simStatus );
       
   215 		
       
   216         User::LeaveIfError( simStatus.Attach( KPSUidStartup, KPSSimStatus ) );
       
   217         User::LeaveIfError( simStatus.Get( simCStatus ) );
       
   218         CleanupStack::PopAndDestroy();//simStatus
       
   219 
       
   220         // SIM card does not exist.
       
   221         if ( simCStatus == ESimNotPresent )
       
   222             {				
       
   223             TParse* fp = new ( ELeave ) TParse();
       
   224             fp->Set( KProEngResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL );
       
   225             TFileName localizedFileName( fp->FullName() );
       
   226             delete fp;
       
   227 			
       
   228             RFs fs;
       
   229             User::LeaveIfError( fs.Connect() );
       
   230             CleanupClosePushL( fs );	
       
   231 			
       
   232             BaflUtils::NearestLanguageFile( fs, localizedFileName );
       
   233 			
       
   234             RConeResourceLoader resourceLoader( *CCoeEnv::Static() );
       
   235             CleanupClosePushL( resourceLoader );
       
   236 			
       
   237             TRAP_IGNORE( resourceLoader.OpenL( localizedFileName ) );
       
   238 			
       
   239             HBufC* infoNoteText = StringLoader::LoadLC(
       
   240 					R_PROFILE_TEXT_INSERT_SIM );
       
   241             CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue );
       
   242             note->ExecuteLD( *infoNoteText );
       
   243 			
       
   244             CleanupStack::PopAndDestroy( infoNoteText );
       
   245             CleanupStack::PopAndDestroy( 2 ); //resourceLoader&fs
       
   246 			
       
   247             return;
       
   248             }	
       
   249         }
       
   250     iProfileEngine->SetActiveProfileL( aId );
   193     iProfileEngine->SetActiveProfileL( aId );
   251     }
   194     }
   252 
   195 
   253 // -----------------------------------------------------------------------------
   196 // -----------------------------------------------------------------------------
   254 // CProEngEngineImpl::ProfileLC
   197 // CProEngEngineImpl::ProfileLC