163 DEBUG( + CLocSUPLSettingsUiEngine::Initalize ); |
181 DEBUG( + CLocSUPLSettingsUiEngine::Initalize ); |
164 iSUPLSettingsAdapter->Initialize(); |
182 iSUPLSettingsAdapter->Initialize(); |
165 DEBUG( - CLocSUPLSettingsUiEngine::Initalize ); |
183 DEBUG( - CLocSUPLSettingsUiEngine::Initalize ); |
166 } |
184 } |
167 |
185 |
168 |
186 void CLocSUPLSettingsUiEngine::SelectConnectionL() |
169 |
187 { |
|
188 DEBUG( + CLocSUPLSettingsUiEngine::SelectConnectionL ); |
|
189 if( iDialogActive || IsActive() || iConfirmQuery || iConnectionMgmtQuery ) |
|
190 { |
|
191 User::Leave( KErrInUse ); |
|
192 } |
|
193 |
|
194 // set the Launch type |
|
195 iLaunchParams = ELocSUPLIAPSelection; |
|
196 |
|
197 // In the case of a framework launching SUPL UI, the user is ignorant |
|
198 // of the action. Hence, a confirmation dialog is popped up to intimate |
|
199 // the user that he needs to configure SUPL settings. |
|
200 |
|
201 iConfirmQuery = CAknGlobalConfirmationQuery::NewL(); |
|
202 |
|
203 CAknSDData* secondaryData = CAknSDData::NewL( KCatUidLocationSuplSettingsUi, |
|
204 ECmdSuplSettingsMissing, |
|
205 KNullDesC8 ); |
|
206 |
|
207 // Send the Confirmation query information to the Secondary display |
|
208 // The ownership of 'secondaryData' is taken up by the Global confirmation query |
|
209 iConfirmQuery->SetSecondaryDisplayData( secondaryData ); |
|
210 |
|
211 // Load the SUPL IAP confirmation query prompt text from the resource file |
|
212 HBufC* promptText = StringLoader::LoadL( R_LOC_SUPL_IAP_QUERY ); |
|
213 |
|
214 // Display the Confirmation query. |
|
215 iConfirmQuery->ShowConfirmationQueryL( iStatus, |
|
216 *promptText, |
|
217 R_AVKON_SOFTKEYS_YES_NO__YES, |
|
218 R_QGN_NOTE_QUERY_ANIM ); |
|
219 |
|
220 SetActive(); |
|
221 delete promptText; // |
|
222 promptText = NULL; |
|
223 DEBUG( - CLocSUPLSettingsUiEngine::SelectConnectionL ); |
|
224 } |
|
225 |
|
226 // --------------------------------------------------------------------------- |
|
227 // void CLocSUPLSettingsUiEngine::LaunchApConfiguratorL |
|
228 // Launches the Access Point Configurator dialog |
|
229 // |
|
230 // --------------------------------------------------------------------------- |
|
231 // |
|
232 void CLocSUPLSettingsUiEngine::LaunchApConfiguratorL( TInt64 aSlpId, |
|
233 MSuplServerEditorObserver* aEditorObserver ) |
|
234 { |
|
235 DEBUG( + CLocSUPLSettingsUiEngine::LaunchApConfiguratorL ); |
|
236 iCurrentSlpId = aSlpId; |
|
237 iEditorObserver = aEditorObserver; |
|
238 |
|
239 if( iDialogActive ) |
|
240 { |
|
241 User::Leave( KErrInUse ); |
|
242 } |
|
243 |
|
244 // Zeroing the Temporary buffers so that it doesn't contain any |
|
245 // left over value from the previous access |
|
246 iSettingsBufferPtr.Zero(); |
|
247 |
|
248 // Obtain the UID for the selected Access point so that the configurator |
|
249 // can be highlighted |
|
250 TUint32 highlightUid( 0 ); |
|
251 |
|
252 // if AP value is NULL, or zero, no temp AP, all previous changes have been frozen. |
|
253 TInt32 tempAP = GetTempAPValue(); |
|
254 if ( tempAP == -1) |
|
255 { |
|
256 // Obtain the Server address value from the SUPL settings |
|
257 // API. If the value is set then it has to be shown to the user |
|
258 // as the existing value when he tries to configure the UI |
|
259 TRAP_IGNORE( iSUPLSettingsAdapter->GetIapNameL( iCurrentSlpId, iSettingsBufferPtr ) ); |
|
260 |
|
261 TRAPD( error, highlightUid = ConvertIAPNameToIdL( iSettingsBufferPtr ) ); |
|
262 |
|
263 if( error == KErrNotFound ) |
|
264 { |
|
265 highlightUid = 0; |
|
266 } |
|
267 } |
|
268 else |
|
269 { |
|
270 highlightUid = tempAP; |
|
271 } |
|
272 |
|
273 iConnectionMgmtQuery = CCmApplicationSettingsUi::NewL(); |
|
274 |
|
275 iDialogActive = ETrue; |
|
276 TBool ret = EFalse; |
|
277 TCmSettingSelection selectionUid; |
|
278 selectionUid.iId = highlightUid; |
|
279 selectionUid.iResult = CMManager::EConnectionMethod ; |
|
280 TBearerFilterArray filter; |
|
281 CleanupClosePushL( filter ); |
|
282 |
|
283 // Need access points for bearer type CSD and Packet data only |
|
284 filter.AppendL( KUidCSDBearerType ); |
|
285 filter.AppendL( KUidPacketDataBearerType ); |
|
286 |
|
287 // Run CCmApplicationSettingsUi dialog only for Access points (Connection methods) |
|
288 // selectionUid contains UID to be highlighted, on return it will contain UID of selected CM |
|
289 TRAPD( error, ret = |
|
290 iConnectionMgmtQuery->RunApplicationSettingsL( |
|
291 selectionUid , CMManager::EShowConnectionMethods, filter |
|
292 ) ); // | CMManager::EShowAlwaysAsk |
|
293 |
|
294 iDialogActive = EFalse; |
|
295 if( error == CMManager::KErrConnectionNotFound ) |
|
296 { |
|
297 // No AP defined, Show Note |
|
298 TRAP_IGNORE( ShowNoteL(); ) |
|
299 //User::Leave( error ); |
|
300 } |
|
301 CleanupStack::PopAndDestroy( &filter ); |
|
302 delete iConnectionMgmtQuery; |
|
303 iConnectionMgmtQuery = NULL; |
|
304 |
|
305 if( ret ) |
|
306 { |
|
307 SetTempAPValue(selectionUid.iId); |
|
308 RCmManager cmManager; |
|
309 cmManager.OpenLC(); |
|
310 |
|
311 RArray< TUint32 > cmArray; |
|
312 HBufC* cmName = NULL; |
|
313 RCmConnectionMethod method; |
|
314 // Get all the CMs into cmArray |
|
315 cmManager.ConnectionMethodL( cmArray, ETrue, EFalse ); |
|
316 CleanupClosePushL( cmArray ); |
|
317 |
|
318 // Get name of selected CM |
|
319 TInt count = cmArray.Count(); |
|
320 for ( TInt i = 0; i < count; i++ ) |
|
321 { |
|
322 if (selectionUid.iId == cmArray[i] ) |
|
323 { |
|
324 method = cmManager.ConnectionMethodL( cmArray[i] ); |
|
325 CleanupClosePushL( method ); |
|
326 cmName = method.GetStringAttributeL( CMManager::ECmName ); |
|
327 CleanupStack::PushL( cmName ); |
|
328 iSettingsBufferPtr.Copy( cmName->Des() ); |
|
329 CleanupStack::PopAndDestroy( cmName ); |
|
330 CleanupStack::PopAndDestroy( &method ); |
|
331 break; |
|
332 } |
|
333 } |
|
334 CleanupStack::PopAndDestroy( &cmArray ); |
|
335 CleanupStack::PopAndDestroy( &cmManager ); |
|
336 |
|
337 if( iEditorObserver ) |
|
338 { |
|
339 iEditorObserver->UpdateIapL( iSettingsBufferPtr ); |
|
340 } |
|
341 } |
|
342 |
|
343 DEBUG( - CLocSUPLSettingsUiEngine::LaunchApConfiguratorL ); |
|
344 } |
|
345 |
|
346 // --------------------------------------------------------------------------- |
|
347 // void CLocSUPLSettingsUiEngine::LaunchSuplUsageConfiguratorL |
|
348 // Launches the SUPL Usage Configurator |
|
349 // |
|
350 // --------------------------------------------------------------------------- |
|
351 // |
|
352 void CLocSUPLSettingsUiEngine::LaunchSuplUsageConfiguratorL() |
|
353 { |
|
354 DEBUG( + CLocSUPLSettingsUiEngine::LaunchSuplUsageConfiguratorL ); |
|
355 if( iDialogActive ) |
|
356 { |
|
357 User::Leave( KErrInUse ); |
|
358 } |
|
359 |
|
360 // Allocate the descriptor array for Text settings for System |
|
361 // of measurement |
|
362 CDesCArrayFlat* items = new( ELeave ) CDesCArrayFlat( KNoofUsageSettings ); |
|
363 CleanupStack::PushL( items ); |
|
364 |
|
365 // Allocate all the Settings usage string |
|
366 |
|
367 // Append the radio-button list items |
|
368 items->AppendL( iSUPLSettingsAdapter->Automatic() ); |
|
369 items->AppendL( iSUPLSettingsAdapter->AutomaticAtHome() ); |
|
370 items->AppendL( iSUPLSettingsAdapter->AlwaysAsk() ); |
|
371 items->AppendL( iSUPLSettingsAdapter->Disable() ); |
|
372 |
|
373 // Obtain the current value for SUPL settings usage |
|
374 // This would be used for setting the default value for |
|
375 // the text settings page |
|
376 TInt currentSettings = iSUPLSettingsAdapter->GetSuplUsageIndex(); |
|
377 |
|
378 CAknRadioButtonSettingPage* dlg = |
|
379 new ( ELeave )CAknRadioButtonSettingPage( R_LOC_SUPLUSAGE_SETTINGS, |
|
380 currentSettings, |
|
381 items ); |
|
382 // Settings Outstanding flag is marked True to enable dismissal incase |
|
383 // of a Cancel event |
|
384 iDialogActive = ETrue; |
|
385 if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) |
|
386 { |
|
387 CLocSUPLSettingsAdapter::TLocSuplUsage newValue = |
|
388 static_cast<CLocSUPLSettingsAdapter::TLocSuplUsage>( currentSettings ); |
|
389 |
|
390 iSUPLSettingsAdapter->SetSuplUsageL( newValue ); |
|
391 } |
|
392 |
|
393 iDialogActive = EFalse; |
|
394 |
|
395 // Free the items resource |
|
396 CleanupStack::PopAndDestroy( items ); |
|
397 DEBUG( - CLocSUPLSettingsUiEngine::LaunchSuplUsageConfiguratorL ); |
|
398 } |
|
399 |
|
400 // --------------------------------------------------------------------------- |
|
401 // void CLocSUPLSettingsUiEngine::LaunchIAPDialogL |
|
402 // Launches the IAP Dialog |
|
403 // |
|
404 // --------------------------------------------------------------------------- |
|
405 // |
|
406 void CLocSUPLSettingsUiEngine::LaunchIAPDialogL( ) |
|
407 { |
|
408 DEBUG( + CLocSUPLSettingsUiEngine::LaunchIAPDialogL ); |
|
409 if( iDialogActive || IsActive() || iConfirmQuery || iConnectionMgmtQuery ) |
|
410 { |
|
411 User::Leave( KErrInUse ); |
|
412 } |
|
413 |
|
414 // set the Launch type |
|
415 iLaunchParams = ELocSuplIAPDialog; |
|
416 |
|
417 // Self complete |
|
418 SetActive(); |
|
419 TRequestStatus* status = &iStatus; |
|
420 User::RequestComplete(status, KErrNone); |
|
421 |
|
422 DEBUG( - CLocSUPLSettingsUiEngine::LaunchIAPDialogL ); |
|
423 } |
170 |
424 |
171 // --------------------------------------------------------------------------- |
425 // --------------------------------------------------------------------------- |
172 // void CLocSUPLSettingsUiEngine::Close |
426 // void CLocSUPLSettingsUiEngine::Close |
173 // Closes the running Settings UI prematurely. |
427 // Closes the running Settings UI prematurely. |
174 // --------------------------------------------------------------------------- |
428 // --------------------------------------------------------------------------- |
175 // |
429 // |
176 void CLocSUPLSettingsUiEngine::Close() |
430 void CLocSUPLSettingsUiEngine::Close() |
177 { |
431 { |
178 DEBUG( + CLocSUPLSettingsUiEngine::Close ); |
432 DEBUG( + CLocSUPLSettingsUiEngine::Close ); |
|
433 Cancel(); |
179 |
434 |
180 // Cancel the Initalization request. This call Cancels if there is an |
435 // Cancel the Initalization request. This call Cancels if there is an |
181 // outstanding request. If not, does nothing |
436 // outstanding request. If not, does nothing |
182 iSUPLSettingsAdapter->CancelInitialize(); |
437 iSUPLSettingsAdapter->CancelInitialize(); |
183 |
438 |
|
439 // If any of the dialogs are active then issue a cancel event on the |
|
440 // dialogs |
|
441 if( iDialogActive ) |
|
442 { |
|
443 TKeyEvent keyEvent; |
|
444 keyEvent.iCode = EKeyCBA2; |
|
445 keyEvent.iScanCode = EStdKeyDevice1; |
|
446 keyEvent.iModifiers = EAllModifiers; |
|
447 keyEvent.iRepeats = 0; |
|
448 CCoeEnv* cCoeEnv = CCoeEnv::Static(); |
|
449 |
|
450 // Simulate a Cancel event on the running dialogs. The Simulated event |
|
451 // is for the Left Soft Key. |
|
452 // Ignore the error incase of a leave |
|
453 |
|
454 TRAP_IGNORE( cCoeEnv->SimulateKeyEventL( keyEvent, EEventKey ) ); |
|
455 } |
184 DEBUG( - CLocSUPLSettingsUiEngine::Close ); |
456 DEBUG( - CLocSUPLSettingsUiEngine::Close ); |
185 } |
457 } |
186 |
458 |
|
459 // --------------------------------------------------------------------------- |
|
460 // TPtr16 CLocSUPLSettingsAdapter::GetSuplUsage |
|
461 // --------------------------------------------------------------------------- |
|
462 // |
|
463 TPtr16 CLocSUPLSettingsUiEngine::GetSuplUsageL() |
|
464 { |
|
465 DEBUG( + CLocSUPLSettingsUiEngine::GetSuplUsageL ); |
|
466 // Zeroing the Temporary buffers so that it doesn't contain any |
|
467 // left over value from the previous access |
|
468 iSettingsBufferPtr.Zero(); |
|
469 iConversionBufferPtr.Zero(); |
|
470 |
|
471 // Obtain the Settings values from the SUPL settings API |
|
472 iSUPLSettingsAdapter->GetSuplUsageL( iSettingsBufferPtr ); |
|
473 iConversionBufferPtr.Copy( iSettingsBufferPtr ); |
|
474 DEBUG( - CLocSUPLSettingsUiEngine::GetSuplUsageL ); |
|
475 return iConversionBufferPtr; |
|
476 } |
|
477 |
|
478 // --------------------------------------------------------------------------- |
|
479 // TInt CLocSUPLSettingsAdapter::GetSuplUsage |
|
480 // --------------------------------------------------------------------------- |
|
481 // |
|
482 TInt CLocSUPLSettingsUiEngine::GetSuplUsage() |
|
483 { |
|
484 return iSUPLSettingsAdapter->GetSuplUsage(); |
|
485 } |
187 |
486 |
188 // --------------------------------------------------------------------------- |
487 // --------------------------------------------------------------------------- |
189 // void CLocSUPLSettingsUiEngine::HandleSuplSettingsChangeL |
488 // void CLocSUPLSettingsUiEngine::HandleSuplSettingsChangeL |
190 // Inherited from MLocSUPLSettingsAdapterObserver |
489 // Inherited from MLocSUPLSettingsAdapterObserver |
191 // |
490 // |
199 static_cast< MLocSUPLSettingsUiEngObserver::TSettingsEventType >( aEvent ) ); |
498 static_cast< MLocSUPLSettingsUiEngObserver::TSettingsEventType >( aEvent ) ); |
200 DEBUG( - CLocSUPLSettingsUiEngine::HandleSuplSettingsChangeL ); |
499 DEBUG( - CLocSUPLSettingsUiEngine::HandleSuplSettingsChangeL ); |
201 } |
500 } |
202 |
501 |
203 // --------------------------------------------------------------------------- |
502 // --------------------------------------------------------------------------- |
|
503 // void CLocSUPLSettingsUiEngine::RunL() |
|
504 // |
|
505 // --------------------------------------------------------------------------- |
|
506 // |
|
507 void CLocSUPLSettingsUiEngine::RunL() |
|
508 { |
|
509 DEBUG( + CLocSUPLSettingsUiEngine::RunL ); |
|
510 // If the Confirmation query is present then we have to Pop up the |
|
511 // IAP Selection dialog based on User Action |
|
512 if( iConfirmQuery && iLaunchParams == ELocSUPLIAPSelection ) |
|
513 { |
|
514 // Incase there has been a response from the User then the Key pressed |
|
515 // is present in the iStatus variable |
|
516 if( EAknSoftkeyYes == iStatus.Int() ) |
|
517 { |
|
518 iObserver.HandleSettingsEventL( |
|
519 MLocSUPLSettingsUiEngObserver::EIAPSelectionComplete ); |
|
520 } |
|
521 else |
|
522 { |
|
523 iObserver.HandleSettingsEventL( |
|
524 MLocSUPLSettingsUiEngObserver::EIAPSelectionCancelled ); |
|
525 } |
|
526 |
|
527 // Destroy the IAP confirmation query handle |
|
528 delete iConfirmQuery; |
|
529 iConfirmQuery = NULL; |
|
530 } |
|
531 else if( iLaunchParams == ELocSuplIAPDialog ) // Launch IAP Dialog |
|
532 { |
|
533 // Launch Access Point dialog to get the access point |
|
534 TRAPD(err, LaunchApConfiguratorL(KErrNotFound, NULL) ); |
|
535 |
|
536 // Update the Access points for all the Slp whose AP is missing. |
|
537 if( KErrNone == err ) |
|
538 TRAP(err, UpdateMissingIAPL( iSettingsBufferPtr ) ); |
|
539 |
|
540 // Incase of any errors. |
|
541 if( KErrNone == err ) |
|
542 { |
|
543 iObserver.HandleSettingsEventL( |
|
544 MLocSUPLSettingsUiEngObserver::EIAPSelectionComplete ); |
|
545 } |
|
546 else |
|
547 { |
|
548 iObserver.HandleSettingsEventL( |
|
549 MLocSUPLSettingsUiEngObserver::EIAPSelectionCancelled ); |
|
550 } |
|
551 } |
|
552 else |
|
553 { |
|
554 iObserver.HandleSettingsEventL( |
|
555 MLocSUPLSettingsUiEngObserver::EIAPSelectionCancelled ); |
|
556 } |
|
557 |
|
558 DEBUG( - CLocSUPLSettingsUiEngine::RunL ); |
|
559 } |
|
560 |
|
561 // --------------------------------------------------------------------------- |
|
562 // void CLocSUPLSettingsUiEngine::DoCancel() |
|
563 // |
|
564 // --------------------------------------------------------------------------- |
|
565 // |
|
566 void CLocSUPLSettingsUiEngine::DoCancel() |
|
567 { |
|
568 DEBUG( + CLocSUPLSettingsUiEngine::DoCancel ); |
|
569 if( iConfirmQuery ) |
|
570 { |
|
571 // If the confirmation query is running Cancel the query |
|
572 iConfirmQuery->CancelConfirmationQuery(); |
|
573 |
|
574 delete iConfirmQuery; |
|
575 iConfirmQuery = NULL; |
|
576 |
|
577 } |
|
578 |
|
579 if( iConnectionMgmtQuery ) |
|
580 { |
|
581 delete iConnectionMgmtQuery; |
|
582 iConnectionMgmtQuery = NULL; |
|
583 } |
|
584 |
|
585 DEBUG( - CLocSUPLSettingsUiEngine::DoCancel ); |
|
586 } |
|
587 |
|
588 // --------------------------------------------------------------------------- |
204 // void CLocSUPLSettingsUiEngine::GenerateHslpAddressFromImsi() |
589 // void CLocSUPLSettingsUiEngine::GenerateHslpAddressFromImsi() |
205 // |
590 // |
206 // --------------------------------------------------------------------------- |
591 // --------------------------------------------------------------------------- |
207 // |
592 // |
208 void CLocSUPLSettingsUiEngine::GenerateHslpAddressFromImsi(TDes& aIMSIAddress) |
593 void CLocSUPLSettingsUiEngine::GenerateHslpAddressFromImsi(TDes& aIMSIAddress) |