Revision: 201001 PDK_3.0.f
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 26 Jan 2010 12:12:48 +0200
changeset 3 f7816ffc66ed
parent 2 086aae6fc07e
child 4 77415202bfc8
Revision: 201001 Kit: 201004
alwayson_net_plugin/pdpcontextmanager2/group/pdpcontextmanager2.mmp
alwayson_net_plugin/pdpcontextmanager2/inc/caoconnectionimpl.h
alwayson_net_plugin/pdpcontextmanager2/inc/caoconnectionmonitorimpl.h
alwayson_net_plugin/pdpcontextmanager2/inc/caoserver.h
alwayson_net_plugin/pdpcontextmanager2/inc/caosettings.h
alwayson_net_plugin/pdpcontextmanager2/inc/cenrepobserver.h
alwayson_net_plugin/pdpcontextmanager2/inc/maosettings.h
alwayson_net_plugin/pdpcontextmanager2/src/caoconnectionimpl.cpp
alwayson_net_plugin/pdpcontextmanager2/src/caoconnectionmonitorimpl.cpp
alwayson_net_plugin/pdpcontextmanager2/src/caoserver.cpp
alwayson_net_plugin/pdpcontextmanager2/src/caosettings.cpp
alwayson_net_plugin/pdpcontextmanager2/src/caotimer.cpp
alwayson_net_plugin/pdpcontextmanager2/src/cenrepobserver.cpp
bearermanagement/S60MCPR/src/s60mcpr.cpp
bearermanagement/mpm/inc/mpmcommsdataccess.h
bearermanagement/mpm/inc/mpmserver.h
bearermanagement/mpm/src/mpmcommsdataccess.cpp
bearermanagement/mpm/src/mpmiapselection.cpp
bearermanagement/mpm/src/mpmserver.cpp
bearermanagement/mpm/src/mpmserversession.cpp
cmmanager/cmmgr/Framework/Src/cmconnselectrbpage.cpp
cmmanager/cmmgr/Plugins/cmpluginvpn/inc/cmpluginvpn.h
cmmanager/cmmgr/Plugins/cmpluginvpn/src/cmpluginvpn.cpp
cmmanager/cmmgr/Plugins/cmpluginvpn/src/cmpvpnsettingsdlg.cpp
connectionmonitoring/connectionmonitorplugin/data/10281BC1.rss
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonBearerGPRS.h
connectionmonitoring/connmon/connectionmonitor/src/ConnMonBearerGPRS.cpp
connectionmonitoring/connmon/connectionmonitor/src/cellulardatausagekeyupdater.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/ChangeConnectionDlg.cpp
data/cccccc00_emulator.cre
--- a/alwayson_net_plugin/pdpcontextmanager2/group/pdpcontextmanager2.mmp	Mon Jan 18 20:33:49 2010 +0200
+++ b/alwayson_net_plugin/pdpcontextmanager2/group/pdpcontextmanager2.mmp	Tue Jan 26 12:12:48 2010 +0200
@@ -51,6 +51,7 @@
 SOURCE          caoconnectionmonitorimpl.cpp
 SOURCE          caoconnectionimpl.cpp
 SOURCE          linger.cpp
+SOURCE          cenrepobserver.cpp
 
 
 // Component specific internal headers 
@@ -81,6 +82,8 @@
 LIBRARY         etelmm.lib
 LIBRARY         CustomAPI.lib
 LIBRARY         etel.lib
+LIBRARY         extendedconnpref.lib
+LIBRARY         netmeta.lib
 #ifdef LOGGING_ENABLED
 #ifdef LOGGING_MODE_FILE
 LIBRARY         efsrv.lib
--- a/alwayson_net_plugin/pdpcontextmanager2/inc/caoconnectionimpl.h	Mon Jan 18 20:33:49 2010 +0200
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/caoconnectionimpl.h	Tue Jan 26 12:12:48 2010 +0200
@@ -24,6 +24,7 @@
 #include <commdbconnpref.h>
 #include <es_sock.h>
 #include <commdb.h>
+#include <extendedconnpref.h>
 #include "maoconnectionmanager.h"
 
 // FORWARD DECLARATIONS
@@ -279,13 +280,11 @@
     TInternalState iState;
     
     /**
-     * Own: Access point settings
-     */
-    TCommDbConnPref iAccessPointSettings;
-    
-    /**
      * Own: Comms database
      */
     CCommsDatabase* iCommsDatabase;
+    
+    TConnPrefList*        iPrefsList;
+    TExtendedConnPref*    iExtPrefs;
     };
 #endif /* CAOCONNECTIONIMPL_H */
--- a/alwayson_net_plugin/pdpcontextmanager2/inc/caoconnectionmonitorimpl.h	Mon Jan 18 20:33:49 2010 +0200
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/caoconnectionmonitorimpl.h	Tue Jan 26 12:12:48 2010 +0200
@@ -304,6 +304,11 @@
      * Own: Bearer type
      */
     TInt iBearerValue;
+    
+    /**
+     * Own: Retry counter
+     */
+    TInt iCounter;
     };
 
 #endif /* CAOCONNECTIONMONITORIMPL_H */
--- a/alwayson_net_plugin/pdpcontextmanager2/inc/caoserver.h	Mon Jan 18 20:33:49 2010 +0200
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/caoserver.h	Tue Jan 26 12:12:48 2010 +0200
@@ -36,6 +36,7 @@
 #include "maoraumanagerobserver.h"
 #include "maogpdsobserver.h"
 #include "caoasyncwrapper.h"
+#include "cenrepobserver.h"
 
 // FORWARD DECLARATIONS
 class CAOConnectionManager;
@@ -43,6 +44,8 @@
 class CAORAUManager;
 class CAOSettings;
 class CAOGpds;
+class CAOCenRepObserver;
+class MAOCenRepObserver;
 
 /**
 *  Always-On Server class.
@@ -57,7 +60,8 @@
     public MAOConnectionManagerObserver,
     public MAOTimerObserver,
     public MAOSettingsObserver,
-    public MAORAUManagerObserver
+    public MAORAUManagerObserver,
+    public MAOCenRepObserver
     {
 public:    // Constructors & destructors
 
@@ -402,6 +406,18 @@
      */
     void HandleSuccesfulRAUL( TRAUType aType );
     
+private: // From base class MAOCenRepObserver
+	
+	  /**
+     * From MAOCenRepObserver
+     * a notification when Central Repository key 
+     * KCRUidCmManager/ KCurrentCellularDataUsage changes.
+     *
+     * @since S60 5.1
+     * @param aValue New key value
+     */
+    void CurrentCellularDataUsageChangedL( const TInt aValue );
+    
     
 private: // Data
 
@@ -495,6 +511,12 @@
      * Own
      */ 
     CPeriodic* iAsyncSetup;
