diff -r 854ebc17f64b -r 3b67655da2cc profilesservices/ProfileEngine/WrapperSrc/CProEngEngineImpl.cpp --- a/profilesservices/ProfileEngine/WrapperSrc/CProEngEngineImpl.cpp Wed Jun 09 10:00:07 2010 +0300 +++ b/profilesservices/ProfileEngine/WrapperSrc/CProEngEngineImpl.cpp Mon Jun 21 15:59:17 2010 +0300 @@ -27,7 +27,20 @@ #include "CProEngProfileImpl.h" #include "CProEngToneHandler.h" #include "CProEngProfileNameArrayImpl.h" +#include +#include +#include +#include +#include +#include +#include // RResourceFile +#include // BaflUtils +namespace + { + // The filename of the resource file + _LIT( KProEngResourceFileName, "Z:ProEngWrapper.RSC" ); + } // ============================ MEMBER FUNCTIONS =============================== // ----------------------------------------------------------------------------- @@ -154,7 +167,7 @@ MProEngProfile* profileWrapper = ActiveProfileLC(); CleanupStack::Pop(); // profileWrapper - + return profileWrapper; } @@ -190,6 +203,50 @@ // void CProEngEngineImpl::SetActiveProfileL( TInt aId ) { + if ( // active profile is Off-line + ( iProfileEngine->ActiveProfileId() == EProfileOffLineId ) && + // and currently focused profile is not Off-line + ( aId != EProfileOffLineId ) ) + { + + TInt simCStatus( ESimNotPresent ); + RProperty simStatus; + CleanupClosePushL( simStatus ); + + User::LeaveIfError( simStatus.Attach( KPSUidStartup, KPSSimStatus ) ); + User::LeaveIfError( simStatus.Get( simCStatus ) ); + CleanupStack::PopAndDestroy();//simStatus + + // SIM card does not exist. + if ( simCStatus == ESimNotPresent ) + { + TParse* fp = new ( ELeave ) TParse(); + fp->Set( KProEngResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL ); + TFileName localizedFileName( fp->FullName() ); + delete fp; + + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + + BaflUtils::NearestLanguageFile( fs, localizedFileName ); + + RConeResourceLoader resourceLoader( *CCoeEnv::Static() ); + CleanupClosePushL( resourceLoader ); + + TRAP_IGNORE( resourceLoader.OpenL( localizedFileName ) ); + + HBufC* infoNoteText = StringLoader::LoadLC( + R_PROFILE_TEXT_INSERT_SIM ); + CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue ); + note->ExecuteLD( *infoNoteText ); + + CleanupStack::PopAndDestroy( infoNoteText ); + CleanupStack::PopAndDestroy( 2 ); //resourceLoader&fs + + return; + } + } iProfileEngine->SetActiveProfileL( aId ); }