Revision: 201035 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 15 Sep 2010 12:38:40 +0300
branchRCL_3
changeset 65 14754bf06654
parent 62 bb1f80fb7db2
child 69 cf1b3ddbe9a1
Revision: 201035 Kit: 201036
bearermanagement/mpm/src/mpmiapselection.cpp
bearermanagement/mpm/src/mpmserver.cpp
bearermanagement/mpm/src/mpmserversession.cpp
cmmanager/gsconnsettingsplugin/loc/gsconnsettingsplugin.loc
--- a/bearermanagement/mpm/src/mpmiapselection.cpp	Tue Sep 14 22:06:05 2010 +0300
+++ b/bearermanagement/mpm/src/mpmiapselection.cpp	Wed Sep 15 12:38:40 2010 +0300
@@ -81,9 +81,9 @@
     {
     // stop confirm dialog in case one exists
     //
+    MPMLOGSTRING( "CMPMIapSelection::~CMPMIapSelection" )
     StopDisplayingStartingDlg();
     
-    delete iConfirmDlgStarting;
     delete iDialog;
     delete iWlanDialog;
     }
@@ -494,12 +494,12 @@
     TConnectionId connId = iSession->ConnectionId();
 
     ChooseBestIAPL( iChooseIapPref, availableIAPList, iNextBestExists );
+    CleanupStack::PopAndDestroy( &availableIAPList );
     TUint32 validateIapId = iChooseIapPref.IapId();
     // Check if any suitable IAP's were found, if not then complete selection with error code
     if ( validateIapId == 0 )
         {
         ChooseIapComplete( KErrNotFound, NULL );
-        CleanupStack::PopAndDestroy( &availableIAPList );
         return;
         }
     
@@ -590,13 +590,9 @@
                         EStarting,
                         *iSession );
                 ChooseIapComplete( KErrNone, &iChooseIapPref );
-
                 }
-
             }
         }
-
-    CleanupStack::PopAndDestroy( &availableIAPList );    
     }
 
 // -----------------------------------------------------------------------------
@@ -730,40 +726,20 @@
     {
     MPMLOGSTRING2( "CMPMIapSelection::ChooseIapComplete aError = %d", aError )
     
-    if ( ( aError == KErrNone ) &&
-        !( iChooseIapPref.NoteBehaviour() &
-           TExtendedConnPref::ENoteBehaviourConnDisableNotes ) )
-        {
-        TConnectionState state =
-            iSession->MyServer().CheckUsageOfIap( aPolicyPref->IapId(), 
-                                                  iSession->ConnectionId() );
-        TBool connectionAlreadyActive = (state == EStarted || state == EStarting || state == ERoaming);
-        if ( !connectionAlreadyActive &&
-                ( iSession->IsMMSIap( aPolicyPref->IapId() ) == EFalse ) )
-            {
-            CConnectionUiUtilities* connUiUtils( NULL );
-            TRAPD( popupError, connUiUtils = CConnectionUiUtilities::NewL() );
-            if ( popupError == KErrNone )
-        	    {
-            	connUiUtils->ConnectingViaDiscreetPopup( aPolicyPref->IapId() );
-               	delete connUiUtils;
-        	    }
-            }
-        }
-    
     if( iWlanDialog )
         {
         delete iWlanDialog;
         iWlanDialog = NULL;
         }
 
-    iSession->ChooseIapComplete( aError, aPolicyPref );
     // Set choose iap state to none
     iChooseIapState = ENoConnection;
     iNextBestExists = EFalse;
     iUserSelectionSnapId = 0;
     iUserSelectionIapId = 0;
     iImplicitState = EImplicitStart;
+
+	iSession->ChooseIapComplete( aError, aPolicyPref );
     }
 
 
@@ -1055,25 +1031,25 @@
     {
     if( iImplicitState  == EImplicitStart )
         {
-        MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionIapSelectionL EImplicitStart" )
+        MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionL EImplicitStart" )
         iImplicitState = EImplicitWlanScan;
         ImplicitConnectionCheckWlanScanNeededL();
         }
     else if( iImplicitState  == EImplicitWlanScan )
         {
-        MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionIapSelectionL EImplicitWlanScan" )
+        MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionL EImplicitWlanScan" )
         iImplicitState = EImplicitUserSelection;
         ImplicitConnectionIapSelectionL();
         }
     else if( iImplicitState  == EImplicitUserSelection )
         {
-        MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionIapSelectionL EImplicitUserSelection" )
+        MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionL EImplicitUserSelection" )
         iImplicitState = EImplicitWlanQuery;
         ImplicitConnectionWlanNoteL();
         }
     else //EImplicitWlanQuery
         {
-        MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionIapSelectionL EImplicitWlanQuery" )
+        MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionL EImplicitWlanQuery" )
         CompleteImplicitConnectionL();
         }
     }