+    
+    /** 
+     * Central repository key watcher
+     * Own
+     */ 
+    CAOCenRepObserver* iCenRepObserver;
     };
 
 #endif //C_CAOSERVER_H
--- a/alwayson_net_plugin/pdpcontextmanager2/inc/caosettings.h	Mon Jan 18 20:33:49 2010 +0200
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/caosettings.h	Tue Jan 26 12:12:48 2010 +0200
@@ -183,6 +183,16 @@
      */
     TInt LingerTimerValue( const TUint aIapId ) const;
     
+    /**
+     * Checks whether user allows cellular connections
+     * or not.
+     *
+     * @since 5.1
+     * @return ETrue if cellular connections are allowed,
+     *         EFalse otherwise.
+     */
+    TBool IsCellularAllowedByUser() const;
+    
 private: // From base class MAOSettings
     
     /** 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/cenrepobserver.h	Tue Jan 26 12:12:48 2010 +0200
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Listens for changes in a Central Repository key.
+*
+*/
+
+#ifndef AOCENREPOBSERVER_H
+#define AOCENREPOBSERVER_H
+
+// FORWARD DECLARATIONS
+class CRepository;
+class MAOConnectionObserver;
+
+// Stop requesting new notifications after this many consecutive errors
+const TInt KCenRepErrorRetryCount = 80;
+
+/**
+* MAOCenRepObserver
+*
+* Client application must implement the AOCenRepObserver interface in
+* order to receive a notification when Central Repository key 
+* KCRUidCmManager/ KCurrentCellularDataUsage changes.
+*
+* @lib PDPCONTEXTMANAGER2.LIB
+*/
+class MAOCenRepObserver
+    {
+public:
+    /**
+    * This method is called every time when Central Repository key 
+    * KCRUidCmManager/ KCurrentCellularDataUsage changes.
+    *
+    * @param aValue The new value for KCurrentCellularDataUsage.
+    */
+    virtual void CurrentCellularDataUsageChangedL( const TInt aValue ) = 0;
+    };
+
+/**
+* CAOCenRepObserver
+*
+* @lib DPCONTEXTMANAGER2.LIB
+*/
+NONSHARABLE_CLASS( CAOCenRepObserver ) : public CActive
+    {
+public:
+    static CAOCenRepObserver* NewL( MAOCenRepObserver& aObserver );
+
+    static CAOCenRepObserver* NewLC( MAOCenRepObserver& aObserver );
+
+    virtual ~CAOCenRepObserver();
+
+private:
+    CAOCenRepObserver( MAOCenRepObserver& aObserver );
+
+    void ConstructL();
+    void RequestNotifications();
+ 
+private: // Methods from base class
+    void DoCancel();
+    void RunL();
+
+private:
+    MAOCenRepObserver& iObserver;
+    CRepository*       iRepository;
+    TInt               iErrorCounter;
+    };
+
+#endif // AOCENREPOBSERVER_H
+
+// End-of-file
--- a/alwayson_net_plugin/pdpcontextmanager2/inc/maosettings.h	Mon Jan 18 20:33:49 2010 +0200
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/maosettings.h	Tue Jan 26 12:12:48 2010 +0200
@@ -91,6 +91,16 @@
      * @return TInt
      */
     virtual TInt LingerTimerValue( const TUint aIapId ) const = 0;
+    
+    /**
+     * Checks whether user allows cellular connections
+     * or not.
+     *
+     * @since 5.1
+     * @return ETrue if cellular connections are allowed,
+     *         EFalse otherwise.
+     */
+     virtual TBool IsCellularAllowedByUser() const = 0;
         
 protected:
 
--- a/alwayson_net_plugin/pdpcontextmanager2/src/caoconnectionimpl.cpp	Mon Jan 18 20:33:49 2010 +0200
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/caoconnectionimpl.cpp	Tue Jan 26 12:12:48 2010 +0200
@@ -35,9 +35,6 @@
     // CONSTANTS
     _LIT( KPanicCat, "ConnectionImpl" );
     
-    // Default value that indicates that we do not want to prompt user for IAP
-    const TCommDbDialogPref KDlgPreference = ECommDbDialogPrefDoNotPrompt;
-    
     // DATA TYPES
     enum TPanicCode
         {
@@ -93,6 +90,9 @@
     
     delete iCommsDatabase;
     iConnection.Close();
+    
+    delete iExtPrefs;
+    delete iPrefsList;
     }
 
 
@@ -112,7 +112,7 @@
     
     // Check IAP
     TUint iap = iSettings.AccessPointId();
-    if ( IsValidIAP( iap ) )
+    if ( IsValidIAP( iap ) && iSettings.IsCellularAllowedByUser() )
         {
         // Check that we really have RConnection handle opened
         TInt err = KErrNone;
@@ -123,14 +123,25 @@
             }
     
         if( err == KErrNone )
-            {
-			// Set acces point settings
-			iAccessPointSettings.SetIapId( iap );
-			iAccessPointSettings.SetDialogPreference( KDlgPreference );
-        
-			// Start connection
-    		iConnection.Start( iAccessPointSettings, iStatus );
-			SetActive();
+            {    		
+            // Start as a silent connection
+            iExtPrefs->SetIapId( iap );
+            iExtPrefs->SetNoteBehaviour( TExtendedConnPref::ENoteBehaviourConnSilent );
+    		
+            // Clean iPrefsList and append new prefs
+            iPrefsList->Remove( 0 );
+            TRAPD( err, iPrefsList->AppendL( iExtPrefs ) )
+    		
+            if ( err == KErrNone )
+                {
+    		    iConnection.Start( *iPrefsList, iStatus );
+                SetActive();
+                }
+            else
+                {
+                LOG_1( _L("iPrefsList->AppendL( iExtPrefs ) FAILED") );
+                ActivateSelf( KErrNotSupported );
+                }
             }
         else
             {
@@ -267,6 +278,9 @@
     
     User::LeaveIfError( iConnection.Open( *iSocketServ, KAfInet ) );
     iCommsDatabase = CCommsDatabase::NewL( EDatabaseTypeUnspecified );
+    
+    iExtPrefs = new (ELeave) TExtendedConnPref;
+    iPrefsList = TConnPrefList::NewL();
     }
 
 // ---------------------------------------------------------------------------
--- a/alwayson_net_plugin/pdpcontextmanager2/src/caoconnectionmonitorimpl.cpp	Mon Jan 18 20:33:49 2010 +0200
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/caoconnectionmonitorimpl.cpp	Tue Jan 26 12:12:48 2010 +0200
@@ -23,6 +23,7 @@
 #include "maoconnectionmonitorobserver.h"
 #include "caoasyncwrapper.h"
 
+
 // UNNAMED NAMESPACE FOR LOCAL DEFINITIONS
 namespace
     {
@@ -50,6 +51,9 @@
 #endif
     }
 
+const TInt KRetryCounter = 10;
+
+
 // METHODS
 
 // ---------------------------------------------------------------------------
@@ -224,10 +228,23 @@
         
     if ( aStatus == KErrNone )
         {
-        LOG_2( _L("> NW reg. status: %d"), iWNReg.iRegStatus );
-        iObserver.HandleNWRegistrationStatusChangedL( 
-            iWNRegPckg().iRegStatus );
-        }
+        LOG_2( _L("> Current iWNReg.iRegStatus: %d"), iWNReg.iRegStatus );
+	
+        if ( ( iWNReg.iRegStatus < iWNChangeReg.iRegStatus ) && 
+        	   ( iCounter < KRetryCounter ) )
+            {
+            iCounter++;	
+            LOG_2( _L("> Different from events iWNChangeReg.iRegStatusv: %d"), 
+                   iWNChangeReg.iRegStatus );	
+            iNWRegistrationStatus->IssueRequest();	
+            }
+        else
+            {
+            iCounter = 0;	
+            iObserver.HandleNWRegistrationStatusChangedL( 
+                iWNRegPckg().iRegStatus );	
+            }        
+        } 
     else
         {
         HandleError( aStatus );
--- a/alwayson_net_plugin/pdpcontextmanager2/src/caoserver.cpp	Mon Jan 18 20:33:49 2010 +0200
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/caoserver.cpp	Tue Jan 26 12:12:48 2010 +0200
@@ -18,6 +18,7 @@
 
 // INCLUDE FILES
 #include <mmtsy_names.h>
+#include <cmgenconnsettings.h>
 
 #include "caoserver.h"
 #include "caoconnectionmanager.h"
@@ -179,6 +180,7 @@
         delete iPointerStatePool;    
         }
     
