profilesservices/ProfileEngine/WrapperSrc/CProEngEngineImpl.cpp
branchRCL_3
changeset 25 7e0eff37aedb
parent 24 8ee96d21d9bf
equal deleted inserted replaced
24:8ee96d21d9bf 25:7e0eff37aedb
    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"
       
    25 #include    <f32file.h>
    22 #include    <f32file.h>
    26 #include    <MProEngProfile.h>
    23 #include    <MProEngProfile.h>
    27 #include    <MProEngProfileNameArray.h>
    24 #include    <MProEngProfileNameArray.h>
    28 #include    <MProfileEngineExtended.h>
    25 #include    <MProfileEngineExtended.h>
    29 #include    <ProfileEngineConstants.h>
    26 #include    <ProfileEngineConstants.h>
    30 
    27 #include    "CProEngProfileImpl.h"
       
    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 	}
    31 // ============================ MEMBER FUNCTIONS ===============================
    44 // ============================ MEMBER FUNCTIONS ===============================
    32 
    45 
    33 // -----------------------------------------------------------------------------
    46 // -----------------------------------------------------------------------------
    34 // CProEngEngineImpl::CProEngEngineImpl
    47 // CProEngEngineImpl::CProEngEngineImpl
    35 // -----------------------------------------------------------------------------
    48 // -----------------------------------------------------------------------------
   152 MProEngProfile* CProEngEngineImpl::ActiveProfileL()
   165 MProEngProfile* CProEngEngineImpl::ActiveProfileL()
   153     {
   166     {
   154     MProEngProfile* profileWrapper = ActiveProfileLC();
   167     MProEngProfile* profileWrapper = ActiveProfileLC();
   155 
   168 
   156     CleanupStack::Pop(); // profileWrapper
   169     CleanupStack::Pop(); // profileWrapper
   157     
   170 
   158     return profileWrapper;
   171     return profileWrapper;
   159     }
   172     }
   160 
   173 
   161 // -----------------------------------------------------------------------------
   174 // -----------------------------------------------------------------------------
   162 // CProEngEngineImpl::ActiveProfileId
   175 // CProEngEngineImpl::ActiveProfileId
   188 // CProEngEngineImpl::SetActiveProfileL
   201 // CProEngEngineImpl::SetActiveProfileL
   189 // -----------------------------------------------------------------------------
   202 // -----------------------------------------------------------------------------
   190 //
   203 //
   191 void CProEngEngineImpl::SetActiveProfileL( TInt aId )
   204 void CProEngEngineImpl::SetActiveProfileL( TInt aId )
   192     {
   205     {
       
   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         }
   193     iProfileEngine->SetActiveProfileL( aId );
   250     iProfileEngine->SetActiveProfileL( aId );
   194     }
   251     }
   195 
   252 
   196 // -----------------------------------------------------------------------------
   253 // -----------------------------------------------------------------------------
   197 // CProEngEngineImpl::ProfileLC
   254 // CProEngEngineImpl::ProfileLC