--- a/bearermanagement/mpm/src/mpmserver.cpp	Tue Sep 14 22:06:05 2010 +0300
+++ b/bearermanagement/mpm/src/mpmserver.cpp	Wed Sep 15 12:38:40 2010 +0300
@@ -798,7 +798,9 @@
         if ( iActiveBMConns[i].iConnInfo.iState == EStarting ||
              iActiveBMConns[i].iConnInfo.iState == EStarted )
             {
-            if ( aCdbAccess->CheckWlanL( iActiveBMConns[i].iConnInfo.iIapId ) != ENotWlanIap )
+            TWlanIapType iapType( ENotWlanIap );             	
+            TRAPD ( leave, iapType = aCdbAccess->CheckWlanL( iActiveBMConns[i].iConnInfo.iIapId ) )             	
+            if ( ( leave == KErrNone ) && ( iapType != ENotWlanIap ) )
                 {
                 stopLoop = ETrue;
                 iapId = iActiveBMConns[i].iConnInfo.iIapId;
@@ -1961,11 +1963,21 @@
         {
         // cancel the periodic object        
         self->iRoamingToWlanPeriodic->Cancel();
-        self->StartForcedRoamingToWlanL( self->iConnMonIapInfo );
+        TRAPD( error, self->StartForcedRoamingToWlanL( self->iConnMonIapInfo ) )
+        if ( error )
+            {        	
+            MPMLOGSTRING2("CMPMServer::StartForcedRoamingToConnectedWlan error1 = %d, ", error )
+            return 0;
+            }
+            
         // Added also execution of policy based roaming logic because
         // connections that are in EStarting state, when WLAN signal
         // gets weak, would remain in WLAN as long as signal is weak. 
-        self->StartForcedRoamingFromWlanL( self->iConnMonIapInfo );
+        TRAP( error, self->StartForcedRoamingFromWlanL( self->iConnMonIapInfo ) )
+        if ( error )
+            {        	
+            MPMLOGSTRING2("CMPMServer::StartForcedRoamingToConnectedWlan error2 = %d, ", error )
+            }
         }
     return 0;
     }
@@ -1982,11 +1994,21 @@
         {        
         // cancel the periodic object
         self->iRoamingToHotspotWlanPeriodic->Cancel();
-        self->StartForcedRoamingToWlanL( self->iConnMonIapInfo );
+        TRAPD( error, self->StartForcedRoamingToWlanL( self->iConnMonIapInfo ) )
+        if ( error )
+            {        	
+            MPMLOGSTRING2("StartForcedRoamingToConnectedHotspotWlanL error1 = %d, ", error )
+            return 0;
+            }
+            
         // Added also execution of policy based roaming logic because
         // connections that are in EStarting state, when WLAN signal
         // gets weak, would remain in WLAN as long as signal is weak. 
-        self->StartForcedRoamingFromWlanL( self->iConnMonIapInfo );
+        TRAP( error, self->StartForcedRoamingFromWlanL( self->iConnMonIapInfo ) )
+        if ( error )
+            {        	
+            MPMLOGSTRING2("StartForcedRoamingToConnectedHotspotWlanL error2 = %d, ", error )
+            }
         }
     return 0;
     }