+    delete iCenRepObserver;
     delete iGpds;
     delete iRAUManager;
     delete iTimer;
@@ -227,6 +229,8 @@
 #endif // __ALWAYS_ON_CUSTOM_API
     
     iGpds = CAOGpds::NewL( iCustomAPI );
+    	
+    iCenRepObserver = CAOCenRepObserver::NewL( *this );	
     
     InitStatePoolL();
         
@@ -935,6 +939,37 @@
         }
     }
 
+// ---------------------------------------------------------------------------
+// CAOServer::CurrentCellularDataUsageChanged
+// ---------------------------------------------------------------------------
+//
+void CAOServer::CurrentCellularDataUsageChangedL( const TInt aValue )
+	  {
+    LOG_1( _L("CAOServer::CurrentCellularDataUsageChanged") );
+    LOG_2( _L("> Current state: %S"),
+        &StateToDesC( CurrentState()->StateName() ) );
+    
+    if ( aValue != ECmCellularDataUsageDisabled )
+        {
+        TAOState* newState = NULL;
+        	
+        if ( CurrentState()->StateName() == TAOState::EStateDisabled )
+            {
+            newState = iCurrentState->HandleEnableAlwaysOnL();
+            }
+        else
+            {
+            // Behaviour is the same as if unconnect timer had expired
+            iTimer->StopUnconnectTimer();
+            newState = iCurrentState->HandleUnconnectTimerExpiredL();
+
+            if( newState )
+                {
+                iCurrentState = newState;
+                }
+            }
+        }  	
+    }
 
 // ---------------------------------------------------------------------------
 // CAOServer::InitStatePoolL
--- a/alwayson_net_plugin/pdpcontextmanager2/src/caosettings.cpp	Mon Jan 18 20:33:49 2010 +0200
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/caosettings.cpp	Tue Jan 26 12:12:48 2010 +0200
@@ -18,6 +18,9 @@
 
 // INCLUDE FILES
 #include <centralrepository.h>
+#include <cmmanagerkeys.h>
+#include <cmgenconnsettings.h>
+
 
 #include "caosettings.h"
 #include "logger.h"
@@ -568,4 +571,31 @@
         }
     }
 
+// ---------------------------------------------------------------------------
+// CAOSettings::IsCellularAllowedByUser
+// ---------------------------------------------------------------------------
+//
+TBool CAOSettings::IsCellularAllowedByUser() const
+    {
+    TBool allowed( ETrue );
+    CRepository* repository = NULL;
+    
+    TRAP_IGNORE( repository = CRepository::NewL( KCRUidCmManager ) )
+
+    if ( repository )
+        {
+        TInt value( 0 );
+        TInt err = repository->Get( KCurrentCellularDataUsage, value );
+
+        if ( err == KErrNone && value == ECmCellularDataUsageDisabled )
+            {
+            // Cellular connection is not allowed by user
+            allowed = EFalse;
+            }    
+        }
+
+    delete repository;
+    return allowed;
+    }
+
 // End of file
--- a/alwayson_net_plugin/pdpcontextmanager2/src/caotimer.cpp	Mon Jan 18 20:33:49 2010 +0200
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/caotimer.cpp	Tue Jan 26 12:12:48 2010 +0200
@@ -210,7 +210,16 @@
     {
     LOG_1( _L("CAOTimer::UnconnectTimerDisabled") );
     
-    return iSettings.UnconnectTimerValue() == 0;
+    if ( iSettings.IsCellularAllowedByUser() )
+        {
+        return iSettings.UnconnectTimerValue() == 0;
+        }
+    else
+        {
+        // There should be no retries because user
+        // does not allow cellular connections.
+        return ETrue;
+        }
     }
 
 // ---------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/cenrepobserver.cpp	Tue Jan 26 12:12:48 2010 +0200
