bearermanagement/mpm/src/mpmiapselection.cpp
branchRCL_3
changeset 8 2e6c4614c58e
parent 3 f7816ffc66ed
child 12 ea6e024ea6f9
equal deleted inserted replaced
4:77415202bfc8 8:2e6c4614c58e
   115         }
   115         }
   116 #endif // _DEBUG
   116 #endif // _DEBUG
   117     
   117     
   118     iChooseIapPref = aChooseIapPref;
   118     iChooseIapPref = aChooseIapPref;
   119 
   119 
   120     // Update iNewWlansAllowed information.
       
   121     // No need to filter away cellular iaps here based on UI's Allow Cellular Usage
       
   122     // setting, since ConnMon checks the setting and reports only correct IAPs
       
   123     // available for MPM.
       
   124     iSession->IsWlanOnlyL( iNewWlansAllowed );
       
   125 
       
   126     // Always use stored connection info.
   120     // Always use stored connection info.
   127     // If stored information doesn't exist, a normal sequence is used.
   121     // If stored information doesn't exist, a normal sequence is used.
   128     TUint32 snap( 0 );
   122     TUint32 snap( 0 );
   129     TUint32 iap ( 0 );
   123     TUint32 iap ( 0 );
   130     
   124     
   146         }
   140         }
   147 
   141 
   148     MPMLOGSTRING2( "CMPMIapSelection::ChooseIapL: IapID: %i",
   142     MPMLOGSTRING2( "CMPMIapSelection::ChooseIapL: IapID: %i",
   149             iChooseIapPref.IapId() )
   143             iChooseIapPref.IapId() )
   150     
   144     
       
   145     // Update WLAN only information and whether new WLAN network usage is allowed.
       
   146     TBool wlanOnly = iSession->IsWlanOnlyL( iNewWlansAllowed );
       
   147     
   151     // Check if direct IAP connection is tried to make
   148     // Check if direct IAP connection is tried to make
   152     if ( iChooseIapPref.IapId() != 0 )
   149     if ( iChooseIapPref.IapId() != 0 )
   153         { 
   150         { 
   154         TMPMBearerType bearerType = iSession->MyServer().CommsDatAccess()->GetBearerTypeL( iChooseIapPref.IapId() );
   151         TMPMBearerType bearerType = iSession->MyServer().CommsDatAccess()->GetBearerTypeL( iChooseIapPref.IapId() );
   155         MPMLOGSTRING2( "CMPMIapSelection::ChooseIapL: bearerType: %i", bearerType )
   152         MPMLOGSTRING2( "CMPMIapSelection::ChooseIapL: bearerType: %i", bearerType )
   156 
   153 
   157         // Complete selection with error code if wlan only was set and cellular IAP other 
   154         // Complete selection with error code if wlan only was set and cellular IAP other 
   158         // than MMS IAP was tried to access  
   155         // than MMS IAP was tried to access  
   159         if ( ( iChooseIapPref.BearerSet() ==
   156         if ( wlanOnly && 
   160                TExtendedConnPref::EExtendedConnBearerWLAN ) && 
       
   161                 ( bearerType == EMPMBearerTypePacketData ) && 
   157                 ( bearerType == EMPMBearerTypePacketData ) && 
   162                 ( iSession->IsMMSIap( iChooseIapPref.IapId() ) == EFalse ) ) 
   158                 ( iSession->IsMMSIap( iChooseIapPref.IapId() ) == EFalse ) ) 
   163             {
   159             {            
   164             ChooseIapComplete( KErrPermissionDenied, NULL );
   160             ChooseIapComplete( KErrPermissionDenied, NULL );
   165             return;
   161             return;
   166             }
   162             }
   167         }
   163         }
   168         
   164         
   365             if ( iSession->IsConfirmFirstL( validateIapId ) &&
   361             if ( iSession->IsConfirmFirstL( validateIapId ) &&
   366                  !( iSession->MyServer().CommsDatAccess()->IsVirtualIapL( validateIapId ) ))
   362                  !( iSession->MyServer().CommsDatAccess()->IsVirtualIapL( validateIapId ) ))
   367                 {
   363                 {
   368                 // Check if we are roaming and cellular data usage query has not yet been presented
   364                 // Check if we are roaming and cellular data usage query has not yet been presented
   369                 // to the user in this country
   365                 // to the user in this country
   370                 if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming
   366                 if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming )
   371                     && iSession->MyServer().RoamingWatcher()->AskCellularDataUsageAbroad() == true )
       
   372                     {
   367                     {
   373                     // Check whether queries are enabled
   368                     // Check whether queries are enabled
   374                     if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
   369                     if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
   375                         {
   370                         {
   376                         TConnectionId connId = iSession->ConnectionId();
   371                         TConnectionId connId = iSession->ConnectionId();
   541             // Check whether queries are disabled
   536             // Check whether queries are disabled
   542             if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
   537             if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
   543                 {
   538                 {
   544                 if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming )
   539                 if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming )
   545                     {
   540                     {
   546                     // Check if cellular data usage query has already been presented to the user in this country
   541                     // International roaming
   547                     if ( iSession->MyServer().RoamingWatcher()->AskCellularDataUsageAbroad() == true )
   542                     iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( 
   548                         {
   543                             *this, 
   549                         // International roaming
   544                             connId,
   550                         iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( 
   545                             snap, 
   551                                 *this, 
   546                             validateIapId, 
   552                                 connId,
   547                             CMPMConfirmDlg::EConfirmDlgVisitorNetwork,
   553                                 snap, 
   548                             iChooseIapPref,
   554                                 validateIapId, 
   549                             iSession->MyServer(),
   555                                 CMPMConfirmDlg::EConfirmDlgVisitorNetwork,
   550                             *iSession,
   556                                 iChooseIapPref,
   551                             EExplicitConnection );    
   557                                 iSession->MyServer(),
       
   558                                 *iSession,
       
   559                                 EExplicitConnection );
       
   560                         }
       
   561                     else
       
   562                         {
       
   563                         // If user has already been queried in this country just complete the IAP selection.
       
   564     
       
   565                         iSession->MyServer().AppendBMConnection( connId, 
       
   566                                 snap, 
       
   567                                 validateIapId, 
       
   568                                 EStarting,
       
   569                                 *iSession );
       
   570     
       
   571                         ChooseIapComplete( KErrNone, &iChooseIapPref );
       
   572                         }
       
   573     
       
   574                     }
   552                     }
   575                 else
   553                 else
   576                     {
   554                     {
   577                     // Home network
   555                     // Home network
   578                     iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( 
   556                     iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( 
   751            TExtendedConnPref::ENoteBehaviourConnDisableNotes ) )
   729            TExtendedConnPref::ENoteBehaviourConnDisableNotes ) )
   752         {
   730         {
   753         TBool connectionAlreadyActive =
   731         TBool connectionAlreadyActive =
   754             iSession->MyServer().CheckIfStarted( aPolicyPref->IapId() );
   732             iSession->MyServer().CheckIfStarted( aPolicyPref->IapId() );
   755         CConnectionUiUtilities* connUiUtils = NULL;
   733         CConnectionUiUtilities* connUiUtils = NULL;
   756         TRAPD( popupError,
   734         if ( !connectionAlreadyActive )
   757                connUiUtils = CConnectionUiUtilities::NewL();
   735         	{
   758                connUiUtils->ConnectingViaDiscreetPopup(
   736         	TRAPD( popupError,
   759                    aPolicyPref->IapId(),
   737           	     connUiUtils = CConnectionUiUtilities::NewL();
   760                    connectionAlreadyActive );
   738             	   connUiUtils->ConnectingViaDiscreetPopup(
   761                delete connUiUtils; );
   739               	     aPolicyPref->IapId());
   762         if ( popupError && connUiUtils )
   740                	delete connUiUtils; );
   763             {
   741         	if ( popupError && connUiUtils )
   764             delete connUiUtils;
   742           	  {
   765             }
   743             	delete connUiUtils;
   766         }
   744             	}
       
   745         	}
       
   746        }
   767     
   747     
   768     if( iWlanDialog )
   748     if( iWlanDialog )
   769         {
   749         {
   770         delete iWlanDialog;
   750         delete iWlanDialog;
   771         iWlanDialog = NULL;
   751         iWlanDialog = NULL;
   949         if ( iSession->IsConfirmFirstL( iUserSelectionIapId ) &&
   929         if ( iSession->IsConfirmFirstL( iUserSelectionIapId ) &&
   950              !( iSession->MyServer().CommsDatAccess()->IsVirtualIapL( iUserSelectionIapId ) ) )
   930              !( iSession->MyServer().CommsDatAccess()->IsVirtualIapL( iUserSelectionIapId ) ) )
   951             {
   931             {
   952             // Check if we are roaming and cellular data usage query has not yet been presented
   932             // Check if we are roaming and cellular data usage query has not yet been presented
   953             // to the user in this country
   933             // to the user in this country
   954             if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming
   934             if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming )
   955                 && iSession->MyServer().RoamingWatcher()->AskCellularDataUsageAbroad() == true )
       
   956                 {
   935                 {
   957                 // Check whether queries are enabled
   936                 // Check whether queries are enabled
   958                 if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
   937                 if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
   959                     {
   938                     {
   960                     TConnectionId connId = iSession->ConnectionId();
   939                     TConnectionId connId = iSession->ConnectionId();