@@ -2027,8 +2049,9 @@
     // to a wlan not anymore listed in available iaps and not using mobility api
     for ( TInt index = 0; index < iActiveBMConns.Count(); index++ )
         {
-        if ( iCommsDatAccess->CheckWlanL( iActiveBMConns[index].iConnInfo.iIapId )
-            == EWlanIap )
+        TWlanIapType iapType( ENotWlanIap );
+        TRAPD( leave, iapType = iCommsDatAccess->CheckWlanL( iActiveBMConns[index].iConnInfo.iIapId ) )        	
+        if ( ( leave == KErrNone ) && ( iapType == EWlanIap ) )
             {
             // Check if used WLAN is still available
             TBool currentWlanIapAvailable = EFalse;
--- a/bearermanagement/mpm/src/mpmserversession.cpp	Tue Sep 14 22:06:05 2010 +0300
+++ b/bearermanagement/mpm/src/mpmserversession.cpp	Wed Sep 15 12:38:40 2010 +0300
@@ -107,6 +107,7 @@
 //
 CMPMServerSession::~CMPMServerSession()
     {
+    MPMLOGSTRING( "CMPMServerSession::~CMPMServerSession" )
 
 
     // Remove serverside objects for notification session.
@@ -3356,26 +3357,6 @@
     {
     MPMLOGSTRING2( "CMPMServerSession::ChooseIapComplete aError = %d", aError )
 
-    // Show error popup if it's allowed per client request.
-	// Error popup shown to SNAP only if error discreet has not been shown for IAP.
-    if ( ChooseBestIapCalled() && (!( iIapSelection->MpmConnPref().NoteBehaviour() &
-            TExtendedConnPref::ENoteBehaviourConnDisableNotes ))
-              && ( aError != KErrNone )
-              && ( iErrorDiscreetPopupShown == EFalse ) )
-        {
-        CConnectionUiUtilities* connUiUtils = NULL;
-        TRAPD( error, connUiUtils = CConnectionUiUtilities::NewL() );
-        if ( error == KErrNone && connUiUtils )
-            {
-            // Note: Below function shows the discreet popup only if the error code
-            // belongs to the set of errors that are shown to the user.
-            // Otherwise the popup is not shown.
-            connUiUtils->ConnectionErrorDiscreetPopup( aError );
-            delete connUiUtils;
-            connUiUtils = NULL;
-            }
-        }
-    
     // Try to write back arguments and complete message.
     // 
     if ( !iChooseIapMessage.IsNull() )
@@ -3430,9 +3411,58 @@
         MPMLOGSTRING( "CMPMServerSession::ChooseIapComplete Message completed" )
         iChooseIapMessage.Complete( aError );
         }
+
+    CConnectionUiUtilities* connUiUtils( NULL );
     
+    MPMLOGSTRING2( "CMPMServerSession::ChooseIapComplete: this = %X", this )
+    MPMLOGSTRING2( "CMPMServerSession::ChooseIapComplete: iIapSelection = %X", iIapSelection )
+
     // Enable showing error discreet popup for SNAP again
+    // Temp var used because session may get deleted during the showing of popup
+    TBool tempErrorDiscreetPopupShown = iErrorDiscreetPopupShown; 
     iErrorDiscreetPopupShown = EFalse;
+    
+    // NOTE: Be careful with discreet popups! It jams session at this point
+    // for a moment, BUT the session may be called meanwhile.
+    // This may/will lead to problems e.g. if session is being deleted => all (heap) objects
+    // deleted in destructor are gone!
+    // Show error popup if it's allowed per client request.
+	// Error popup shown to SNAP only if error discreet has not been shown for IAP.
+    if ( ChooseBestIapCalled() && (!( iIapSelection->MpmConnPref().NoteBehaviour() &
+            TExtendedConnPref::ENoteBehaviourConnDisableNotes ))
+              && ( aError != KErrNone )
+              && ( tempErrorDiscreetPopupShown == EFalse ) )
+        {
+        TRAPD( popupError, connUiUtils = CConnectionUiUtilities::NewL() );
+        if ( popupError == KErrNone )
+            {
+            // Note: Below function shows the discreet popup only if the error code
+            // belongs to the set of errors that are shown to the user.
+            // Otherwise the popup is not shown.
+            connUiUtils->ConnectionErrorDiscreetPopup( aError );
+            delete connUiUtils;
+            connUiUtils = NULL;
+            }
+        }
+    else if ( aPolicyPref &&
+                    ( aError == KErrNone ) &&
+                    !( iIapSelection->MpmConnPref().NoteBehaviour() &
+                            TExtendedConnPref::ENoteBehaviourConnDisableNotes ) )
+        {
+        TConnectionState state = iMyServer.CheckUsageOfIap( aPolicyPref->IapId(), iConnId );
+		TBool connectionAlreadyActive = (state == EStarted || state == EStarting || state == ERoaming);
+        if ( !connectionAlreadyActive &&
+                ( IsMMSIap( aPolicyPref->IapId() ) == EFalse ) )
+            {
+            TRAPD( popupError, connUiUtils = CConnectionUiUtilities::NewL() );
+            if ( popupError == KErrNone )
+                {
+                connUiUtils->ConnectingViaDiscreetPopup( aPolicyPref->IapId() );
+                delete connUiUtils;
+                connUiUtils = NULL;
+                }
+            }
+        }
     }
 
 
--- a/cmmanager/gsconnsettingsplugin/loc/gsconnsettingsplugin.loc	Tue Sep 14 22:06:05 2010 +0300
+++ b/cmmanager/gsconnsettingsplugin/loc/gsconnsettingsplugin.loc	Wed Sep 15 12:38:40 2010 +0300
@@ -90,11 +90,11 @@
 
 
 //d:Text of a list item in Connectivity Settings plugin main view's list
-//d:Item opens "Cellular data usage in home network" radio button setting page
+//d:Item opens "Cellular data usage in home country" radio button setting page
 //l:list_setting_pane_t1
 //w:
 //r: 5.2
-#define qtn_occ_sett_data_usage_home_nw "Cellular data usage in home network"
+#define qtn_occ_sett_data_usage_home_nw "Cellular data usage in home country"
 
 //d:Text in radio button list
 //l:list_set_graphic_pane_t1