52 #include "rfsConnectionObserver.h" |
51 #include "rfsConnectionObserver.h" |
53 #include "rfsHandler.h" |
52 #include "rfsHandler.h" |
54 #include "rfsClient.h" |
53 #include "rfsClient.h" |
55 #include "RfsTraces.h" |
54 #include "RfsTraces.h" |
56 #include <hbdevicemessageboxsymbian.h> |
55 #include <hbdevicemessageboxsymbian.h> |
57 |
56 #include <hbtextresolversymbian.h> |
58 |
57 |
59 _LIT( KRfsResourceFileName, "Z:rfs.rsc"); |
58 |
60 _LIT(KYes,"yes"); |
59 _LIT(Kcommonerrors,"common_errors_"); |
61 _LIT(KNo,"No"); |
60 _LIT(Kcontrolpanel,"control_panel_"); |
|
61 _LIT(KtsfilePath,"z:/resource/qt/translations/"); |
|
62 |
62 |
63 |
63 // CONSTANTS |
64 // CONSTANTS |
64 const TInt KPhoneIndex = 0; |
65 const TInt KPhoneIndex = 0; |
65 const TInt KRfsHandlerActivated = 0x0001; |
66 const TInt KRfsHandlerActivated = 0x0001; |
66 const TInt KRfsHandlerPhoneModuleLoaded = 0x0002; |
67 const TInt KRfsHandlerPhoneModuleLoaded = 0x0002; |
94 { |
95 { |
95 TRACES("CRfsHandler::ActivateRfsL(): return"); |
96 TRACES("CRfsHandler::ActivateRfsL(): return"); |
96 return; |
97 return; |
97 } |
98 } |
98 |
99 |
99 // load the resource file |
100 |
100 if ( !iResourceFileOffset ) |
|
101 { |
|
102 LoadResourceL(); |
|
103 } |
|
104 |
|
105 // Create a generic connection observer for closing all the active connections |
101 // Create a generic connection observer for closing all the active connections |
106 // if they exist. Currently there are only 2 types i.e. SIP and PDP |
102 // if they exist. Currently there are only 2 types i.e. SIP and PDP |
107 CRfsConnectionObserver* connectionObserver = CRfsConnectionObserver::NewLC(); |
103 CRfsConnectionObserver* connectionObserver = CRfsConnectionObserver::NewLC(); |
108 |
104 |
109 // This wil return a boolean: |
105 // This wil return a boolean: |
143 } |
139 } |
144 |
140 |
145 iFlags |= ( KRfsHandlerActivated | KRfsHandlerInitDone ); |
141 iFlags |= ( KRfsHandlerActivated | KRfsHandlerInitDone ); |
146 TBool proceed( ETrue ); |
142 TBool proceed( ETrue ); |
147 |
143 |
148 // Setup information of whether the CRfsHandler instance has been |
144 |
149 // destroyed while one of the queries was on the screen. |
|
150 TBool thisDestroyed( EFalse ); |
|
151 iDestroyedPtr = &thisDestroyed; |
|
152 CleanupResetPointerPushL( iDestroyedPtr ); |
|
153 |
|
154 // Ask first query. |
145 // Ask first query. |
155 if ( aAskSecurityCodeFirst ) |
146 if ( aAskSecurityCodeFirst ) |
156 { |
147 { |
157 proceed = iSecurityHandler->AskSecCodeL(); |
148 proceed = iSecurityHandler->AskSecCodeL(); |
158 } |
149 } |
159 else |
150 else |
160 { |
151 { |
161 proceed = AskConfirmationL( thisDestroyed, aType ); |
152 proceed = AskConfirmationL( aType ); |
162 } |
153 } |
163 |
154 |
164 // If OK, ask second query. |
155 // If OK, ask second query. |
165 if ( proceed ) |
156 if ( proceed ) |
166 { |
157 { |
167 if ( aAskSecurityCodeFirst ) |
158 if ( aAskSecurityCodeFirst ) |
168 { |
159 { |
169 proceed = AskConfirmationL( thisDestroyed, aType ); |
160 proceed = AskConfirmationL( aType ); |
170 } |
161 } |
171 else |
162 else |
172 { |
163 { |
173 proceed = iSecurityHandler->AskSecCodeL(); |
164 proceed = iSecurityHandler->AskSecCodeL(); |
174 } |
165 } |
184 } |
175 } |
185 RStarterSession startersession; |
176 RStarterSession startersession; |
186 if( startersession.Connect() == KErrNone ) |
177 if( startersession.Connect() == KErrNone ) |
187 { |
178 { |
188 // Displays information note to the user telling that the device will restart |
179 // Displays information note to the user telling that the device will restart |
189 HBufC* prompt = StringLoader::LoadLC( R_DEVICE_RESTART ); |
180 TBool result = HbTextResolverSymbian::Init(Kcommonerrors, KtsfilePath); |
|
181 _LIT(Krestarting,"txt_error_info_restarting"); |
|
182 HBufC* prompt =HbTextResolverSymbian::LoadL(Krestarting); |
190 |
183 |
191 CHbDeviceMessageBoxSymbian* note = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EInformation); |
184 CHbDeviceMessageBoxSymbian* note = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EInformation); |
192 CleanupStack::PushL(note); |
185 CleanupStack::PushL(note); |
193 note->SetTextL(*prompt); |
186 note->SetTextL(*prompt); |
194 //could have used show() but it is aynchronous and execution proceeds before note is seen so have used synchronous API exec() |
187 //could have used show() but it is aynchronous and execution proceeds before note is seen so have used synchronous API exec() |
195 note->ExecL(); |
188 note->ExecL(); |
196 CleanupStack::PopAndDestroy(note); |
189 CleanupStack::PopAndDestroy(note); |
197 CleanupStack::PopAndDestroy( prompt ); |
190 |
198 |
191 |
199 |
192 |
200 |
193 |
201 |
194 |
202 if (aType == ERfsNormal ) startersession.Reset( RStarterSession::ENormalRFSReset ); |
195 if (aType == ERfsNormal ) startersession.Reset( RStarterSession::ENormalRFSReset ); |
222 } |
215 } |
223 else |
216 else |
224 { |
217 { |
225 connectionObserver->ReportRfsCompletionToSip(); |
218 connectionObserver->ReportRfsCompletionToSip(); |
226 } |
219 } |
227 |
220 |
228 if ( thisDestroyed ) // this object has already been destroyed |
221 CleanupStack::PopAndDestroy( this ); // this |
229 { |
222 |
230 // remove cleanup items |
|
231 CleanupStack::Pop( 2 ); // this, iDestroyedPtr |
|
232 } |
|
233 else |
|
234 { |
|
235 // NULLs iDestroyedPtr and calls DoCleanup() |
|
236 CleanupStack::PopAndDestroy( 2 ); // this, iDestroyedPtr |
|
237 } |
|
238 |
|
239 CleanupStack::PopAndDestroy(connectionObserver); |
223 CleanupStack::PopAndDestroy(connectionObserver); |
240 } |
224 } |
241 |
225 |
242 // ----------------------------------------------------------------------------- |
226 // ----------------------------------------------------------------------------- |
243 // CRfsHandler::Cancel() |
227 // CRfsHandler::Cancel() |
270 iTelServer.UnloadPhoneModule( KMmTsyModuleName ); |
254 iTelServer.UnloadPhoneModule( KMmTsyModuleName ); |
271 } |
255 } |
272 |
256 |
273 iTelServer.Close(); |
257 iTelServer.Close(); |
274 |
258 |
275 // close the resource file |
|
276 if ( iResourceFileOffset ) |
|
277 { |
|
278 iEnv->DeleteResourceFile( iResourceFileOffset ); |
|
279 iResourceFileOffset = 0; |
|
280 } |
|
281 |
|
282 // finally, reset the flags |
259 // finally, reset the flags |
283 iFlags = 0; |
260 iFlags = 0; |
284 } |
261 } |
285 |
262 |
286 // ----------------------------------------------------------------------------- |
|
287 // CRfsHandler::LoadResourceL() |
|
288 // ----------------------------------------------------------------------------- |
|
289 void CRfsHandler::LoadResourceL() |
|
290 { |
|
291 TRACES("CRfsHandler::LoadResourceL()"); |
|
292 iEnv = CEikonEnv::Static(); |
|
293 |
|
294 // eikon environment is needed |
|
295 __ASSERT_DEBUG( iEnv, User::Invariant() ); |
|
296 |
|
297 TParse* fp = new(ELeave) TParse(); |
|
298 fp->Set(KRfsResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL); |
|
299 TFileName fileName( fp->FullName() ); |
|
300 delete fp; |
|
301 |
|
302 BaflUtils::NearestLanguageFile( iEnv->FsSession(), fileName ); |
|
303 iResourceFileOffset = iEnv->AddResourceFileL( fileName ); |
|
304 } |
|
305 |
263 |
306 // ----------------------------------------------------------------------------- |
264 // ----------------------------------------------------------------------------- |
307 // CRfsHandler::SetDefaultLanguage() |
265 // CRfsHandler::SetDefaultLanguage() |
308 // ----------------------------------------------------------------------------- |
266 // ----------------------------------------------------------------------------- |
309 void CRfsHandler::SetDefaultLanguage() const |
267 void CRfsHandler::SetDefaultLanguage() const |
325 } |
283 } |
326 |
284 |
327 // ----------------------------------------------------------------------------- |
285 // ----------------------------------------------------------------------------- |
328 // CRfsHandler::AskConfirmationL() |
286 // CRfsHandler::AskConfirmationL() |
329 // ----------------------------------------------------------------------------- |
287 // ----------------------------------------------------------------------------- |
330 TBool CRfsHandler::AskConfirmationL( const TBool& aThisDestroyed, TRfsType aType ) |
288 TBool CRfsHandler::AskConfirmationL( TRfsType aType ) |
331 { |
289 { |
332 TRACES("CRfsHandler::AskConfirmationL()"); |
290 TRACES("CRfsHandler::AskConfirmationL()"); |
333 |
|
334 |
291 |
335 TInt resourceId = ( aType == ERfsNormal ) ? R_CONFIRM_RFS : R_CONFIRM_DEEP_RFS; |
292 TBool result = HbTextResolverSymbian::Init(Kcontrolpanel, KtsfilePath); |
336 HBufC* query = iEnv->AllocReadResourceLC( resourceId ); |
293 _LIT(Knormalrfs,"txt_cp_info_restore_original_settings_no_data_wil"); |
337 |
294 _LIT(KDeeprfs,"txt_cp_info_delete_all_data_and_restore_original_s"); |
338 // Show the confirmation query. |
295 |
339 |
296 |
340 CHbDeviceMessageBoxSymbian::TButtonId selection = CHbDeviceMessageBoxSymbian::QuestionL(*query, KYes, KNo); |
297 HBufC* query = NULL; |
|
298 if( aType == ERfsNormal ) |
|
299 query = HbTextResolverSymbian::LoadL(Knormalrfs); |
|
300 else |
|
301 query = HbTextResolverSymbian::LoadL(KDeeprfs); |
|
302 |
|
303 _LIT(Kcommonlocalisationfile, "common_"); |
|
304 TBool result1 = HbTextResolverSymbian::Init(Kcommonlocalisationfile, KtsfilePath); |
|
305 _LIT(Kyes,"txt_common_button_ok"); |
|
306 _LIT(Kno,"txt_common_button_cancel"); |
|
307 |
|
308 HBufC* yes = HbTextResolverSymbian::LoadL(Kyes); |
|
309 HBufC* no = HbTextResolverSymbian::LoadL(Kno); |
|
310 // Show the confirmation query. |
|
311 CHbDeviceMessageBoxSymbian::TButtonId selection = CHbDeviceMessageBoxSymbian::QuestionL(*query,*yes,*no); |
341 TBool ret; |
312 TBool ret; |
342 if (selection == CHbDeviceMessageBoxSymbian::EAcceptButton) // user pressed yes |
313 if (selection == CHbDeviceMessageBoxSymbian::EAcceptButton) // user pressed yes |
343 { |
314 { |
344 ret=ETrue; |
315 ret=ETrue; |
345 } |
316 } |
346 else |
317 else |
347 { |
318 { |
348 ret=EFalse; |
319 ret=EFalse; |
349 } |
320 } |
350 CleanupStack::PopAndDestroy(query); |
|
351 return ret; |
321 return ret; |
352 |
322 |
353 } |
323 } |
354 |
324 |
355 // ----------------------------------------------------------------------------- |
325 // ----------------------------------------------------------------------------- |
435 ( btState ) || |
405 ( btState ) || |
436 ( irdaState == TIrdaStatusCodes::EIrConnected ) || |
406 ( irdaState == TIrdaStatusCodes::EIrConnected ) || |
437 ( wlanState == EPSWlanIndicatorActive || wlanState == EPSWlanIndicatorActiveSecure )) |
407 ( wlanState == EPSWlanIndicatorActive || wlanState == EPSWlanIndicatorActiveSecure )) |
438 #endif //__WINS__ |
408 #endif //__WINS__ |
439 { |
409 { |
440 HBufC* prompt = iEnv->AllocReadResourceLC( R_ACTIVE_CALLS ); |
410 TRACES("CRfsHandler::checkconnectionsL():show active connections note "); |
441 |
411 TBool result = HbTextResolverSymbian::Init(Kcontrolpanel, KtsfilePath); |
442 CHbDeviceMessageBoxSymbian* note = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EInformation); |
412 _LIT(Kactivecalls,"txt_cp_info_active_calls_and_connections_must_be_d"); |
443 CleanupStack::PushL(note); |
413 HBufC* prompt = HbTextResolverSymbian::LoadL(Kactivecalls); |
444 note->SetTextL(*prompt); |
414 |
445 note->ShowL(); |
415 CHbDeviceMessageBoxSymbian* note = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EInformation); |
446 CleanupStack::PopAndDestroy( note ); |
416 CleanupStack::PushL(note); |
447 CleanupStack::PopAndDestroy( prompt ); |
417 note->SetTextL(*prompt); |
448 |
418 note->ShowL(); |
|
419 CleanupStack::PopAndDestroy( note ); |
|
420 |
449 return ETrue; |
421 return ETrue; |
450 } |
422 } |
451 |
423 |
452 return EFalse; |
424 return EFalse; |
453 } |
425 } |