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