25 #include <MProfileEngineExtended.h> |
25 #include <MProfileEngineExtended.h> |
26 #include <ProfileEngineConstants.h> |
26 #include <ProfileEngineConstants.h> |
27 #include "CProEngProfileImpl.h" |
27 #include "CProEngProfileImpl.h" |
28 #include "CProEngToneHandler.h" |
28 #include "CProEngToneHandler.h" |
29 #include "CProEngProfileNameArrayImpl.h" |
29 #include "CProEngProfileNameArrayImpl.h" |
30 |
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 // ----------------------------------------------------------------------------- |
45 // |
58 // |
46 void CProEngEngineImpl::ConstructL() |
59 void CProEngEngineImpl::ConstructL() |
47 { |
60 { |
48 iProfileEngine = CreateProfileEngineExtendedL(); |
61 iProfileEngine = CreateProfileEngineExtendedL(); |
49 iToneHandler = CProEngToneHandler::NewL(); |
62 iToneHandler = CProEngToneHandler::NewL(); |
|
63 iFs = new ( ELeave ) RFs; |
|
64 User::LeaveIfError( iFs->Connect() ); |
50 } |
65 } |
51 |
66 |
52 // ----------------------------------------------------------------------------- |
67 // ----------------------------------------------------------------------------- |
53 // CProEngEngineImpl::ConstructL |
68 // CProEngEngineImpl::ConstructL |
54 // ----------------------------------------------------------------------------- |
69 // ----------------------------------------------------------------------------- |
186 |
203 |
187 // ----------------------------------------------------------------------------- |
204 // ----------------------------------------------------------------------------- |
188 // CProEngEngineImpl::SetActiveProfileL |
205 // CProEngEngineImpl::SetActiveProfileL |
189 // ----------------------------------------------------------------------------- |
206 // ----------------------------------------------------------------------------- |
190 // |
207 // |
191 void CProEngEngineImpl::SetActiveProfileL( TInt aId ) |
208 void CProEngEngineImpl::SetActiveProfileL(TInt aId) |
192 { |
209 { |
193 iProfileEngine->SetActiveProfileL( aId ); |
210 if ( // active profile is Off-line |
194 } |
211 ( iProfileEngine->ActiveProfileId() == EProfileOffLineId ) && |
|
212 // and currently focused profile is not Off-line |
|
213 ( aId != EProfileOffLineId ) ) |
|
214 { |
|
215 |
|
216 TInt simCStatus( ESimNotPresent ); |
|
217 RProperty simStatus; |
|
218 User::LeaveIfError( simStatus.Attach(KPSUidStartup, KPSSimStatus ) ); |
|
219 User::LeaveIfError( simStatus.Get( simCStatus ) ); |
|
220 simStatus.Close(); |
|
221 |
|
222 TParse* fp = new ( ELeave ) TParse(); |
|
223 fp->Set( KProEngResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL ); |
|
224 TFileName localizedFileName( fp->FullName() ); |
|
225 delete fp; |
|
226 |
|
227 BaflUtils::NearestLanguageFile( *iFs, localizedFileName ); |
|
228 RConeResourceLoader resourceLoader( *CCoeEnv::Static() ); |
|
229 TRAP_IGNORE( resourceLoader.OpenL( localizedFileName ) ); |
|
230 |
|
231 if ( simCStatus == ESimNotPresent ) |
|
232 { |
|
233 // SIM card does not exist. |
|
234 HBufC* infoNoteText = StringLoader::LoadLC( |
|
235 R_PROFILE_TEXT_INSERT_SIM ); |
|
236 CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue ); |
|
237 note->ExecuteLD( *infoNoteText ); |
|
238 CleanupStack::PopAndDestroy( infoNoteText ); |
|
239 resourceLoader.Close(); |
|
240 return; |
|
241 } |
|
242 resourceLoader.Close(); |
|
243 } |
|
244 |
|
245 iProfileEngine->SetActiveProfileL(aId); |
|
246 } |
195 |
247 |
196 // ----------------------------------------------------------------------------- |
248 // ----------------------------------------------------------------------------- |
197 // CProEngEngineImpl::ProfileLC |
249 // CProEngEngineImpl::ProfileLC |
198 // ----------------------------------------------------------------------------- |
250 // ----------------------------------------------------------------------------- |
199 // |
251 // |