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 #include <ProEngWrapper.rsg> |
30 |
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 // ----------------------------------------------------------------------------- |
58 // |
45 // |
59 void CProEngEngineImpl::ConstructL() |
46 void CProEngEngineImpl::ConstructL() |
60 { |
47 { |
61 iProfileEngine = CreateProfileEngineExtendedL(); |
48 iProfileEngine = CreateProfileEngineExtendedL(); |
62 iToneHandler = CProEngToneHandler::NewL(); |
49 iToneHandler = CProEngToneHandler::NewL(); |
63 iFs = new ( ELeave ) RFs; |
|
64 User::LeaveIfError( iFs->Connect() ); |
|
65 } |
50 } |
66 |
51 |
67 // ----------------------------------------------------------------------------- |
52 // ----------------------------------------------------------------------------- |
68 // CProEngEngineImpl::ConstructL |
53 // CProEngEngineImpl::ConstructL |
69 // ----------------------------------------------------------------------------- |
54 // ----------------------------------------------------------------------------- |
203 |
186 |
204 // ----------------------------------------------------------------------------- |
187 // ----------------------------------------------------------------------------- |
205 // CProEngEngineImpl::SetActiveProfileL |
188 // CProEngEngineImpl::SetActiveProfileL |
206 // ----------------------------------------------------------------------------- |
189 // ----------------------------------------------------------------------------- |
207 // |
190 // |
208 void CProEngEngineImpl::SetActiveProfileL(TInt aId) |
191 void CProEngEngineImpl::SetActiveProfileL( TInt aId ) |
209 { |
192 { |
210 if ( // active profile is Off-line |
193 iProfileEngine->SetActiveProfileL( aId ); |
211 ( iProfileEngine->ActiveProfileId() == EProfileOffLineId ) && |
194 } |
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 } |
|
247 |
195 |
248 // ----------------------------------------------------------------------------- |
196 // ----------------------------------------------------------------------------- |
249 // CProEngEngineImpl::ProfileLC |
197 // CProEngEngineImpl::ProfileLC |
250 // ----------------------------------------------------------------------------- |
198 // ----------------------------------------------------------------------------- |
251 // |
199 // |