15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include "mpmiapselection.h" |
18 #include "mpmiapselection.h" |
19 #include "mpmlogger.h" |
19 #include "mpmlogger.h" |
20 #include "mpmdialog.h" |
|
21 #include "mpmserversession.h" |
20 #include "mpmserversession.h" |
22 #include "mpmcommsdataccess.h" |
21 #include "mpmcommsdataccess.h" |
23 #include "mpmconnmonevents.h" |
22 #include "mpmconnmonevents.h" |
24 #include "mpmconfirmdlgstarting.h" |
23 #include "mpmconfirmdlgstarting.h" |
25 #include "mpmdefaultconnection.h" |
|
26 #include "mpmwlanquerydialog.h" |
|
27 #include "extendedconnpref.h" |
24 #include "extendedconnpref.h" |
28 |
25 |
29 // --------------------------------------------------------------------------- |
26 // --------------------------------------------------------------------------- |
30 // CMPMIapSelection::CMPMIapSelection |
27 // CMPMIapSelection::CMPMIapSelection |
31 // --------------------------------------------------------------------------- |
28 // --------------------------------------------------------------------------- |
32 // |
29 // |
33 CMPMIapSelection::CMPMIapSelection( CMPMCommsDatAccess* aCommsDatAccess, |
30 CMPMIapSelection::CMPMIapSelection( CMPMCommsDatAccess* aCommsDatAccess, |
34 CMPMServerSession* aSession ) |
31 CMPMServerSession* aSession, |
|
32 CConnectionUiUtilities* aConnUiUtils ) |
35 : iChooseIapState( ENoConnection ), |
33 : iChooseIapState( ENoConnection ), |
36 iCommsDatAccess( aCommsDatAccess ), |
34 iCommsDatAccess( aCommsDatAccess ), |
|
35 iConnUiUtils( aConnUiUtils ), |
37 iStoredIapInfo(), |
36 iStoredIapInfo(), |
38 iSession( aSession ), |
37 iSession( aSession ), |
39 iConfirmDlgStarting( NULL ), |
38 iConfirmDlgStarting( NULL ), |
40 iDialog( NULL ), |
|
41 iWlanDialog( NULL ), |
|
42 iNextBestExists( EFalse ), |
39 iNextBestExists( EFalse ), |
43 iUserSelectionIapId( 0 ), |
40 iUserSelectionIapId( 0 ), |
44 iUserSelectionSnapId( 0 ), |
41 iUserSelectionSnapId( 0 ), |
45 iImplicitState( EImplicitStart ), |
42 iImplicitState( EImplicitStart ), |
46 iIsRoaming( EFalse ), |
43 iIsRoaming( EFalse ), |
60 // --------------------------------------------------------------------------- |
57 // --------------------------------------------------------------------------- |
61 // CMPMIapSelection::NewL |
58 // CMPMIapSelection::NewL |
62 // --------------------------------------------------------------------------- |
59 // --------------------------------------------------------------------------- |
63 // |
60 // |
64 CMPMIapSelection* CMPMIapSelection::NewL( CMPMCommsDatAccess* aCommsDatAccess, |
61 CMPMIapSelection* CMPMIapSelection::NewL( CMPMCommsDatAccess* aCommsDatAccess, |
65 CMPMServerSession* aSession ) |
62 CMPMServerSession* aSession, |
|
63 CConnectionUiUtilities* aConnUiUtils ) |
66 { |
64 { |
67 CMPMIapSelection* self = new ( ELeave ) CMPMIapSelection( aCommsDatAccess, |
65 CMPMIapSelection* self = new ( ELeave ) CMPMIapSelection( aCommsDatAccess, |
68 aSession ); |
66 aSession, |
|
67 aConnUiUtils ); |
69 CleanupStack::PushL( self ); |
68 CleanupStack::PushL( self ); |
70 self->ConstructL(); |
69 self->ConstructL(); |
71 CleanupStack::Pop( self ); |
70 CleanupStack::Pop( self ); |
72 return self; |
71 return self; |
73 } |
72 } |
200 |
198 |
201 ChooseIapComplete( KErrNone, iSession->MyServer().UserConnPref()); |
199 ChooseIapComplete( KErrNone, iSession->MyServer().UserConnPref()); |
202 return; |
200 return; |
203 } |
201 } |
204 |
202 |
|
203 // Read the default connection values |
205 TCmDefConnType type( TCmDefConnType( 0 ) ); |
204 TCmDefConnType type( TCmDefConnType( 0 ) ); |
206 TUint32 id( 0 ); |
205 TUint32 id( 0 ); |
207 iSession->MyServer().DefaultConnection()->GetDefaultConnectionL( type, id ); |
206 iCommsDatAccess->GetDefaultConnectionL( type, id ); |
208 |
207 |
209 MPMLOGSTRING3( "CMPMIapSelection::ChooseIapL:\ |
208 MPMLOGSTRING3( "CMPMIapSelection::ChooseIapL:\ |
210 default connection type %d id %d", type, id ) |
209 default connection type %d id %d", type, id ) |
211 |
210 |
212 if( type == ECmDefConnConnectionMethod ) |
211 // set the received snap id and open the connection |
213 { |
212 iChooseIapPref.SetSnapId( id ); |
214 iChooseIapPref.SetIapId( id ); |
213 ExplicitConnectionL(); |
215 iChooseIapPref.SetSnapId( 0 ); |
|
216 ExplicitConnectionL(); |
|
217 } |
|
218 else if( type == ECmDefConnDestination ) |
|
219 { |
|
220 iChooseIapPref.SetSnapId( id ); |
|
221 ExplicitConnectionL(); |
|
222 } |
|
223 else |
|
224 { |
|
225 if( iCommsDatAccess->IsSnapEmptyL( id ) ) |
|
226 { |
|
227 // start implicit connection |
|
228 ImplicitConnectionL(); |
|
229 return; |
|
230 } |
|
231 |
|
232 iChooseIapPref.SetSnapId( id ); |
|
233 |
|
234 // start connection as if explicitly defined |
|
235 // by application |
|
236 ExplicitConnectionL(); |
|
237 } |
|
238 } |
214 } |
239 else if ( iChooseIapPref.ConnType() == TMpmConnPref::EConnTypeExplicit ) |
215 else if ( iChooseIapPref.ConnType() == TMpmConnPref::EConnTypeExplicit ) |
240 { |
216 { |
241 // Client has defined SNAP or IAP connection to be used. |
217 // Client has defined SNAP or IAP connection to be used. |
242 |
218 |
349 // in connection preferences |
325 // in connection preferences |
350 // |
326 // |
351 iChooseIapPref.SetIapId( validateIapId ); |
327 iChooseIapPref.SetIapId( validateIapId ); |
352 iChooseIapPref.SetNetId( retNetId ); |
328 iChooseIapPref.SetNetId( retNetId ); |
353 |
329 |
354 // In case offline mode is enabled, only LAN or WLAN is allowed. |
330 if ( !iapTypeLanOrWlan && |
355 // If some other bearer has been requested, then error code |
331 iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMRoamingStatusUnknown ) |
356 // KErrGprsOfflineMode should be returned instead of KErrNone. |
|
357 // |
|
358 |
|
359 if ( !iapTypeLanOrWlan && ( iSession->MyServer().IsPhoneOffline() || |
|
360 iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMRoamingStatusUnknown ) ) |
|
361 { |
332 { |
362 ChooseIapComplete( KErrGprsOfflineMode, &iChooseIapPref ); |
333 ChooseIapComplete( KErrGprsOfflineMode, &iChooseIapPref ); |
363 } |
334 } |
364 else |
335 else |
365 { |
336 { |
366 TWlanIapType wlanType = iCommsDatAccess->CheckWlanL( validateIapId ); |
337 TWlanIapType wlanType = iCommsDatAccess->CheckWlanL( validateIapId ); |
367 if( wlanType != ENotWlanIap ) |
338 if( wlanType != ENotWlanIap ) |
368 { |
339 { |
369 iChooseIapState = EExplicitConnection; |
340 // Add info into the BM connections |
370 iWlanDialog = CMPMWlanQueryDialog::NewL( *this, validateIapId ); |
341 iSession->MyServer().AppendBMConnection( iSession->ConnectionId(), |
371 iWlanDialog->StartWlanQueryL(); |
342 iChooseIapPref.SnapId(), |
|
343 validateIapId, |
|
344 EStarting, |
|
345 *iSession ); |
|
346 ChooseIapComplete( KErrNone, &iChooseIapPref ); |
372 return; |
347 return; |
373 } |
348 } |
374 |
349 |
375 // Check whether confirmation from user is needed for allowing cellular usage. |
350 // Check whether confirmation from user is needed for allowing cellular usage. |
376 // When application is starting an IAP confirmation is asked only when roaming. |
351 // When application is starting an IAP confirmation is asked only when roaming. |
377 // This is skipped for VPN (= virtual) IAPs |
352 // This is skipped for VPN (= virtual) IAPs |
378 if ( iSession->IsConfirmFirstL( validateIapId ) && |
353 if ( iSession->IsConfirmFirstL( validateIapId ) && |
379 !( iSession->MyServer().CommsDatAccess()->IsVirtualIapL( validateIapId ) )) |
354 !( iSession->MyServer().CommsDatAccess()->IsVirtualIapL( validateIapId ) )) |
380 { |
355 { |
381 // Check if we are roaming and cellular data usage query has not yet been presented |
356 // Check that queries aren't disabled and |
382 // to the user in this country |
357 // enough time has elapsed from the last query cancelled by the user. |
383 if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming ) |
358 if ( !( iChooseIapPref.NoteBehaviour() |
|
359 & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) && |
|
360 !iSession->MyServer().IsConnPermQueryTimerOn() ) |
384 { |
361 { |
385 // Check that queries aren't disabled and |
362 TConnectionId connId = iSession->ConnectionId(); |
386 // enough time has elapsed from the last query cancelled by the user. |
363 |
387 if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) && |
364 // Set confirmation type based on roaming status |
388 !iSession->MyServer().IsConnPermQueryTimerOn() ) |
365 CMPMConfirmDlg::TDialogType type = |
389 { |
366 CMPMConfirmDlg::EConfirmDlgHomeNetwork; |
390 TConnectionId connId = iSession->ConnectionId(); |
367 if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() |
391 |
368 == EMPMInternationalRoaming ) { |
392 // International roaming |
369 type = CMPMConfirmDlg::EConfirmDlgVisitorNetwork; |
393 iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( |
370 } |
394 *this, |
371 |
395 connId, |
372 iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( |
396 snap, |
373 *this, |
397 validateIapId, |
374 connId, |
398 CMPMConfirmDlg::EConfirmDlgVisitorNetwork, |
375 snap, |
399 iChooseIapPref, |
376 validateIapId, |
400 iSession->MyServer(), |
377 type, |
401 *iSession, |
378 iChooseIapPref, |
402 EExplicitConnection ); |
379 iSession->MyServer(), |
403 return; |
380 *iSession, |
404 } |
381 EExplicitConnection ); |
405 else |
382 return; |
406 { |
383 } |
407 // Queries disabled, connection must fail |
384 else |
408 ChooseIapComplete( KErrPermissionDenied, &iChooseIapPref ); |
385 { |
409 return; |
386 // Queries disabled, connection must fail |
410 } |
387 ChooseIapComplete( KErrPermissionDenied, &iChooseIapPref ); |
|
388 return; |
411 } |
389 } |
412 } |
390 } |
413 |
391 |
414 // Add info into the BM connections |
392 // Add info into the BM connections |
415 // |
393 // |
460 CleanupStack::PopAndDestroy( &iapPath ); |
438 CleanupStack::PopAndDestroy( &iapPath ); |
461 } |
439 } |
462 } |
440 } |
463 |
441 |
464 // ----------------------------------------------------------------------------- |
442 // ----------------------------------------------------------------------------- |
465 // CMPMIapSelection::UpdateConnectionDialog |
|
466 // ----------------------------------------------------------------------------- |
|
467 // |
|
468 void CMPMIapSelection::UpdateConnectionDialogL() |
|
469 { |
|
470 if( iDialog ) |
|
471 { |
|
472 MPMLOGSTRING( "CMPMIapSelection::UpdateConnectionDialogL data will be updated" ) |
|
473 iDialog->PublishSortSnapInfoL(); |
|
474 } |
|
475 } |
|
476 |
|
477 // ----------------------------------------------------------------------------- |
|
478 // CMPMIapSelection::CompleteExplicitSnapConnectionL |
443 // CMPMIapSelection::CompleteExplicitSnapConnectionL |
479 // ----------------------------------------------------------------------------- |
444 // ----------------------------------------------------------------------------- |
480 // |
445 // |
481 void CMPMIapSelection::CompleteExplicitSnapConnectionL() |
446 void CMPMIapSelection::CompleteExplicitSnapConnectionL() |
482 { |
447 { |
496 ChooseBestIAPL( iChooseIapPref, availableIAPList, iNextBestExists ); |
461 ChooseBestIAPL( iChooseIapPref, availableIAPList, iNextBestExists ); |
497 TUint32 validateIapId = iChooseIapPref.IapId(); |
462 TUint32 validateIapId = iChooseIapPref.IapId(); |
498 // Check if any suitable IAP's were found, if not then complete selection with error code |
463 // Check if any suitable IAP's were found, if not then complete selection with error code |
499 if ( validateIapId == 0 ) |
464 if ( validateIapId == 0 ) |
500 { |
465 { |
501 ChooseIapComplete( KErrNotFound, NULL ); |
466 if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) && |
|
467 ( iChooseIapPref.ConnType() == TMpmConnPref::EConnTypeDefault || |
|
468 ( iChooseIapPref.ConnType() == TMpmConnPref::EConnTypeExplicit && |
|
469 iCommsDatAccess->IsInternetSnapL( 0, snap ) ) ) ) |
|
470 { |
|
471 ImplicitConnectionL(); |
|
472 } |
|
473 else |
|
474 { |
|
475 ChooseIapComplete( KErrNotFound, NULL ); |
|
476 } |
502 CleanupStack::PopAndDestroy( &availableIAPList ); |
477 CleanupStack::PopAndDestroy( &availableIAPList ); |
503 return; |
478 return; |
504 } |
479 } |
505 |
480 |
506 TUint32 retNetId( 0 ); |
481 TUint32 retNetId( 0 ); |
518 |
493 |
519 if ( !CheckGprsServicesAllowedL( iapTypeLanOrWlan ) ) |
494 if ( !CheckGprsServicesAllowedL( iapTypeLanOrWlan ) ) |
520 { |
495 { |
521 ChooseIapComplete( KErrGprsServicesNotAllowed, NULL ); |
496 ChooseIapComplete( KErrGprsServicesNotAllowed, NULL ); |
522 } |
497 } |
523 else if ( !iapTypeLanOrWlan && ( iSession->MyServer().IsPhoneOffline() || |
498 else if ( !iapTypeLanOrWlan && |
524 iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMRoamingStatusUnknown ) ) |
499 iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMRoamingStatusUnknown ) |
525 { |
500 { |
526 // In case offline mode is enabled, only LAN or WLAN is allowed. |
501 // In case offline mode is enabled, only LAN or WLAN is allowed. |
527 // If some other bearer has been requested, then error code |
502 // If some other bearer has been requested, then error code |
528 // KErrGprsOfflineMode should be returned instead of KErrNone. |
503 // KErrGprsOfflineMode should be returned instead of KErrNone. |
529 // |
504 // |
538 !( iSession->MyServer().CommsDatAccess()->IsVirtualIapL( validateIapId ) ) ) |
513 !( iSession->MyServer().CommsDatAccess()->IsVirtualIapL( validateIapId ) ) ) |
539 { |
514 { |
540 // Check that queries aren't disabled and |
515 // Check that queries aren't disabled and |
541 // enough time has elapsed from the last query cancelled by the user. |
516 // enough time has elapsed from the last query cancelled by the user. |
542 if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) && |
517 if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) && |
543 !iSession->MyServer().IsConnPermQueryTimerOn() ) |
518 !iSession->MyServer().IsConnPermQueryTimerOn() ) |
544 { |
519 { |
545 if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming ) |
520 if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming ) |
546 { |
521 { |
547 // International roaming |
522 // International roaming |
548 iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( |
523 iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( |
629 } |
599 } |
630 return ETrue; |
600 return ETrue; |
631 } |
601 } |
632 |
602 |
633 // ----------------------------------------------------------------------------- |
603 // ----------------------------------------------------------------------------- |
634 // CMPMIapSelection::StartWlanQueryIfNeededL |
604 // CMPMIapSelection::IsIapWlanL |
635 // ----------------------------------------------------------------------------- |
605 // ----------------------------------------------------------------------------- |
636 // |
606 // |
637 TBool CMPMIapSelection::StartWlanQueryIfNeededL( TUint32 aIapId, TBool aIsRoaming ) |
607 TBool CMPMIapSelection::IsIapWlanL( TUint32 aIapId ) |
638 { |
608 { |
639 MPMLOGSTRING3( "CMPMIapSelection::StartWlanQueryIfNeededL iap %d, isRoaming %d ", |
609 MPMLOGSTRING2( "CMPMIapSelection::StartWlanQueryIfNeededL iap %d, ", aIapId) |
640 aIapId, |
|
641 aIsRoaming ) |
|
642 TBool wlanQueryNeeded( EFalse ); |
|
643 // If wlan iap check if offline note needed |
|
644 TWlanIapType wlanType = iCommsDatAccess->CheckWlanL( aIapId ); |
610 TWlanIapType wlanType = iCommsDatAccess->CheckWlanL( aIapId ); |
645 if( wlanType != ENotWlanIap ) |
611 if( wlanType != EWlanIap ) |
646 { |
612 { |
647 iIsRoaming = aIsRoaming; |
613 return EFalse; |
648 iChooseIapState = EExplicitConnection; |
614 } |
649 iWlanDialog = CMPMWlanQueryDialog::NewL( *this, aIapId ); |
615 return ETrue; |
650 iWlanDialog->StartWlanQueryL(); |
|
651 wlanQueryNeeded = ETrue; |
|
652 } |
|
653 return wlanQueryNeeded; |
|
654 } |
616 } |
655 |
617 |
656 // ----------------------------------------------------------------------------- |
618 // ----------------------------------------------------------------------------- |
657 // CMPMIapSelection::ImplicitConnectionCheckWlanScanNeededL |
619 // CMPMIapSelection::ImplicitConnectionCheckWlanScanNeededL |
658 // ----------------------------------------------------------------------------- |
620 // ----------------------------------------------------------------------------- |
659 // |
621 // |
660 void CMPMIapSelection::ImplicitConnectionCheckWlanScanNeededL() |
622 void CMPMIapSelection::ImplicitConnectionCheckWlanScanNeededL() |
661 { |
623 { |
662 __ASSERT_DEBUG( !iDialog, PanicServer( EMPMReceiveAlreadyActive ) ); |
|
663 |
|
664 MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionCheckWlanScanNeededL" ) |
624 MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionCheckWlanScanNeededL" ) |
665 |
625 |
666 iCommsDatAccess->CheckWLANIapL( *iSession ); |
626 iCommsDatAccess->CheckWLANIapL( *iSession ); |
667 |
627 |
668 // Scan WLAN networks before displaying Connection Dialog in case: |
628 // Scan WLAN networks before displaying Connection Dialog in case: |
727 void CMPMIapSelection::ChooseIapComplete( |
687 void CMPMIapSelection::ChooseIapComplete( |
728 TInt aError, |
688 TInt aError, |
729 const TMpmConnPref* aPolicyPref ) |
689 const TMpmConnPref* aPolicyPref ) |
730 { |
690 { |
731 MPMLOGSTRING2( "CMPMIapSelection::ChooseIapComplete aError = %d", aError ) |
691 MPMLOGSTRING2( "CMPMIapSelection::ChooseIapComplete aError = %d", aError ) |
732 |
|
733 if ( ( aError == KErrNone ) && |
|
734 !( iChooseIapPref.NoteBehaviour() & |
|
735 TExtendedConnPref::ENoteBehaviourConnDisableNotes ) ) |
|
736 { |
|
737 TConnectionState state = |
|
738 iSession->MyServer().CheckUsageOfIap( aPolicyPref->IapId(), |
|
739 iSession->ConnectionId() ); |
|
740 TBool connectionAlreadyActive = (state == EStarted || state == EStarting || state == ERoaming); |
|
741 if ( !connectionAlreadyActive && |
|
742 ( iSession->IsMMSIap( aPolicyPref->IapId() ) == EFalse ) ) |
|
743 { |
|
744 CConnectionUiUtilities* connUiUtils( NULL ); |
|
745 TRAPD( popupError, connUiUtils = CConnectionUiUtilities::NewL() ); |
|
746 if ( popupError == KErrNone ) |
|
747 { |
|
748 connUiUtils->ConnectingViaDiscreetPopup( aPolicyPref->IapId() ); |
|
749 delete connUiUtils; |
|
750 } |
|
751 } |
|
752 } |
|
753 |
|
754 if( iWlanDialog ) |
|
755 { |
|
756 delete iWlanDialog; |
|
757 iWlanDialog = NULL; |
|
758 } |
|
759 |
692 |
760 iSession->ChooseIapComplete( aError, aPolicyPref ); |
693 iSession->ChooseIapComplete( aError, aPolicyPref ); |
761 // Set choose iap state to none |
694 // Set choose iap state to none |
762 iChooseIapState = ENoConnection; |
695 iChooseIapState = ENoConnection; |
763 iNextBestExists = EFalse; |
696 iNextBestExists = EFalse; |
764 iUserSelectionSnapId = 0; |
697 iUserSelectionSnapId = 0; |
765 iUserSelectionIapId = 0; |
698 iUserSelectionIapId = 0; |
766 iImplicitState = EImplicitStart; |
699 iImplicitState = EImplicitStart; |
767 } |
700 } |
768 |
701 |
769 |
|
770 // ----------------------------------------------------------------------------- |
|
771 // CMPMIapSelection::UserWlanSelectionDoneL |
|
772 // ----------------------------------------------------------------------------- |
|
773 // |
|
774 void CMPMIapSelection::UserWlanSelectionDoneL( TInt aError, TUint32 aIapId ) |
|
775 { |
|
776 MPMLOGSTRING( "CMPMIapSelection::UserWlanSelectionDoneL" ) |
|
777 |
|
778 if( iIsRoaming ) |
|
779 { |
|
780 iIsRoaming = EFalse; |
|
781 iSession->MigrateCallbackL( aError ); |
|
782 delete iWlanDialog; |
|
783 iWlanDialog = NULL; |
|
784 } |
|
785 else |
|
786 { |
|
787 if( aError != KErrNone ) |
|
788 { |
|
789 MPMLOGSTRING2( "CMPMIapSelection::UserWlanSelectionDoneL - Error = %d, completing", aError ) |
|
790 ChooseIapComplete( aError, NULL ); |
|
791 } |
|
792 else |
|
793 { |
|
794 if( iChooseIapState == EImplicitConnection ) |
|
795 { |
|
796 iUserSelectionIapId = aIapId; |
|
797 ImplicitConnectionL(); |
|
798 } |
|
799 else if( iChooseIapState == EExplicitConnection ) |
|
800 { |
|
801 MPMLOGSTRING( "CMPMIapSelection::UserWlanSelectionDoneL completing explicit iap connection" ) |
|
802 iChooseIapPref.SetIapId( aIapId ); |
|
803 // Add info into the BM connections |
|
804 // |
|
805 iSession->MyServer().AppendBMConnection( iSession->ConnectionId(), |
|
806 iChooseIapPref.SnapId(), |
|
807 aIapId, |
|
808 EStarting, |
|
809 *iSession ); |
|
810 iWlanDialog->StoreEasyWlanSelectionL(); |
|
811 delete iWlanDialog; |
|
812 iWlanDialog = NULL; |
|
813 |
|
814 ChooseIapComplete( KErrNone, &iChooseIapPref ); |
|
815 } |
|
816 else |
|
817 { |
|
818 MPMLOGSTRING( "CMPMIapSelection::UserWlanSelectionDoneL - error, no connection state" ) |
|
819 } |
|
820 |
|
821 } |
|
822 |
|
823 } |
|
824 } |
|
825 |
|
826 // ----------------------------------------------------------------------------- |
702 // ----------------------------------------------------------------------------- |
827 // CMPMIapSelection::HandleUserSelectionError |
703 // CMPMIapSelection::HandleUserSelectionError |
828 // ----------------------------------------------------------------------------- |
704 // ----------------------------------------------------------------------------- |
829 // |
705 // |
830 void CMPMIapSelection::HandleUserSelectionError( TInt aError ) |
706 void CMPMIapSelection::HandleUserSelectionError( TInt aError ) |
831 { |
707 { |
832 MPMLOGSTRING2( "CMPMIapSelection::HandleUserIapSelectionError - error %d", |
708 MPMLOGSTRING2( "CMPMIapSelection::HandleUserIapSelectionError - error %d", |
833 aError ) |
709 aError ) |
834 |
710 |
835 ChooseIapComplete( aError, NULL ); |
711 ChooseIapComplete( aError, NULL ); |
836 delete iDialog; |
|
837 iDialog = NULL; |
|
838 } |
712 } |
839 |
713 |
840 |
714 |
841 // ----------------------------------------------------------------------------- |
715 // ----------------------------------------------------------------------------- |
842 // CMPMIapSelection::HandleUserIapSelectionL |
716 // CMPMIapSelection::HandleUserIapSelectionL |
904 void CMPMIapSelection::ImplicitConnectionWlanNoteL() |
773 void CMPMIapSelection::ImplicitConnectionWlanNoteL() |
905 { |
774 { |
906 MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionWlanNoteL" ) |
775 MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionWlanNoteL" ) |
907 |
776 |
908 TWlanIapType wlanType = iCommsDatAccess->CheckWlanL( iUserSelectionIapId ); |
777 TWlanIapType wlanType = iCommsDatAccess->CheckWlanL( iUserSelectionIapId ); |
909 // In case offline mode is enabled, only LAN or WLAN is allowed. |
778 |
910 // If some other bearer has been requested, then error code |
|
911 // KErrGprsOfflineMode should be returned instead of KErrNone. |
|
912 // |
|
913 if( wlanType != ENotWlanIap ) |
779 if( wlanType != ENotWlanIap ) |
914 { |
780 { |
915 iChooseIapState = EImplicitConnection; |
781 ImplicitConnectionL(); |
916 iWlanDialog = CMPMWlanQueryDialog::NewL( *this, iUserSelectionIapId ); |
|
917 iWlanDialog->StartWlanQueryL(); |
|
918 return; |
782 return; |
919 } |
783 } |
920 else |
784 else |
921 { |
785 { |
922 // Check whether confirmation from user is needed for allowing cellular usage. |
786 // Check whether confirmation from user is needed for allowing cellular usage. |
930 if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming ) |
794 if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming ) |
931 { |
795 { |
932 // Check that queries aren't disabled and |
796 // Check that queries aren't disabled and |
933 // enough time has elapsed from the last query cancelled by the user. |
797 // enough time has elapsed from the last query cancelled by the user. |
934 if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) && |
798 if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) && |
935 !iSession->MyServer().IsConnPermQueryTimerOn() ) |
799 !iSession->MyServer().IsConnPermQueryTimerOn() ) |
936 { |
800 { |
937 TConnectionId connId = iSession->ConnectionId(); |
801 TConnectionId connId = iSession->ConnectionId(); |
938 |
802 |
939 // International roaming |
803 // International roaming |
940 iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( |
804 iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( |
1020 void CMPMIapSelection::ImplicitConnectionIapSelectionL() |
876 void CMPMIapSelection::ImplicitConnectionIapSelectionL() |
1021 { |
877 { |
1022 MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionIapSelectionL" ) |
878 MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionIapSelectionL" ) |
1023 iSession->AvailableUnblacklistedIapsL( iStoredAvailableIaps, iSession->ConnectionId() ); |
879 iSession->AvailableUnblacklistedIapsL( iStoredAvailableIaps, iSession->ConnectionId() ); |
1024 |
880 |
1025 // Create and initiate user dialog |
881 // The connection selection dialog doesn't exist any longer, thus |
1026 // |
882 // the HandleUserSelection is called with the Internet SNAP that is returned instead |
1027 iDialog = CMPMDialog::NewL( *this, |
883 TInt err = KErrNone; |
1028 iStoredAvailableIaps, |
884 TInt internetSnapId = 0; |
1029 iChooseIapPref.BearerSet(), |
885 // if the reading leaves, then the internet snap did not exist for some reason |
1030 *iSession->MyServer().ConnectDialogQueue(), |
886 TRAP ( err, internetSnapId = |
1031 iSession->MyServer() ); |
887 iCommsDatAccess->DestinationIdL( CMManager::ESnapPurposeInternet )); |
|
888 HandleUserSelectionL( false, internetSnapId, err ); |
1032 } |
889 } |
1033 |
890 |
1034 // ----------------------------------------------------------------------------- |
891 // ----------------------------------------------------------------------------- |
1035 // CMPMIapSelection::ImplicitConnectionL |
892 // CMPMIapSelection::ImplicitConnectionL |
1036 // ----------------------------------------------------------------------------- |
893 // ----------------------------------------------------------------------------- |