diff -r 489cf6208544 -r 95d45f234cf3 bearermanagement/mpm/src/mpmiapselection.cpp --- a/bearermanagement/mpm/src/mpmiapselection.cpp Thu May 27 13:17:01 2010 +0300 +++ b/bearermanagement/mpm/src/mpmiapselection.cpp Wed Jun 23 18:39:24 2010 +0300 @@ -21,8 +21,6 @@ #include "mpmcommsdataccess.h" #include "mpmconnmonevents.h" #include "mpmconfirmdlgstarting.h" -#include "mpmdefaultconnection.h" -#include "mpmwlanquerydialog.h" #include "extendedconnpref.h" // --------------------------------------------------------------------------- @@ -38,7 +36,6 @@ iStoredIapInfo(), iSession( aSession ), iConfirmDlgStarting( NULL ), - iWlanDialog( NULL ), iNextBestExists( EFalse ), iUserSelectionIapId( 0 ), iUserSelectionSnapId( 0 ), @@ -86,7 +83,6 @@ StopDisplayingStartingDlg(); delete iConfirmDlgStarting; - delete iWlanDialog; } // ----------------------------------------------------------------------------- @@ -185,7 +181,7 @@ // Default connection is requested. MPMLOGSTRING( "CMPMIapSelection::ChooseIapL:\ - Default Connection" ) + Default Connection" ) if ( iSession->UseUserConnPref() ) { @@ -201,39 +197,17 @@ return; } + // Read the default connection values TCmDefConnType type( TCmDefConnType( 0 ) ); TUint32 id( 0 ); - iSession->MyServer().DefaultConnection()->GetDefaultConnectionL( type, id ); + iCommsDatAccess->GetDefaultConnectionL( type, id ); MPMLOGSTRING3( "CMPMIapSelection::ChooseIapL:\ - default connection type %d id %d", type, id ) - - if( type == ECmDefConnConnectionMethod ) - { - iChooseIapPref.SetIapId( id ); - iChooseIapPref.SetSnapId( 0 ); - ExplicitConnectionL(); - } - else if( type == ECmDefConnDestination ) - { - iChooseIapPref.SetSnapId( id ); - ExplicitConnectionL(); - } - else - { - if( iCommsDatAccess->IsSnapEmptyL( id ) ) - { - // start implicit connection - ImplicitConnectionL(); - return; - } - - iChooseIapPref.SetSnapId( id ); - - // start connection as if explicitly defined - // by application - ExplicitConnectionL(); - } + default connection type %d id %d", type, id ) + + // set the received snap id and open the connection + iChooseIapPref.SetSnapId( id ); + ExplicitConnectionL(); } else if ( iChooseIapPref.ConnType() == TMpmConnPref::EConnTypeExplicit ) { @@ -350,13 +324,8 @@ iChooseIapPref.SetIapId( validateIapId ); iChooseIapPref.SetNetId( retNetId ); - // In case offline mode is enabled, only LAN or WLAN is allowed. - // If some other bearer has been requested, then error code - // KErrGprsOfflineMode should be returned instead of KErrNone. - // - - if ( !iapTypeLanOrWlan && ( iSession->MyServer().IsPhoneOffline() || - iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMRoamingStatusUnknown ) ) + if ( !iapTypeLanOrWlan && + iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMRoamingStatusUnknown ) { ChooseIapComplete( KErrGprsOfflineMode, &iChooseIapPref ); } @@ -365,9 +334,13 @@ TWlanIapType wlanType = iCommsDatAccess->CheckWlanL( validateIapId ); if( wlanType != ENotWlanIap ) { - iChooseIapState = EExplicitConnection; - iWlanDialog = CMPMWlanQueryDialog::NewL( *this, validateIapId ); - iWlanDialog->StartWlanQueryL(); + // Add info into the BM connections + iSession->MyServer().AppendBMConnection( iSession->ConnectionId(), + iChooseIapPref.SnapId(), + validateIapId, + EStarting, + *iSession ); + ChooseIapComplete( KErrNone, &iChooseIapPref ); return; } @@ -377,34 +350,39 @@ if ( iSession->IsConfirmFirstL( validateIapId ) && !( iSession->MyServer().CommsDatAccess()->IsVirtualIapL( validateIapId ) )) { - // Check if we are roaming and cellular data usage query has not yet been presented - // to the user in this country - if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming ) + + // Check whether queries are enabled + if ( !( iChooseIapPref.NoteBehaviour() + & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) ) { - // Check whether queries are enabled - if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) ) - { - TConnectionId connId = iSession->ConnectionId(); - - // International roaming - iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( - *this, - connId, - snap, - validateIapId, - CMPMConfirmDlg::EConfirmDlgVisitorNetwork, - iChooseIapPref, - iSession->MyServer(), - *iSession, - EExplicitConnection ); - return; - } - else - { - // Queries disabled, connection must fail - ChooseIapComplete( KErrPermissionDenied, &iChooseIapPref ); - return; - } + + TConnectionId connId = iSession->ConnectionId(); + + // Set confirmation type based on roaming status + CMPMConfirmDlg::TDialogType type = + CMPMConfirmDlg::EConfirmDlgHomeNetwork; + if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() + == EMPMInternationalRoaming ) { + type = CMPMConfirmDlg::EConfirmDlgVisitorNetwork; + } + + iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( + *this, + connId, + snap, + validateIapId, + type, + iChooseIapPref, + iSession->MyServer(), + *iSession, + EExplicitConnection ); + return; + } + else + { + // Queries disabled, connection must fail + ChooseIapComplete( KErrPermissionDenied, &iChooseIapPref ); + return; } } @@ -482,10 +460,10 @@ // Check if any suitable IAP's were found, if not then complete selection with error code if ( validateIapId == 0 ) { - if ( iChooseIapPref.ConnType() == TMpmConnPref::EConnTypeDefault || + if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) && + ( iChooseIapPref.ConnType() == TMpmConnPref::EConnTypeDefault || ( iChooseIapPref.ConnType() == TMpmConnPref::EConnTypeExplicit && - !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) && - iCommsDatAccess->IsInternetSnapL( 0, snap ) ) ) + iCommsDatAccess->IsInternetSnapL( 0, snap ) ) ) ) { ImplicitConnectionL(); } @@ -514,8 +492,8 @@ { ChooseIapComplete( KErrGprsServicesNotAllowed, NULL ); } - else if ( !iapTypeLanOrWlan && ( iSession->MyServer().IsPhoneOffline() || - iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMRoamingStatusUnknown ) ) + else if ( !iapTypeLanOrWlan && + iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMRoamingStatusUnknown ) { // In case offline mode is enabled, only LAN or WLAN is allowed. // If some other bearer has been requested, then error code @@ -572,19 +550,14 @@ } else { - if ( !StartWlanQueryIfNeededL( validateIapId ) ) - { - // Add info into the BM connections - // - iSession->MyServer().AppendBMConnection( connId, + // Add info into the BM connections + // + iSession->MyServer().AppendBMConnection( connId, snap, validateIapId, EStarting, *iSession ); - ChooseIapComplete( KErrNone, &iChooseIapPref ); - - } - + ChooseIapComplete( KErrNone, &iChooseIapPref ); } } @@ -623,26 +596,18 @@ } // ----------------------------------------------------------------------------- -// CMPMIapSelection::StartWlanQueryIfNeededL +// CMPMIapSelection::IsIapWlanL // ----------------------------------------------------------------------------- // -TBool CMPMIapSelection::StartWlanQueryIfNeededL( TUint32 aIapId, TBool aIsRoaming ) +TBool CMPMIapSelection::IsIapWlanL( TUint32 aIapId ) { - MPMLOGSTRING3( "CMPMIapSelection::StartWlanQueryIfNeededL iap %d, isRoaming %d ", - aIapId, - aIsRoaming ) - TBool wlanQueryNeeded( EFalse ); - // If wlan iap check if offline note needed + MPMLOGSTRING2( "CMPMIapSelection::StartWlanQueryIfNeededL iap %d, ", aIapId) TWlanIapType wlanType = iCommsDatAccess->CheckWlanL( aIapId ); - if( wlanType != ENotWlanIap ) + if( wlanType != EWlanIap ) { - iIsRoaming = aIsRoaming; - iChooseIapState = EExplicitConnection; - iWlanDialog = CMPMWlanQueryDialog::NewL( *this, aIapId ); - iWlanDialog->StartWlanQueryL(); - wlanQueryNeeded = ETrue; + return EFalse; } - return wlanQueryNeeded; + return ETrue; } // ----------------------------------------------------------------------------- @@ -719,12 +684,6 @@ const TMpmConnPref* aPolicyPref ) { MPMLOGSTRING2( "CMPMIapSelection::ChooseIapComplete aError = %d", aError ) - - if( iWlanDialog ) - { - delete iWlanDialog; - iWlanDialog = NULL; - } iSession->ChooseIapComplete( aError, aPolicyPref ); // Set choose iap state to none @@ -735,62 +694,6 @@ iImplicitState = EImplicitStart; } - -// ----------------------------------------------------------------------------- -// CMPMIapSelection::UserWlanSelectionDoneL -// ----------------------------------------------------------------------------- -// -void CMPMIapSelection::UserWlanSelectionDoneL( TInt aError, TUint32 aIapId ) - { - MPMLOGSTRING( "CMPMIapSelection::UserWlanSelectionDoneL" ) - - if( iIsRoaming ) - { - iIsRoaming = EFalse; - iSession->MigrateCallbackL( aError ); - delete iWlanDialog; - iWlanDialog = NULL; - } - else - { - if( aError != KErrNone ) - { - MPMLOGSTRING2( "CMPMIapSelection::UserWlanSelectionDoneL - Error = %d, completing", aError ) - ChooseIapComplete( aError, NULL ); - } - else - { - if( iChooseIapState == EImplicitConnection ) - { - iUserSelectionIapId = aIapId; - ImplicitConnectionL(); - } - else if( iChooseIapState == EExplicitConnection ) - { - MPMLOGSTRING( "CMPMIapSelection::UserWlanSelectionDoneL completing explicit iap connection" ) - iChooseIapPref.SetIapId( aIapId ); - // Add info into the BM connections - // - iSession->MyServer().AppendBMConnection( iSession->ConnectionId(), - iChooseIapPref.SnapId(), - aIapId, - EStarting, - *iSession ); - delete iWlanDialog; - iWlanDialog = NULL; - - ChooseIapComplete( KErrNone, &iChooseIapPref ); - } - else - { - MPMLOGSTRING( "CMPMIapSelection::UserWlanSelectionDoneL - error, no connection state" ) - } - - } - - } - } - // ----------------------------------------------------------------------------- // CMPMIapSelection::HandleUserSelectionError // ----------------------------------------------------------------------------- @@ -867,15 +770,10 @@ MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionWlanNoteL" ) TWlanIapType wlanType = iCommsDatAccess->CheckWlanL( iUserSelectionIapId ); - // In case offline mode is enabled, only LAN or WLAN is allowed. - // If some other bearer has been requested, then error code - // KErrGprsOfflineMode should be returned instead of KErrNone. - // + if( wlanType != ENotWlanIap ) { - iChooseIapState = EImplicitConnection; - iWlanDialog = CMPMWlanQueryDialog::NewL( *this, iUserSelectionIapId ); - iWlanDialog->StartWlanQueryL(); + ImplicitConnectionL(); return; } else @@ -936,8 +834,8 @@ iapTypeLanOrWlan, *iSession ); - if ( !iapTypeLanOrWlan && ( iSession->MyServer().IsPhoneOffline() || - iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMRoamingStatusUnknown ) ) + if ( !iapTypeLanOrWlan && + iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMRoamingStatusUnknown ) { MPMLOGSTRING2( "CMPMIapSelection::CompleteImplicitConnectionL: Completing with code = %i", KErrGprsOfflineMode ) @@ -959,13 +857,6 @@ iChooseIapPref.SetIapId( iUserSelectionIapId ); iChooseIapPref.SetNetId( retNetId ); - - if( iWlanDialog ) - { - delete iWlanDialog; - iWlanDialog = NULL; - } - ChooseIapComplete( KErrNone, &iChooseIapPref ); }