@@ -0,0 +1,166 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Listens to changes in a Central Repository key 
+*               KCurrentCellularDataUsage in Repository KCRUidCmManager.
+*/
+
+#include <commsdat.h>
+#include <centralrepository.h>
+#include <cmmanagerkeys.h>
+
+#include "cenrepobserver.h"
+#include "logger.h"
+
+// -----------------------------------------------------------------------------
+// CAOCenRepObserver::NewL
+// -----------------------------------------------------------------------------
+//
+CAOCenRepObserver* CAOCenRepObserver::NewL( MAOCenRepObserver& aObserver )
+    {
+    CAOCenRepObserver* self = 
+             CAOCenRepObserver::NewLC( aObserver );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CAOCenRepObserver::NewLC
+// -----------------------------------------------------------------------------
+//
+CAOCenRepObserver* CAOCenRepObserver::NewLC( MAOCenRepObserver& aObserver )
+    {
+    CAOCenRepObserver* self = 
+             new( ELeave ) CAOCenRepObserver( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CAOCenRepObserver::~CAOCenRepObserver
+// -----------------------------------------------------------------------------
+//
+CAOCenRepObserver::~CAOCenRepObserver()
+    {
+    // Cancel outstanding request, if exists
+    Cancel();
+    delete iRepository;
+    }
+
+// -----------------------------------------------------------------------------
+// CAOCenRepObserver::CAOCenRepObserver
+// -----------------------------------------------------------------------------
+//
+CAOCenRepObserver::CAOCenRepObserver( MAOCenRepObserver& aObserver )
+        :
+        CActive( CActive::EPriorityStandard ),
+        iObserver( aObserver )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CAOCenRepObserver::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CAOCenRepObserver::ConstructL()
+    {    
+    TRAPD( err, iRepository = CRepository::NewL( KCRUidCmManager ) )
+     
+    if ( err == KErrNone )
+        {
+        CActiveScheduler::Add( this );
+        RequestNotifications();
+        }
+    else
+        {
+        LOG_2( _L("FAILED to open KCRUidCmManager repository <%d>"), err ); 
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CAOCenRepObserver::RequestNotifications
+// -----------------------------------------------------------------------------
+//
+void CAOCenRepObserver::RequestNotifications()
+    {
+    LOG_1( _L("CAOCenRepObserver::RequestNotifications") );
+
+    TInt err = iRepository->NotifyRequest( KCurrentCellularDataUsage, iStatus );
+
+    if ( err == KErrNone )
+        {
+        SetActive();
+        }
+    else
+        {
+        LOG_2( _L("ERROR, iRepository->NotifyRequest() %d"), err );	
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CAOCenRepObserver::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CAOCenRepObserver::DoCancel()
+    {
+    iRepository->NotifyCancel( KCurrentCellularDataUsage );
+    }
+
+// -----------------------------------------------------------------------------
+// CAOCenRepObserver::RunL
+// -----------------------------------------------------------------------------
+//
+void CAOCenRepObserver::RunL()
+    {
+    LOG_2( _L("CAOCenRepObserver::RunL() %d"), iStatus.Int() );
+
+    if ( iStatus.Int() < KErrNone )
+        {
+        iErrorCounter++;
+        if ( iErrorCounter > KCenRepErrorRetryCount )
+            {
+            LOG_2( _L("Over %d consecutive errors, stopping notifications permanently"), 
+                   KCenRepErrorRetryCount );	
+            return;
+            }
+        }
+    else
+        {
+        iErrorCounter = 0;
+        
+        TInt value( 0 );
+        TInt err = iRepository->Get( KCurrentCellularDataUsage, value );
+            
+        if ( err == KErrNone )
+            {
+            LOG_2( _L("KCurrentCellularDataUsage: %d"), value );
+                   	
+            TRAPD( leaveCode, iObserver.CurrentCellularDataUsageChangedL( value ) )
+            
+            if ( leaveCode )
+                {
+                LOG_2( _L("iObserver->CurrentCellularDataUsageChangedL FAILED: %d"), 
+                       leaveCode );
+                }
+            }
+        else
+            {
+            LOG_2( _L("ERROR, iRepository->Get(KCurrentCellularDataUsage) %d"), err );
+            }
+        }
+
+    RequestNotifications();
+    }
+
+// End-of-file
--- a/bearermanagement/S60MCPR/src/s60mcpr.cpp	Mon Jan 18 20:33:49 2010 +0200
+++ b/bearermanagement/S60MCPR/src/s60mcpr.cpp	Tue Jan 26 12:12:48 2010 +0200
@@ -464,10 +464,14 @@
     // Store PolicyNotification
     // This could happen if PolicyServer sends notification too early.
     //
+    S60MCPRLOGSTRING1("S60MCPR<%x>::StorePolicyNotification()",(TInt*)this);
     if ( iPendingNotification.Length() == 0 )
         {
-        ASSERT(Mem::Copy((TAny*)iPendingNotification.Ptr(), &aNotification, aNotification.Length()));
-        iPendingNotification.SetLength( aNotification.Length() );
+        S60MCPRLOGSTRING1("S60MCPR<%x>::StorePolicyNotification() iPendingNotification.Length() == 0",(TInt*)this);
+        Mem::Copy((TAny*)iPendingNotification.Ptr(), &aNotification, KMpmMessageLength);
+        S60MCPRLOGSTRING1("S60MCPR<%x>::StorePolicyNotification() Mem::Copy",(TInt*)this);
+        iPendingNotification.SetLength( KMpmMessageLength );
+        S60MCPRLOGSTRING1("S60MCPR<%x>::StorePolicyNotification() iPendingNotification.SetLength",(TInt*)this);
         }
 #ifdef _DEBUG
     else
--- a/bearermanagement/mpm/inc/mpmcommsdataccess.h	Mon Jan 18 20:33:49 2010 +0200
+++ b/bearermanagement/mpm/inc/mpmcommsdataccess.h	Tue Jan 26 12:12:48 2010 +0200
@@ -468,6 +468,18 @@
         */
         TUint32 DestinationIdL( CMManager::TSnapPurpose aSnapPurpose );
         	
+        /**
+        * Finds the real IAP behind the virtual IAP.
+        * @since 3.1
+        * @param aVirtualIapId Given virtual Iap Id
+        * @param aRealIapId Real Iap Id
+        * @param aAvailableIAPList List of IAPs
+        * @param aSession Handle to session class
+        */
+        void FindRealIapL( const TUint32             aVirtualIapId,
+                           TUint32&                  aRealIapId, 
+                           const RAvailableIAPList&  aAvailableIAPList,
+                           CMPMServerSession&        aSession );
     private:
 
        /**
@@ -497,20 +509,7 @@
         * @return ETrue WLAN IAP exists under the virtual IAP, 
         * otherwise EFalse.
         */
-        TBool WlanUnderVirtualL( const TUint32 aVirtualIapId, RArray<TUint>& aIapPath  );
-
-        /**
-        * Finds the real IAP behind the virtual IAP.
-        * @since 3.1
-        * @param aVirtualIapId Given virtual Iap Id
-        * @param aRealIapId Real Iap Id
-        * @param aAvailableIAPList List of IAPs
-        * @param aSession Handle to session class
-        */
-        void FindRealIapL( const TUint32             aVirtualIapId,
-                           TUint32&                  aRealIapId, 
-                           const RAvailableIAPList&  aAvailableIAPList,
-                           CMPMServerSession&        aSession );
+        TBool WlanUnderVirtualL( const TUint32 aVirtualIapId, RArray<TUint>& aIapPath  );        
 
        /**
         * loads linked record using element id.
--- a/bearermanagement/mpm/inc/mpmserver.h	Mon Jan 18 20:33:49 2010 +0200
+++ b/bearermanagement/mpm/inc/mpmserver.h	Tue Jan 26 12:12:48 2010 +0200
@@ -823,6 +823,16 @@
         * @return Number of active connections
         */
         TInt NumberOfActiveConnections();
+
+        /**
+        * Returns server session instance that corresponds to given
+        * connection id.
+        * @since 5.2
+        * @param aConnId Id of the connection. The id must belong to an
+        *                existing server session.
+        * @return Server session instance
+        */
+        CMPMServerSession* GetServerSession( TConnectionId aConnId ) const;
         
     private:
 
@@ -852,15 +862,6 @@
                                 TBool aCheckForBestIap,
                                 TMPMBearerType aDestinationBearerType );
         
-        /**
-        * Returns server session instance that corresponds to given
-        * connection id.
-        * @since 5.2
-        * @param aConnId Id of the connection. The id must belong to an
-        *                existing server session.
-        * @return Server session instance
-        */
-        CMPMServerSession* GetServerSession( TConnectionId aConnId ) const;
 
     private: // Data
         // Pointer to the ConnMonEvents object
--- a/bearermanagement/mpm/src/mpmcommsdataccess.cpp	Mon Jan 18 20:33:49 2010 +0200
+++ b/bearermanagement/mpm/src/mpmcommsdataccess.cpp	Tue Jan 26 12:12:48 2010 +0200
@@ -2736,8 +2736,13 @@
         
     for (TInt index = 0; index < aActiveBMConns.Count(); index++ )
         {
+        CMPMServerSession* serverSession = 
+            aSession.MyServer().GetServerSession(
+                aActiveBMConns[index].iConnInfo.iConnId );
+
         // Add only started iaps to array
-        if ( aActiveBMConns[index].iConnInfo.iState == EStarted )
+        if ( aActiveBMConns[index].iConnInfo.iState == EStarted &&
+             serverSession->ChooseBestIapCalled() )
             {
             activeIaps.AppendL ( aActiveBMConns[index].iConnInfo.iIapId );
             }
--- a/bearermanagement/mpm/src/mpmiapselection.cpp	Mon Jan 18 20:33:49 2010 +0200
+++ b/bearermanagement/mpm/src/mpmiapselection.cpp	Tue Jan 26 12:12:48 2010 +0200
@@ -117,33 +117,12 @@
     
     iChooseIapPref = aChooseIapPref;
 
-    if ( iSession->IsWlanOnlyL( iNewWlansAllowed ) )
-        {
-        if ( iChooseIapPref.BearerSet() ==
-             TExtendedConnPref::EExtendedConnBearerUnknown )
-            {
-            // Force bearerset to WLAN if received bearerset was empty
-            iChooseIapPref.SetBearerSet(
-                TExtendedConnPref::EExtendedConnBearerWLAN );
-            }
-        else if ( iChooseIapPref.BearerSet() &
-                  TExtendedConnPref::EExtendedConnBearerWLAN )
-            {
-            // Force bearerset to WLAN only in case where wlan was included
-            // in the received bearerset.
-            iChooseIapPref.SetBearerSet(
-                TExtendedConnPref::EExtendedConnBearerWLAN );          
-            }
-        else
-            {
-            // If wlan was not included in received bearerset,
-            // complete selection with error code
-            ChooseIapComplete( KErrPermissionDenied,
-                               iSession->MyServer().UserConnPref() );
-            return; 
-            }
-        }
-    
+    // Update iNewWlansAllowed information.
+    // No need to filter away cellular iaps here based on UI's Allow Cellular Usage
+    // setting, since ConnMon checks the setting and reports only correct IAPs
+    // available for MPM.
+    iSession->IsWlanOnlyL( iNewWlansAllowed );
+
     // Always use stored connection info.
     // If stored information doesn't exist, a normal sequence is used.
     TUint32 snap( 0 );
@@ -382,31 +361,38 @@
 
             // Check whether confirmation from user is needed for allowing cellular usage.
             // When application is starting an IAP confirmation is asked only when roaming.
-            if ( iSession->IsConfirmFirstL( validateIapId ) )
+            // This is skipped for VPN (= virtual) IAPs
+            if ( iSession->IsConfirmFirstL( validateIapId ) &&
+                 !( iSession->MyServer().CommsDatAccess()->IsVirtualIapL( validateIapId ) ))
                 {
-                // Check whether queries are disabled
-                if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
+                // 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
+                    && iSession->MyServer().RoamingWatcher()->AskCellularDataUsageAbroad() == true )
                     {
-                    if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming )
+                    // Check whether queries are enabled
+                    if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
                         {
-                        // Check if cellular data usage query has already been presented to the user in this country
-                       if ( iSession->MyServer().RoamingWatcher()->AskCellularDataUsageAbroad() == true )
-                            {
-                            TConnectionId connId = iSession->ConnectionId();
+                        TConnectionId connId = iSession->ConnectionId();
                                                             
-                            // International roaming
-                            iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( 
-                                                  *this, 
-                                                  connId,
-                                                  snap, 
-                                                  validateIapId, 
-                                                  CMPMConfirmDlg::EConfirmDlgVisitorNetwork,
-                                                  iChooseIapPref,
-                                                  iSession->MyServer(),
-                                                  *iSession,
-                                                  EExplicitConnection );
-                            return;    
-                            }
+                        // 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;
                         }
                     }
                 }
@@ -547,8 +533,10 @@
     else
         {
         // Check whether confirmation from user is needed for allowing cellular usage
+		// This is skipped for VPN (= virtual) IAPs
         if ( ( iSession->IsConfirmFirstL( validateIapId ) ) && 
-             ( iSession->MyServer().CommsDatAccess()->CheckWlanL( validateIapId ) == ENotWlanIap ) )
+             ( iSession->MyServer().CommsDatAccess()->CheckWlanL( validateIapId ) == ENotWlanIap ) &&
+             !( iSession->MyServer().CommsDatAccess()->IsVirtualIapL( validateIapId ) ) )
             {
             // Check whether queries are disabled
             if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
@@ -957,31 +945,38 @@
         {
         // Check whether confirmation from user is needed for allowing cellular usage.
         // When user is starting implicit IAP/SNAP confirmation is asked only when roaming.
-        if ( iSession->IsConfirmFirstL( iUserSelectionIapId ) )
+		// This is skipped for VPN (= virtual) IAPs
+        if ( iSession->IsConfirmFirstL( iUserSelectionIapId ) &&
+             !( iSession->MyServer().CommsDatAccess()->IsVirtualIapL( iUserSelectionIapId ) ) )
             {
-            // Check whether queries are disabled
-            if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
+            // 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
+                && iSession->MyServer().RoamingWatcher()->AskCellularDataUsageAbroad() == true )
                 {
-                if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming )
+                // Check whether queries are enabled
+                if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
                     {
-                    // Check if cellular data usage query has already been presented to the user in this country
-                    if ( iSession->MyServer().RoamingWatcher()->AskCellularDataUsageAbroad() == true )
-                        {
-                        TConnectionId connId = iSession->ConnectionId();
+                    TConnectionId connId = iSession->ConnectionId();
                                                                     
-                        // International roaming
-                        iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( 
-                                              *this, 
-                                              connId,
-                                              iUserSelectionSnapId, 
-                                              iUserSelectionIapId, 
-                                              CMPMConfirmDlg::EConfirmDlgVisitorNetwork,
-                                              iChooseIapPref,
-                                              iSession->MyServer(),
-                                              *iSession,
-                                              EImplicitConnection );
-                        return;    
-                        }
+                    // International roaming
+                    iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( 
+                        *this, 
+                        connId,
+                        iUserSelectionSnapId, 
+                        iUserSelectionIapId, 
+                        CMPMConfirmDlg::EConfirmDlgVisitorNetwork,
+                        iChooseIapPref,
+                        iSession->MyServer(),
+                        *iSession,
+                        EImplicitConnection );
+                    return;    
+                    }
+                else
+                    {
+                    // Queries disabled, connection must fail
+                    ChooseIapComplete( KErrPermissionDenied, &iChooseIapPref );
+                    return;
                     }
                 }
             }
--- a/bearermanagement/mpm/src/mpmserver.cpp	Mon Jan 18 20:33:49 2010 +0200
+++ b/bearermanagement/mpm/src/mpmserver.cpp	Tue Jan 26 12:12:48 2010 +0200
@@ -1616,8 +1616,12 @@
     // Use priority order vpn, wlan and packet
     for ( TInt index = 0; index < iActiveBMConns.Count(); index++ )
         {
+        CMPMServerSession* serverSession = GetServerSession(
+            iActiveBMConns[index].iConnInfo.iConnId );
+                     	
         // Do check only for active connections
-        if ( iActiveBMConns[index].iConnInfo.iState == EStarted )
+        if ( iActiveBMConns[index].iConnInfo.iState == EStarted &&
+        	   serverSession->ChooseBestIapCalled() )
             {
             TMPMBearerType bearerType = EMPMBearerTypeOther;
         
@@ -1726,7 +1730,11 @@
     
     for ( TInt index = 0; index < iActiveBMConns.Count(); index++ )
         {
-        if ( iActiveBMConns[index].iConnInfo.iState == EStarted )
+        CMPMServerSession* serverSession = GetServerSession(
+             iActiveBMConns[index].iConnInfo.iConnId );
+
+        if ( iActiveBMConns[index].iConnInfo.iState == EStarted &&
+             serverSession->ChooseBestIapCalled() )
             {
             count++;
             }
--- a/bearermanagement/mpm/src/mpmserversession.cpp	Mon Jan 18 20:33:49 2010 +0200
+++ b/bearermanagement/mpm/src/mpmserversession.cpp	Tue Jan 26 12:12:48 2010 +0200
@@ -3600,12 +3600,16 @@
         return;
         }
     
+    MPMLOGSTRING2( "CMPMServerSession::RemoveIapsAccordingToBearerSetL:\
+ bearerset=%d", iIapSelection->MpmConnPref().BearerSet() )
+    
     // Drop iaps not according to bearer set
     if ( iIapSelection->MpmConnPref().BearerSet() != 
          TExtendedConnPref::EExtendedConnBearerUnknown )
         {
         TInt index = 0;
         
+        // First filter away physical IAPs (WLAN, packet data...)
         while ( index != aIapInfo.iCount )
             {
             // Get bearer type
@@ -3629,8 +3633,18 @@
                 index++;
                 continue;
                 }
+            else if ( bearerType == EMPMBearerTypeVpn )
+                {
+                // Don't remove this VPN IAP on this round. 
+                // VPN IAPs are filtered after this.
+                index++;
+                continue;
+                }
             else
                 {
+                MPMLOGSTRING2( "CMPMServerSession::RemoveIapsAccordingToBearerSetL:\
+ Filtered IAP ID:%d", aIapInfo.iIap[index].iIapId );
+ 
                 // Remove this iap from the list
                 for ( TInt index2 = index; index2 < aIapInfo.iCount; index2++ )
                     {
@@ -3640,6 +3654,59 @@
                 aIapInfo.iCount--;
                 }
             }
+        // Next filter away the VPN IAPs from the remaining IAPs.
+        // VPN IAP should survive this filter only if it has at least
+        // one unfiltered physical IAP still available. If it does not
+        // then it cannot be used to establish connection and should 
+        // be filtered.
+        index = 0;
+        RAvailableIAPList availableIaps; 
+            
+        for ( TUint i = 0; i < aIapInfo.iCount; i++ )
+            {
+            availableIaps.AppendL( aIapInfo.iIap[i].iIapId );
+            }
+        
+        MPMLOGSTRING2( "CMPMServerSession::RemoveIapsAccordingToBearerSetL:\
+ Starting VPN IAP filtering (iap count: %d)", aIapInfo.iCount );
+        
+        while ( index != aIapInfo.iCount )
+            {
+            // Get bearer type
+            TMPMBearerType bearerType = EMPMBearerTypeOther;
+            TUint32 realIapId( 0 );
+            bearerType =
+                iMyServer.CommsDatAccess()->GetBearerTypeL ( aIapInfo.iIap[index].iIapId );
+            
+            if ( bearerType == EMPMBearerTypeVpn )
+                {
+                iMyServer.CommsDatAccess()->FindRealIapL( aIapInfo.iIap[index].iIapId, 
+                                                           realIapId, 
+                                                           availableIaps, 
+                                                           *this);
+                
+                MPMLOGSTRING3( "CMPMServerSession::RemoveIapsAccordingToBearerSetL:\
+VPN IAP id: %d, real IAP id: %d", aIapInfo.iIap[index].iIapId, realIapId );
+                
+                if ( realIapId != 0 )
+                    {
+                    // Actual physical IAP was found for this VPN IAP. Do not filter.
+                    index++;    
+                    continue;
+                    }                
+                MPMLOGSTRING2( "CMPMServerSession::RemoveIapsAccordingToBearerSetL:\
+Filtered away VPN IAP: %d", aIapInfo.iIap[index].iIapId );
+                
+                // Remove this iap from the list
+                for ( TInt index2 = index; index2 < aIapInfo.iCount; index2++ )
+                    {
+                    aIapInfo.iIap[index2].iIapId = aIapInfo.iIap[index2 + 1].iIapId;
+                    }
+                
+                aIapInfo.iCount--;                               
+                }
+            index++;
+            }        
         }
     }
 
--- a/cmmanager/cmmgr/Framework/Src/cmconnselectrbpage.cpp	Mon Jan 18 20:33:49 2010 +0200
+++ b/cmmanager/cmmgr/Framework/Src/cmconnselectrbpage.cpp	Tue Jan 26 12:12:48 2010 +0200
@@ -327,6 +327,7 @@
     	    	{
         		case EEventEnterKeyPressed:
         		case EEventItemDoubleClicked:
+        		case EEventItemSingleClicked:
 				case EEventItemClicked:        	
             		{
             		ProcessCommandL(ECmManagerUiCmdDestSelect);
--- a/cmmanager/cmmgr/Plugins/cmpluginvpn/inc/cmpluginvpn.h	Mon Jan 18 20:33:49 2010 +0200
+++ b/cmmanager/cmmgr/Plugins/cmpluginvpn/inc/cmpluginvpn.h	Tue Jan 26 12:12:48 2010 +0200
@@ -20,6 +20,8 @@
 
 #include <e32base.h>
 #include <StringLoader.h>
+#include <in_sock.h>
+
 #include <cmpluginbaseeng.h>
 
 #include <cmpluginvpndef.h>
@@ -273,6 +275,15 @@
         *         or leaves with the error code KErrArgument 
         */                    
         TInt CheckValidityAndConvertDestinationIdL( TUint32 aDestinationId );
+        
+        /**
+        * Retrieves default APs from the Tier Record of given identifier.
+        * 
+        * @param aTierIdentifier identifier for tier record.
+        * @since S60 5.2
+        * @return an elementid id of the default AP record in tier record. 
+        */                    
+        const TMDBElementId DefaultAPRecordL( const TInt aTierIdentifier = KAfInet );
 
     public:                
         /**
--- a/cmmanager/cmmgr/Plugins/cmpluginvpn/src/cmpluginvpn.cpp	Mon Jan 18 20:33:49 2010 +0200
+++ b/cmmanager/cmmgr/Plugins/cmpluginvpn/src/cmpluginvpn.cpp	Tue Jan 26 12:12:48 2010 +0200
@@ -36,6 +36,9 @@
 #include <ConeResLoader.h>
 #include <bautils.h>
 
+#include <commsdattypesv1_1_partner.h>
+#include <commsdattypeinfov1_1_internal.h>
+
 #include "cmlogger.h"
 #include "cmmanagerimpl.h"
 #include "cmdestinationimpl.h"
@@ -463,6 +466,7 @@
             
             ServiceRecord().iServiceIAP = aValue;
             ServiceRecord().iServiceNetwork = 0;
+            ServiceRecord().iServiceSNAP = 0;
             iVirtualRecord->iNextLayerIAP = aValue;
             iVirtualRecord->iNextLayerSNAP = 0;            
             }
@@ -481,11 +485,13 @@
 
             TInt destinationId( 0 );
             destinationId = CheckValidityAndConvertDestinationIdL( aValue );
+            TMDBElementId defaultAP = DefaultAPRecordL();
             
-            ServiceRecord().iServiceIAP = 0;          
-            ServiceRecord().iServiceNetwork = destinationId - KCmDefaultDestinationAPTagId;
+            ServiceRecord().iServiceIAP = 0;
+            ServiceRecord().iServiceNetwork = 0;
+            ServiceRecord().iServiceSNAP = defaultAP;
             iVirtualRecord->iNextLayerIAP = 0;
-            iVirtualRecord->iNextLayerSNAP = destinationId;       
+            iVirtualRecord->iNextLayerSNAP = destinationId;
             }
             break;
 
@@ -898,6 +904,7 @@
     ServiceRecord().iServicePolicy.SetL( KNullDesC );
     ServiceRecord().iServiceIAP = 0;
     ServiceRecord().iServiceNetwork = 0;
+    ServiceRecord().iServiceSNAP = 0;
 
     
     iProxyRecord->iPortNumber = KVpnProxyPortNumberDefault;
@@ -2047,4 +2054,37 @@
     return id;
     }
 
+// --------------------------------------------------------------------------
+// CCmPluginVpn::DefaultAPRecordL
+// --------------------------------------------------------------------------
+//
+const TMDBElementId CCmPluginVpn::DefaultAPRecordL( const TInt aTierIdentifier )
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::DefaultAPRecordL" );
+    // Resolve the Default SNAP AP elementid 
+    //
+    CCDTierRecord* tierRecord = static_cast<CCDTierRecord *>(
+            CCDRecordBase::RecordFactoryL( KCDTIdTierRecord ) );
+    
+    CleanupStack::PushL( tierRecord );
+
+    // Find the correct tier table based on given identifier.
+    //
+    tierRecord->iRecordTag = aTierIdentifier;
+    if ( !tierRecord->FindL( Session() ) )
+        {
+        User::Leave( KErrCorrupt );
+        }
+    
+    // Find out the default AP for IP connections.
+    //
+    TMDBElementId defaultAP = tierRecord->iDefaultAccessPoint;
+
+    // Cleanup tier record.
+    //
+    CleanupStack::PopAndDestroy( tierRecord );
+        
+    return defaultAP;
+    }
+
 // eof
--- a/cmmanager/cmmgr/Plugins/cmpluginvpn/src/cmpvpnsettingsdlg.cpp	Mon Jan 18 20:33:49 2010 +0200
+++ b/cmmanager/cmmgr/Plugins/cmpluginvpn/src/cmpvpnsettingsdlg.cpp	Tue Jan 26 12:12:48 2010 +0200
@@ -242,7 +242,17 @@
             }
         case ECmProxyPortNumber:
             {
-            retVal = ShowPopupPortNumSettingPageL( aAttribute );
+            HBufC* proxyName = iCmPluginBaseEng.GetStringAttributeL( ECmProxyServerName );
+            if( !proxyName )
+                {
+                break;
+                }
+            CleanupStack::PushL( proxyName );
+            if( proxyName->Length() )
+                { // Port number is allowed to set after proxy address is set.
+                retVal = ShowPopupPortNumSettingPageL( aAttribute );
+                }
+            CleanupStack::PopAndDestroy(); // proxyName
             break;
             }
         default:
--- a/connectionmonitoring/connectionmonitorplugin/data/10281BC1.rss	Mon Jan 18 20:33:49 2010 +0200
+++ b/connectionmonitoring/connectionmonitorplugin/data/10281BC1.rss	Tue Jan 26 12:12:48 2010 +0200
@@ -2,9 +2,9 @@
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
-* under the terms of the License "Symbian Foundation License v1.0"
+* under the terms of "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
-* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
--- a/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonBearerGPRS.h	Mon Jan 18 20:33:49 2010 +0200
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonBearerGPRS.h	Tue Jan 26 12:12:48 2010 +0200
@@ -60,6 +60,12 @@
      * Sets available IAPs of this type as available in CommsDat cache
      */
     void FlagAvailableIaps() const;
+    
+private:
+    /**
+     * Reads KCurrentCellularDataUsage -key from Repository KCRUidCmManager
+     */
+    TInt CurrentCellularDataUsage() const;    
     };
 
 #endif // CONNMONBEARERGPRS_H
--- a/connectionmonitoring/connmon/connectionmonitor/src/ConnMonBearerGPRS.cpp	Mon Jan 18 20:33:49 2010 +0200
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonBearerGPRS.cpp	Tue Jan 26 12:12:48 2010 +0200
@@ -15,6 +15,10 @@
 *
 */
 
+#include <centralrepository.h>
+#include <cmmanagerkeys.h>
+#include <cmgenconnsettings.h>
+
 #include "ConnMonBearerGPRS.h"
 #include "connmoncommsdatcache.h"
 #include "ConnMonIAP.h"
@@ -45,43 +49,47 @@
     // Is bearer available
     TBool byCell( EFalse );
     TBool byPhone( EFalse );
-
-    // Find out if we are in 2G or in 3G - it is needed for calculating bearer availability
-    RMobilePhone::TMobilePhoneNetworkMode mode;
-    err = iConnMonIAP->MobilePhone()->GetCurrentMode( mode );
-
-    if ( KErrNone == err )
+ 
+    if ( CurrentCellularDataUsage() != ECmCellularDataUsageDisabled )
         {
-        switch ( mode )
-            {
-            case RMobilePhone::ENetworkModeGsm:
-            case RMobilePhone::ENetworkModeUnknown: // Emulator default
-                err = iConnMonIAP->GetBearerSupportInfo( EBearerIdGPRS, byCell, byPhone );
-                break;
-            case RMobilePhone::ENetworkModeWcdma:
-                err = iConnMonIAP->GetBearerSupportInfo( EBearerIdWCDMA, byCell, byPhone );
-                break;
-            default:
-                LOGEXITFN1("TConnMonBearerGPRS::GetAvailability()", err)
-                return err; // Return silently, report not available
-            }
+        // Find out if we are in 2G or in 3G - it is needed for calculating bearer availability
+        RMobilePhone::TMobilePhoneNetworkMode mode;
+        err = iConnMonIAP->MobilePhone()->GetCurrentMode( mode );
 
         if ( KErrNone == err )
             {
-            if ( byCell && byPhone )
+            switch ( mode )
                 {
-                aAvailable = ETrue;
+                case RMobilePhone::ENetworkModeGsm:
+                case RMobilePhone::ENetworkModeUnknown: // Emulator default
+                    err = iConnMonIAP->GetBearerSupportInfo( EBearerIdGPRS, byCell, byPhone );
+                    break;
+                case RMobilePhone::ENetworkModeWcdma:
+                    err = iConnMonIAP->GetBearerSupportInfo( EBearerIdWCDMA, byCell, byPhone );
+                    break;
+                default:
+                    LOGEXITFN1("TConnMonBearerGPRS::GetAvailability()", err)
+                    return err; // Return silently, report not available
+                }
+
+            if ( KErrNone == err )
+                {
+                if ( byCell && byPhone )
+                    {
+                    aAvailable = ETrue;
+                    }
                 }
             }
-        }
-
-    // Make GPRS available in wins
+        
+    
+        // Make GPRS available in wins
 #if defined(__WINSCW__)
-    LOGIT2("GetAvailability: Emulator override, true values were %d <%d>", aAvailable, err)
-    err = KErrNone;
-    aAvailable = ETrue;
+        LOGIT2("GetAvailability: Emulator override, true values were %d <%d>", aAvailable, err)
+        err = KErrNone;
+        aAvailable = ETrue;
 #endif
-
+        }
+    
     //LOGEXITFN1("TConnMonBearerGPRS::GetAvailability()", err)
     return err;
     }
@@ -123,4 +131,26 @@
     LOGEXITFN("TConnMonBearerGPRS::FlagAvailableIaps()")
     }
 
+// ---------------------------------------------------------------------------
+// Read current cellular data usage setting from Central Repository
+// ---------------------------------------------------------------------------
+//
+TInt TConnMonBearerGPRS::CurrentCellularDataUsage() const
+    {
+    // Use default value if repository is not available
+    TInt value( ECmCellularDataUsageAutomatic );
+    CRepository* cmRepository = NULL;
+    
+    TRAPD( err, cmRepository = CRepository::NewL( KCRUidCmManager ) )
+    
+    if ( err == KErrNone )
+        {
+        err = cmRepository->Get( KCurrentCellularDataUsage, value );
+        LOGIT2("KCurrentCellularDataUsage from repository: %d error: <%d>", value, err )
+        }
+    
+    delete cmRepository;
+    return value;
+    }
+    
 // End-of-file
--- a/connectionmonitoring/connmon/connectionmonitor/src/cellulardatausagekeyupdater.cpp	Mon Jan 18 20:33:49 2010 +0200
+++ b/connectionmonitoring/connmon/connectionmonitor/src/cellulardatausagekeyupdater.cpp	Tue Jan 26 12:12:48 2010 +0200
@@ -28,6 +28,7 @@
 
 #include "cellulardatausagekeyupdater.h"
 #include "ConnMonServ.h"
+#include "ConnMonAvailabilityManager.h"
 #include "ConnMonIap.h"
 #include "ConnMonDef.h"
 #include "log.h"
@@ -99,12 +100,15 @@
     if ( err == KErrNone )
         {
         TInt previous( 0 );
-        TInt err = cmRepository->Get( KCurrentCellularDataUsage, previous );
+        err = cmRepository->Get( KCurrentCellularDataUsage, previous );
            
         if ( err == KErrNone && ( value != previous ) )
             {
             cmRepository->Set( KCurrentCellularDataUsage, value );
-            LOGIT1("KCurrentCellularDataUsage set to <%d>", value)
+            LOGIT1("KCurrentCellularDataUsage set to %d", value)
+            
+            LOGIT("CCellularDataUsageKeyUpdater triggered HandleAvailabilityChange()")
+            iServer->AvailabilityManager()->HandleAvailabilityChange();
             }    
         delete cmRepository;    
         }
--- a/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/ChangeConnectionDlg.cpp	Mon Jan 18 20:33:49 2010 +0200
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/ChangeConnectionDlg.cpp	Tue Jan 26 12:12:48 2010 +0200
@@ -69,7 +69,7 @@
 // Destructor
 CChangeConnectionDlg::~CChangeConnectionDlg()
     {
-    delete iExpiryTimer;
+    //delete iExpiryTimer;
     }
 
 
@@ -168,8 +168,9 @@
 
     SetIconsL();
     
-    iExpiryTimer = CExpiryTimer::NewL( *this );
-    iExpiryTimer->Start();
+    // Timer not in use due the unresolved crash
+    //iExpiryTimer = CExpiryTimer::NewL( *this );
+    //iExpiryTimer->Start();
     CLOG_LEAVEFN( "CChangeConnectionDlg::PreLayoutDynInitL " );  
     
     }
Binary file data/cccccc00_emulator.cre has changed