Revision: 201031
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 18 Aug 2010 10:10:23 +0300
changeset 53 4af712113915
parent 47 cb7afde124a3
child 60 a9c709db68db
Revision: 201031 Kit: 201033
bearermanagement/S60MCPR/inc/s60mcpractivities.h
bearermanagement/S60MCPR/src/s60mcpractivities.cpp
bearermanagement/S60MCPR/src/s60mcprsimpleselectactivity.cpp
bearermanagement/S60MCPR/src/s60mpmrequests.cpp
bearermanagement/mpm/inc/mpmdatausagewatcher.h
bearermanagement/mpm/inc/mpmiapselection.h
bearermanagement/mpm/inc/mpmserver.h
bearermanagement/mpm/inc/mpmserver.inl
bearermanagement/mpm/inc/mpmserversession.h
bearermanagement/mpm/src/mpmdatausagewatcher.cpp
bearermanagement/mpm/src/mpmiapselection.cpp
bearermanagement/mpm/src/mpmserver.cpp
bearermanagement/mpm/src/mpmserversession.cpp
cmmanager/cmmgr/cmmapi/src/cmmanagerapi.cpp
cmmanager/cmmgr/cmmpluginbase/BWinsCw/cmmpluginbaseu.def
cmmanager/cmmgr/cmmpluginbase/EABI/cmmpluginbaseu.def
cmmanager/cmmgr/cmmpluginbase/src/ccmpluginbaseeng.cpp
cmmanager/cmmgr/cmmplugins/cmpluginembdestination/src/cmpluginembdestination.cpp
cmmanager/cmmgr/cmmplugins/cmpluginlan/src/cmpluginlan.cpp
cmmanager/cmmgr/cmmplugins/cmpluginpacketdata/src/cmpluginpacketdata.cpp
cmmanager/cmmgr/cmmplugins/cmpluginwlan/src/cmpluginwlan.cpp
cmmanager/cmmgr/cmmserver/inc/cmmcache.h
cmmanager/cmmgr/cmmserver/inc/cmmconnmethodinstance.h
cmmanager/cmmgr/cmmserver/inc/cmmconnmethodstruct.h
cmmanager/cmmgr/cmmserver/inc/cmmdbchangelistener.h
cmmanager/cmmgr/cmmserver/inc/cmmdestinationstruct.h
cmmanager/cmmgr/cmmserver/inc/cmmlistenermanager.h
cmmanager/cmmgr/cmmserver/src/cmmanagerimpl.cpp
cmmanager/cmmgr/cmmserver/src/cmmcache.cpp
cmmanager/cmmgr/cmmserver/src/cmmconnmethodinstance.cpp
cmmanager/cmmgr/cmmserver/src/cmmconnmethodstruct.cpp
cmmanager/cmmgr/cmmserver/src/cmmdbchangelistener.cpp
cmmanager/cmmgr/cmmserver/src/cmmdestinationinstance.cpp
cmmanager/cmmgr/cmmserver/src/cmmdestinationstruct.cpp
cmmanager/cmmgr/cmmserver/src/cmminstancemapping.cpp
cmmanager/cmmgr/cmmserver/src/cmmlistenermanager.cpp
cmmanager/cmmgr/cmmserver/src/cmmsrvstatic.cpp
cmmanager/cppacketdataapplugin/src/cppacketdataapadvancedview.cpp
cmmanager/cppacketdataapplugin/src/cppacketdataapview.cpp
cmmanager/cpwlanapplugin/src/cpwlanapadvancedview.cpp
cmmanager/cpwlanapplugin/src/cpwlanapview.cpp
connectionmonitoring/cellularindicatorplugin/inc/cellularindicatorplugin.h
connectionmonitoring/cellularindicatorplugin/src/cellularindicatorplugin.cpp
connectionmonitoring/connectionview/inc/connectionview.h
connectionmonitoring/connectionview/src/connectionview.cpp
connectionmonitoring/connmon/connectionmonitor/group/ConnMon.mmp
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonDef.h
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonIAP.h
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonNoti.h
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonServ.h
connectionmonitoring/connmon/connectionmonitor/inc/cellulardatausagekeyupdater.h
connectionmonitoring/connmon/connectionmonitor/inc/connmondialupoverridenotifier.h
connectionmonitoring/connmon/connectionmonitor/src/CPsdFax.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonIAP.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonNoti.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonServ.cpp
connectionmonitoring/connmon/connectionmonitor/src/cellulardatausagekeyupdater.cpp
connectionmonitoring/connmon/connectionmonitor/src/connmondialupoverridenotifier.cpp
connectionutilities/confirmqueries/inc/cellularpromptdialog.h
connectionutilities/confirmqueries/src/cellularpromptdialog.cpp
ipcm_plat/bearer_settings_plugin_api/inc/cmpluginbaseeng.h
ipcm_plat/connection_monitor_extension_api/group/bld.inf
ipcm_plat/connection_monitor_extension_api/inc/connectionmonitorpskeys.h
ipcm_plat/extended_connection_settings_api/group/bld.inf
ipcm_plat/extended_connection_settings_api/inc/cmmanagerkeys.h
ipcm_plat/extended_connection_settings_api/inc/cmsettingsui.h
ipcm_pub/connection_settings_api/group/bld.inf
ipcm_pub/connection_settings_api/inc/cmsettingsui.h
--- a/bearermanagement/S60MCPR/inc/s60mcpractivities.h	Tue Jul 06 14:42:41 2010 +0300
+++ b/bearermanagement/S60MCPR/inc/s60mcpractivities.h	Wed Aug 18 10:10:23 2010 +0300
@@ -24,7 +24,7 @@
 #define S60MCPR_ACTIVITIES_H
 
 #include <comms-infras/mobilitymcpractivities.h>
-
+#include <platform/elements/mm_context.h>
 #include "s60mcprstates.h"
 
 // Forward declarations
@@ -50,13 +50,24 @@
  * S60 MCPR's connection selection activity related
  * states, transitions and forks.
  * 
- * The activity doesn't need activity class because it
- * reuses the Symbian's core implementation for 
- * selection.
- * 
  */
 namespace S60MCprSelectActivity
     {
+
+    class CS60SelectActivity : public MCprActivities::CSelectNextLayerActivity
+        {
+        public: // Methods
+            static MeshMachine::CNodeActivityBase* NewL(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode);
+    
+            // Overrides CNodeActivityBase's implementation
+            virtual void Cancel(MeshMachine::TNodeContextBase& aContext);
+        
+        private:  // Methods
+            
+            // C++ constructor
+            CS60SelectActivity(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode);
+        };
+    
     /**
      * Execution context definition for meshmachine activities. 
      */
@@ -109,11 +120,6 @@
  * S60MCprSimpleSelectActivity namespace packages the
  * S60 MCPR's connection selection activity related
  * states, transitions and forks.
- * 
- * The activity doesn't need activity class because it
- * reuses the Symbian's core implementation for 
- * selection.
- * 
  */
 namespace S60MCprSimpleSelectActivity
     {
--- a/bearermanagement/S60MCPR/src/s60mcpractivities.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/bearermanagement/S60MCPR/src/s60mcpractivities.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -38,7 +38,7 @@
 	DECLARE_DEFINE_CUSTOM_NODEACTIVITY( ECFActivitySelect, 
 	                                    S60MCprSelect,
 	                                    TCFSelector::TSelect,
-	                                    CSelectNextLayerActivity::NewL )
+	                                    CS60SelectActivity::NewL )
     
     // Reply from TAwaitingSelectNextLayer if no choices, otherwise accept
     FIRST_NODEACTIVITY_ENTRY( TAwaitingSelectNextLayer,
@@ -117,7 +117,7 @@
     DECLARE_DEFINE_CUSTOM_NODEACTIVITY( ECFActivitySelect, 
                                         MCprSimpleSelect, 
 		                                TCFSelector::TSimpleSelect,
-                                        CSelectNextLayerActivity::NewL )
+		                                S60MCprSelectActivity::CS60SelectActivity::NewL )
     // Reply from TAwaitingSelectNextLayer if no choices, otherwise accept
     FIRST_NODEACTIVITY_ENTRY( S60MCprSimpleSelectActivity::TAwaitingSelectNextLayer,
                               S60MCprSimpleSelectActivity::TChooseBestIAPRequiredOrNoTagOrSetChosenApActive )
--- a/bearermanagement/S60MCPR/src/s60mcprsimpleselectactivity.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/bearermanagement/S60MCPR/src/s60mcprsimpleselectactivity.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -42,6 +42,36 @@
 //
 namespace S60MCprSelectActivity
     {
+    // Overrides CNodeActivityBase method implementation
+    void CS60SelectActivity::Cancel(MeshMachine::TNodeContextBase& aContext)
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::CS60SelectActivity::Cancel()",(TInt*)&aContext.Node())        
+        __ASSERT_DEBUG(aContext.iNodeActivity, User::Panic(KS60MCprPanic, KPanicNoActivity));
+        CSelectNextLayerActivity& ac = 
+            static_cast<CSelectNextLayerActivity&>( *aContext.iNodeActivity );
+        
+        if (!ac.iTierManager.IsNull() && ac.iTierManager == PostedToNodeId())
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::CS60SelectActivity::Cancel() Forwarding TCancel to TM",(TInt*)&aContext.Node())    
+            RClientInterface::OpenPostMessageClose(TNodeCtxId(ActivityId(), iNode.Id()), PostedToNodeId(), TEBase::TCancel().CRef());
+            SetError( KErrCancel );
+            }
+        else
+            {
+            CSelectNextLayerActivity::Cancel(aContext);
+            }
+        }
+    
+    MeshMachine::CNodeActivityBase* CS60SelectActivity::NewL(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode)
+        {
+        return new(ELeave) CS60SelectActivity( aActivitySig, aNode );
+        }
+    
+    CS60SelectActivity::CS60SelectActivity(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode)
+        : CSelectNextLayerActivity(aActivitySig, aNode)
+        {
+        }
+
     // -----------------------------------------------------------------------------
     // TAwaitingSelectNextLayer
     // -----------------------------------------------------------------------------
@@ -170,8 +200,7 @@
 		CleanupStack::PushL(nextAP);
 		node.ConnPrefList().AppendL(nextAP);
 		CleanupStack::Pop();
-		/* END OF HACK */
-		
+		/* END OF HACK */	
         // Attach. 399 attach shouldn't be visible here.
         if ( prefs.Scope()&TSelectionPrefs::ESelectFromExisting )
             {
@@ -194,7 +223,7 @@
             newPrefs.SetPrefs( ippprefs );
             TCFSelector::TSimpleSelect msg(newPrefs);
             iContext.iNodeActivity->PostRequestTo(ac.iTierManager, msg);
-            }
+            }     
         }
     }
 
--- a/bearermanagement/S60MCPR/src/s60mpmrequests.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/bearermanagement/S60MCPR/src/s60mpmrequests.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -847,10 +847,15 @@
     // Asynchronous cancellation adds message to MPMServer's IPC queue but since we
     // queue all requests we can safely always call the SendCancelRequest()
     
+    // Sanity check.
+    S60MCPRLOGSTRING2( "S60MCPR::CMPMPolicyRequests<%x>::CancelRequest() %d", this, (TInt)aRequestCode )
+    if ( iPolicyRequests.Count() == 0 )
+        {
+        S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::CancelRequest(): Error: Nothing to cancel!", this )
+        return;
+        }
     // If the cancelled request is the active one.
-    //
-    S60MCPRLOGSTRING2( "S60MCPR::CMPMPolicyRequests<%x>::CancelRequest() %d", this, (TInt)aRequestCode )
-    if ( iPolicyRequests[0].iRequestType == aRequestCode )
+    else if ( iPolicyRequests[0].iRequestType == aRequestCode )
         {
         // Cancel the query if active
         //
@@ -877,7 +882,6 @@
             }
         }
     // Else we need to find it from the queue
-    //
     else 
         {
         S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::CancelRequest() Cancelling pending request", this )
--- a/bearermanagement/mpm/inc/mpmdatausagewatcher.h	Tue Jul 06 14:42:41 2010 +0300
+++ b/bearermanagement/mpm/inc/mpmdatausagewatcher.h	Wed Aug 18 10:10:23 2010 +0300
@@ -61,6 +61,12 @@
     * Active object's DoCancel.
     */
     void DoCancel();
+    
+    /**
+    * Current cellular data usage.
+    * See TCmCellularDataUsage
+    */
+    TInt CellularDataUsage() const;
 
 private:
 
--- a/bearermanagement/mpm/inc/mpmiapselection.h	Tue Jul 06 14:42:41 2010 +0300
+++ b/bearermanagement/mpm/inc/mpmiapselection.h	Wed Aug 18 10:10:23 2010 +0300
@@ -244,6 +244,12 @@
      * @since 3.2
      */
     void ImplicitConnectionWlanNoteL();
+
+    /**
+     * Gets current cellular data usage setting
+     * @since 5.2
+     */
+    TInt CurrentCellularDataUsage() const;
     
 private:
 
--- a/bearermanagement/mpm/inc/mpmserver.h	Tue Jul 06 14:42:41 2010 +0300
+++ b/bearermanagement/mpm/inc/mpmserver.h	Wed Aug 18 10:10:23 2010 +0300
@@ -34,6 +34,7 @@
 #include "mpmcommon.h"
 #include "rmpm.h"
 #include "mpmroamingwatcher.h"
+#include "mpmdatausagewatcher.h"
 #include "mpmvpntogglewatcher.h"
 
 
@@ -689,7 +690,14 @@
         * @since 5.2
         */
         inline CMPMRoamingWatcher* RoamingWatcher() const;
-        
+
+        /**
+        * Returns the DataUsageWatcher pointer
+        *
+        * @since 5.2
+        * @return DataUsageWatcher pointer
+        */
+        inline CMpmDataUsageWatcher* DataUsageWatcher() const;        
         
         
     public: // Functions from base classes
--- a/bearermanagement/mpm/inc/mpmserver.inl	Tue Jul 06 14:42:41 2010 +0300
+++ b/bearermanagement/mpm/inc/mpmserver.inl	Wed Aug 18 10:10:23 2010 +0300
@@ -230,4 +230,13 @@
     return iConnUiUtils;
     }
 
+// -----------------------------------------------------------------------------
+// CMPMServer::DataUsageWatcher()
+// -----------------------------------------------------------------------------
+//
+CMpmDataUsageWatcher* CMPMServer::DataUsageWatcher() const
+    {
+    return iMpmDataUsageWatcher;
+    }
+
 // End of File
--- a/bearermanagement/mpm/inc/mpmserversession.h	Tue Jul 06 14:42:41 2010 +0300
+++ b/bearermanagement/mpm/inc/mpmserversession.h	Wed Aug 18 10:10:23 2010 +0300
@@ -958,6 +958,9 @@
         //
         TBool iVpnUserConnectionUsed;        
 
+        // Set when error discreet popup shown for IAP so it is
+        // not shown again if the SNAP is empty
+        TBool iErrorDiscreetPopupShown;
     };
 
 #include "mpmserversession.inl"
--- a/bearermanagement/mpm/src/mpmdatausagewatcher.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/bearermanagement/mpm/src/mpmdatausagewatcher.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -182,3 +182,12 @@
         }
     return err;
     }
+
+// -----------------------------------------------------------------------------
+// CMpmDataUsageWatcher::CellularDataUsage
+// -----------------------------------------------------------------------------
+//
+TInt CMpmDataUsageWatcher::CellularDataUsage() const
+    {
+    return iCellularDataUsage;
+    }
--- a/bearermanagement/mpm/src/mpmiapselection.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/bearermanagement/mpm/src/mpmiapselection.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -151,10 +151,13 @@
         MPMLOGSTRING2( "CMPMIapSelection::ChooseIapL: bearerType: %i", bearerType )
 
         // Complete selection with error code if wlan only was set and cellular IAP other 
-        // than MMS IAP was tried to access  
-        if ( wlanOnly && 
-                ( bearerType == EMPMBearerTypePacketData ) && 
-                ( iSession->IsMMSIap( iChooseIapPref.IapId() ) == EFalse ) ) 
+        // than MMS IAP was tried to access
+        // Note that CurrentCellularDataUsage()tells if internal cellular connections are 
+        // temporarily disabled because dial-up connection is prioritized over internal connections.
+        // 
+        if ( ( wlanOnly || CurrentCellularDataUsage() == ECmCellularDataUsageDisabled ) && 
+             ( bearerType == EMPMBearerTypePacketData ) && 
+             ( iSession->IsMMSIap( iChooseIapPref.IapId() ) == EFalse ) ) 
             {            
             ChooseIapComplete( KErrPermissionDenied, NULL );
             return;
@@ -1142,3 +1145,11 @@
     return iChooseIapPref;
     }
 
+// ---------------------------------------------------------------------------
+// Get current cellular data usage setting
+// ---------------------------------------------------------------------------
+//
+TInt CMPMIapSelection::CurrentCellularDataUsage() const
+    {
+    return iSession->MyServer().DataUsageWatcher()->CellularDataUsage();
+    }
--- a/bearermanagement/mpm/src/mpmserver.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/bearermanagement/mpm/src/mpmserver.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -1100,7 +1100,7 @@
 aCategory = %i blacklisted Id count = %d", 
                    aCategory, iBlackListIdList.Count() )
 
-    for( TInt i( 0 ); i < iBlackListIdList.Count(); i++ )
+    for (TInt i = iBlackListIdList.Count()-1; i >= 0; i--)
         {
         // found blacklisted Connection Id
         TMPMBlackListConnId connIdInfo = iBlackListIdList[i];
@@ -1110,7 +1110,7 @@
 aConnId = 0x%x, blacklisted IapId count = %d", connIdInfo.iConnId, 
         connIdInfo.Count() )
         
-        for (TInt j = 0; j < connIdInfo.Count(); j++)
+        for (TInt j = connIdInfo.Count()-1; j >= 0; j--)
             {
             if ( connIdInfo.Category( j ) == aCategory ) 
                 {
--- a/bearermanagement/mpm/src/mpmserversession.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/bearermanagement/mpm/src/mpmserversession.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -81,7 +81,8 @@
       iLastNotifiedIap( 0 ),
       iMigrateIap( 0 ),
       iUserConnection( 0 ),
-      iVpnUserConnectionUsed( EFalse )
+      iVpnUserConnectionUsed( EFalse ),
+      iErrorDiscreetPopupShown( EFalse )
     {
     }
 
@@ -1429,6 +1430,10 @@
         // belongs to the set of errors that are shown to the user.
         // Otherwise the popup is not shown.
         iMyServer.ConnUiUtils()->ConnectionErrorDiscreetPopup( error );
+        
+        // Error discreet popup has been shown. This is needed so that we
+        // dont show it again for SNAP.
+        iErrorDiscreetPopupShown = ETrue;
         }  
 
     TConnMonIapInfo availableIAPs;
@@ -3291,10 +3296,11 @@
         }
 
     // 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 ) 
-			&& ( iIapSelection->MpmConnPref().SnapId() == 0 ) )
+            && ( iErrorDiscreetPopupShown == EFalse ) )
         {
         // Note: Below function shows the discreet popup only if the error code
         // belongs to the set of errors that are shown to the user.
@@ -3314,6 +3320,9 @@
                                                       connectionAlreadyActive );
             }            
         }
+    
+    // Enable showing error discreet popup for SNAP again
+    iErrorDiscreetPopupShown = EFalse;
     }
 
 
--- a/cmmanager/cmmgr/cmmapi/src/cmmanagerapi.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmapi/src/cmmanagerapi.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -356,7 +356,7 @@
     {
     OstTraceFunctionEntry0( RCMMANAGERAPI_GETCONNECTIONMETHODINFOBOOL_ENTRY );
 
-    TPckg<TUint32> pckg( aValue );
+    TPckg<TBool> pckg( aValue );
     TIpcArgs args( aIapId, aAttribute, &pckg );
     TInt err = SendReceive( ECmmGetConnMethodInfoBool, args );
 
--- a/cmmanager/cmmgr/cmmpluginbase/BWinsCw/cmmpluginbaseu.def	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmpluginbase/BWinsCw/cmmpluginbaseu.def	Wed Aug 18 10:10:23 2010 +0300
@@ -2,14 +2,14 @@
 	?GetBoolAttributeL@CCmPluginBaseEng@@QAEHKPAVCCmClientPluginInstance@@@Z @ 1 NONAME ; int CCmPluginBaseEng::GetBoolAttributeL(unsigned long, class CCmClientPluginInstance *)
 	?CreateNewL@CCmPluginBaseEng@@QAEXK@Z @ 2 NONAME ; void CCmPluginBaseEng::CreateNewL(unsigned long)
 	?SetStringAttributeL@CCmPluginBaseEng@@QAEXKABVTDesC16@@PAVCCmClientPluginInstance@@@Z @ 3 NONAME ; void CCmPluginBaseEng::SetStringAttributeL(unsigned long, class TDesC16 const &, class CCmClientPluginInstance *)
-	?GetGenericTableIdsToBeObserved@CCmPluginBaseEng@@QBEXAAV?$RArray@K@@@Z @ 4 NONAME ; void CCmPluginBaseEng::GetGenericTableIdsToBeObserved(class RArray<unsigned long> &) const
-	?GetPluginDataL@CCmPluginBaseEng@@QAEXPAVCCmClientPluginInstance@@@Z @ 5 NONAME ; void CCmPluginBaseEng::GetPluginDataL(class CCmClientPluginInstance *)
-	?SetString8AttributeL@CCmPluginBaseEng@@QAEXKABVTDesC8@@PAVCCmClientPluginInstance@@@Z @ 6 NONAME ; void CCmPluginBaseEng::SetString8AttributeL(unsigned long, class TDesC8 const &, class CCmClientPluginInstance *)
-	?GetIntAttributeL@CCmPluginBaseEng@@QAEKKPAVCCmClientPluginInstance@@@Z @ 7 NONAME ; unsigned long CCmPluginBaseEng::GetIntAttributeL(unsigned long, class CCmClientPluginInstance *)
-	?CheckIfNameModifiedL@CCmPluginBaseEng@@IBEXPAVCCDRecordBase@CommsDat@@0@Z @ 8 NONAME ; void CCmPluginBaseEng::CheckIfNameModifiedL(class CommsDat::CCDRecordBase *, class CommsDat::CCDRecordBase *) const
+	?GetPluginDataL@CCmPluginBaseEng@@QAEXPAVCCmClientPluginInstance@@@Z @ 4 NONAME ; void CCmPluginBaseEng::GetPluginDataL(class CCmClientPluginInstance *)
+	?SetString8AttributeL@CCmPluginBaseEng@@QAEXKABVTDesC8@@PAVCCmClientPluginInstance@@@Z @ 5 NONAME ; void CCmPluginBaseEng::SetString8AttributeL(unsigned long, class TDesC8 const &, class CCmClientPluginInstance *)
+	?GetIntAttributeL@CCmPluginBaseEng@@QAEKKPAVCCmClientPluginInstance@@@Z @ 6 NONAME ; unsigned long CCmPluginBaseEng::GetIntAttributeL(unsigned long, class CCmClientPluginInstance *)
+	?CheckIfNameModifiedL@CCmPluginBaseEng@@IBEXPAVCCDRecordBase@CommsDat@@0@Z @ 7 NONAME ; void CCmPluginBaseEng::CheckIfNameModifiedL(class CommsDat::CCDRecordBase *, class CommsDat::CCDRecordBase *) const
+	?CreateCopyL@CCmPluginBaseEng@@QAEPAV1@PAVCCmClientPluginInstance@@@Z @ 8 NONAME ; class CCmPluginBaseEng * CCmPluginBaseEng::CreateCopyL(class CCmClientPluginInstance *)
 	??1CCmPluginBaseEng@@UAE@XZ @ 9 NONAME ; CCmPluginBaseEng::~CCmPluginBaseEng(void)
-	?CreateCopyL@CCmPluginBaseEng@@QAEPAV1@PAVCCmClientPluginInstance@@@Z @ 10 NONAME ; class CCmPluginBaseEng * CCmPluginBaseEng::CreateCopyL(class CCmClientPluginInstance *)
-	?SetIntAttributeL@CCmPluginBaseEng@@QAEXKKPAVCCmClientPluginInstance@@@Z @ 11 NONAME ; void CCmPluginBaseEng::SetIntAttributeL(unsigned long, unsigned long, class CCmClientPluginInstance *)
+	?SetIntAttributeL@CCmPluginBaseEng@@QAEXKKPAVCCmClientPluginInstance@@@Z @ 10 NONAME ; void CCmPluginBaseEng::SetIntAttributeL(unsigned long, unsigned long, class CCmClientPluginInstance *)
+	?CopyRecordFieldsL@CCmPluginBaseEng@@IAEXAAVCMDBRecordBase@CommsDat@@0@Z @ 11 NONAME ; void CCmPluginBaseEng::CopyRecordFieldsL(class CommsDat::CMDBRecordBase &, class CommsDat::CMDBRecordBase &)
 	?ReLoadL@CCmPluginBaseEng@@QAEXXZ @ 12 NONAME ; void CCmPluginBaseEng::ReLoadL(void)
 	?NewL@CCmClientPluginInstance@@SAPAV1@XZ @ 13 NONAME ; class CCmClientPluginInstance * CCmClientPluginInstance::NewL(void)
 	?ConstructL@CCmPluginBaseEng@@MAEXXZ @ 14 NONAME ; void CCmPluginBaseEng::ConstructL(void)
@@ -17,12 +17,12 @@
 	?NewLC@CCmClientPluginInstance@@SAPAV1@XZ @ 16 NONAME ; class CCmClientPluginInstance * CCmClientPluginInstance::NewLC(void)
 	?SetBoolAttributeL@CCmPluginBaseEng@@QAEXKHPAVCCmClientPluginInstance@@@Z @ 17 NONAME ; void CCmPluginBaseEng::SetBoolAttributeL(unsigned long, int, class CCmClientPluginInstance *)
 	?LoadL@CCmPluginBaseEng@@QAEXK@Z @ 18 NONAME ; void CCmPluginBaseEng::LoadL(unsigned long)
-	?DeleteL@CCmPluginBaseEng@@UAEXXZ @ 19 NONAME ; void CCmPluginBaseEng::DeleteL(void)
-	?CheckDNSServerAddressL@CCmPluginBaseEng@@IAEXHAAV?$CMDBField@VTDesC16@@@CommsDat@@0AAV?$CMDBField@H@3@@Z @ 20 NONAME ; void CCmPluginBaseEng::CheckDNSServerAddressL(int, class CommsDat::CMDBField<class TDesC16> &, class CommsDat::CMDBField<class TDesC16> &, class CommsDat::CMDBField<int> &)
-	??0TCmPluginInitParam@@QAE@AAVCMDBSession@CommsDat@@@Z @ 21 NONAME ; TCmPluginInitParam::TCmPluginInitParam(class CommsDat::CMDBSession &)
+	?CheckDNSServerAddressL@CCmPluginBaseEng@@IAEXHAAV?$CMDBField@VTDesC16@@@CommsDat@@0AAV?$CMDBField@H@3@@Z @ 19 NONAME ; void CCmPluginBaseEng::CheckDNSServerAddressL(int, class CommsDat::CMDBField<class TDesC16> &, class CommsDat::CMDBField<class TDesC16> &, class CommsDat::CMDBField<int> &)
+	??0TCmPluginInitParam@@QAE@AAVCMDBSession@CommsDat@@@Z @ 20 NONAME ; TCmPluginInitParam::TCmPluginInitParam(class CommsDat::CMDBSession &)
+	?DeleteL@CCmPluginBaseEng@@UAEXXZ @ 21 NONAME ; void CCmPluginBaseEng::DeleteL(void)
 	?GetString8AttributeL@CCmPluginBaseEng@@QAEPAVHBufC8@@KPAVCCmClientPluginInstance@@@Z @ 22 NONAME ; class HBufC8 * CCmPluginBaseEng::GetString8AttributeL(unsigned long, class CCmClientPluginInstance *)
 	?UpdateL@CCmPluginBaseEng@@UAEXPAVCCmClientPluginInstance@@@Z @ 23 NONAME ; void CCmPluginBaseEng::UpdateL(class CCmClientPluginInstance *)
-	?GetStringAttributeL@CCmPluginBaseEng@@QAEPAVHBufC16@@KPAVCCmClientPluginInstance@@@Z @ 24 NONAME ; class HBufC16 * CCmPluginBaseEng::GetStringAttributeL(unsigned long, class CCmClientPluginInstance *)
-	??1CCmClientPluginInstance@@UAE@XZ @ 25 NONAME ; CCmClientPluginInstance::~CCmClientPluginInstance(void)
-	?CopyRecordFieldsL@CCmPluginBaseEng@@IAEXAAVCMDBRecordBase@CommsDat@@0@Z @ 26 NONAME ; void CCmPluginBaseEng::CopyRecordFieldsL(class CommsDat::CMDBRecordBase &, class CommsDat::CMDBRecordBase &)
+	?GetGenericTableIdsToBeObservedL@CCmPluginBaseEng@@QBEXAAV?$RArray@K@@@Z @ 24 NONAME ; void CCmPluginBaseEng::GetGenericTableIdsToBeObservedL(class RArray<unsigned long> &) const
+	?GetStringAttributeL@CCmPluginBaseEng@@QAEPAVHBufC16@@KPAVCCmClientPluginInstance@@@Z @ 25 NONAME ; class HBufC16 * CCmPluginBaseEng::GetStringAttributeL(unsigned long, class CCmClientPluginInstance *)
+	??1CCmClientPluginInstance@@UAE@XZ @ 26 NONAME ; CCmClientPluginInstance::~CCmClientPluginInstance(void)
 
--- a/cmmanager/cmmgr/cmmpluginbase/EABI/cmmpluginbaseu.def	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmpluginbase/EABI/cmmpluginbaseu.def	Wed Aug 18 10:10:23 2010 +0300
@@ -5,31 +5,31 @@
 	_ZN16CCmPluginBaseEng14GetPluginDataLEP23CCmClientPluginInstance @ 4 NONAME
 	_ZN16CCmPluginBaseEng16GetIntAttributeLEmP23CCmClientPluginInstance @ 5 NONAME
 	_ZN16CCmPluginBaseEng16SetIntAttributeLEmmP23CCmClientPluginInstance @ 6 NONAME
-	_ZN16CCmPluginBaseEng17GetBoolAttributeLEmP23CCmClientPluginInstance @ 7 NONAME
-	_ZN16CCmPluginBaseEng17SetBoolAttributeLEmiP23CCmClientPluginInstance @ 8 NONAME
-	_ZN16CCmPluginBaseEng19GetStringAttributeLEmP23CCmClientPluginInstance @ 9 NONAME
-	_ZN16CCmPluginBaseEng19SetStringAttributeLEmRK7TDesC16P23CCmClientPluginInstance @ 10 NONAME
-	_ZN16CCmPluginBaseEng20GetString8AttributeLEmP23CCmClientPluginInstance @ 11 NONAME
-	_ZN16CCmPluginBaseEng20SetString8AttributeLEmRK6TDesC8P23CCmClientPluginInstance @ 12 NONAME
-	_ZN16CCmPluginBaseEng22CheckDNSServerAddressLEiRN8CommsDat9CMDBFieldI7TDesC16EES4_RNS1_IiEE @ 13 NONAME
-	_ZN16CCmPluginBaseEng5LoadLEm @ 14 NONAME
-	_ZN16CCmPluginBaseEng7DeleteLEv @ 15 NONAME
-	_ZN16CCmPluginBaseEng7ReLoadLEv @ 16 NONAME
-	_ZN16CCmPluginBaseEng7UpdateLEP23CCmClientPluginInstance @ 17 NONAME
-	_ZN16CCmPluginBaseEngC2EP18TCmPluginInitParam @ 18 NONAME
-	_ZN16CCmPluginBaseEngD0Ev @ 19 NONAME
-	_ZN16CCmPluginBaseEngD1Ev @ 20 NONAME
-	_ZN16CCmPluginBaseEngD2Ev @ 21 NONAME
-	_ZN18TCmPluginInitParamC1ERN8CommsDat11CMDBSessionE @ 22 NONAME
-	_ZN18TCmPluginInitParamC2ERN8CommsDat11CMDBSessionE @ 23 NONAME
-	_ZN23CCmClientPluginInstance4NewLEv @ 24 NONAME
-	_ZN23CCmClientPluginInstance5NewLCEv @ 25 NONAME
-	_ZN23CCmClientPluginInstanceD0Ev @ 26 NONAME
-	_ZN23CCmClientPluginInstanceD1Ev @ 27 NONAME
-	_ZN23CCmClientPluginInstanceD2Ev @ 28 NONAME
-	_ZNK16CCmPluginBaseEng20CheckIfNameModifiedLEPN8CommsDat13CCDRecordBaseES2_ @ 29 NONAME
-	_ZNK16CCmPluginBaseEng30GetGenericTableIdsToBeObservedER6RArrayImE @ 30 NONAME
-	_ZTI16CCmPluginBaseEng @ 31 NONAME
-	_ZTV16CCmPluginBaseEng @ 32 NONAME
-	_ZN16CCmPluginBaseEng17CopyRecordFieldsLERN8CommsDat14CMDBRecordBaseES2_ @ 33 NONAME
+	_ZN16CCmPluginBaseEng17CopyRecordFieldsLERN8CommsDat14CMDBRecordBaseES2_ @ 7 NONAME
+	_ZN16CCmPluginBaseEng17GetBoolAttributeLEmP23CCmClientPluginInstance @ 8 NONAME
+	_ZN16CCmPluginBaseEng17SetBoolAttributeLEmiP23CCmClientPluginInstance @ 9 NONAME
+	_ZN16CCmPluginBaseEng19GetStringAttributeLEmP23CCmClientPluginInstance @ 10 NONAME
+	_ZN16CCmPluginBaseEng19SetStringAttributeLEmRK7TDesC16P23CCmClientPluginInstance @ 11 NONAME
+	_ZN16CCmPluginBaseEng20GetString8AttributeLEmP23CCmClientPluginInstance @ 12 NONAME
+	_ZN16CCmPluginBaseEng20SetString8AttributeLEmRK6TDesC8P23CCmClientPluginInstance @ 13 NONAME
+	_ZN16CCmPluginBaseEng22CheckDNSServerAddressLEiRN8CommsDat9CMDBFieldI7TDesC16EES4_RNS1_IiEE @ 14 NONAME
+	_ZN16CCmPluginBaseEng5LoadLEm @ 15 NONAME
+	_ZN16CCmPluginBaseEng7DeleteLEv @ 16 NONAME
+	_ZN16CCmPluginBaseEng7ReLoadLEv @ 17 NONAME
+	_ZN16CCmPluginBaseEng7UpdateLEP23CCmClientPluginInstance @ 18 NONAME
+	_ZN16CCmPluginBaseEngC2EP18TCmPluginInitParam @ 19 NONAME
+	_ZN16CCmPluginBaseEngD0Ev @ 20 NONAME
+	_ZN16CCmPluginBaseEngD1Ev @ 21 NONAME
+	_ZN16CCmPluginBaseEngD2Ev @ 22 NONAME
+	_ZN18TCmPluginInitParamC1ERN8CommsDat11CMDBSessionE @ 23 NONAME
+	_ZN18TCmPluginInitParamC2ERN8CommsDat11CMDBSessionE @ 24 NONAME
+	_ZN23CCmClientPluginInstance4NewLEv @ 25 NONAME
+	_ZN23CCmClientPluginInstance5NewLCEv @ 26 NONAME
+	_ZN23CCmClientPluginInstanceD0Ev @ 27 NONAME
+	_ZN23CCmClientPluginInstanceD1Ev @ 28 NONAME
+	_ZN23CCmClientPluginInstanceD2Ev @ 29 NONAME
+	_ZNK16CCmPluginBaseEng20CheckIfNameModifiedLEPN8CommsDat13CCDRecordBaseES2_ @ 30 NONAME
+	_ZNK16CCmPluginBaseEng31GetGenericTableIdsToBeObservedLER6RArrayImE @ 31 NONAME
+	_ZTI16CCmPluginBaseEng @ 32 NONAME
+	_ZTV16CCmPluginBaseEng @ 33 NONAME
 
--- a/cmmanager/cmmgr/cmmpluginbase/src/ccmpluginbaseeng.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmpluginbase/src/ccmpluginbaseeng.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -427,15 +427,19 @@
 // CCmPluginBaseEng::GetGenericTableIdsToBeObserved
 // ---------------------------------------------------------------------------
 //
-EXPORT_C void CCmPluginBaseEng::GetGenericTableIdsToBeObserved(
+EXPORT_C void CCmPluginBaseEng::GetGenericTableIdsToBeObservedL(
         RArray<TUint32>& aTableIdArray ) const
     {
+    OstTraceFunctionEntry0( CCMPLUGINBASEENG_GETGENERICTABLEIDSTOBEOBSERVED_ENTRY );
+
     // Service and bearer records should be added by plugins.
-
-    aTableIdArray.Append( KCDTIdIAPRecord );
-    aTableIdArray.Append( KCDTIdWAPAccessPointRecord );
-    aTableIdArray.Append( KCDTIdProxiesRecord );
-    aTableIdArray.Append( iMetadataTableId );
+    aTableIdArray.AppendL( KCDTIdIAPRecord );
+    aTableIdArray.AppendL( KCDTIdWAPAccessPointRecord );
+    aTableIdArray.AppendL( KCDTIdWAPIPBearerRecord );
+    aTableIdArray.AppendL( KCDTIdProxiesRecord );
+    aTableIdArray.AppendL( iMetadataTableId );
+
+    OstTraceFunctionExit0( CCMPLUGINBASEENG_GETGENERICTABLEIDSTOBEOBSERVED_EXIT );
     }
 
 // ---------------------------------------------------------------------------
@@ -495,12 +499,9 @@
         {
         case KIapRecordIndex:
             {
-            CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord*>(
+            aCopyInstance->iIapRecord = static_cast<CCDIAPRecord*>(
                     CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
-            CleanupStack::PushL( iapRecord );
-            CopyRecordFieldsL( *iIapRecord, *iapRecord );
-            CleanupStack::Pop( iapRecord );
-            aCopyInstance->iIapRecord = iapRecord;
+            CopyRecordFieldsL( *iIapRecord, *aCopyInstance->iIapRecord );
             }
             break;
         case KServiceRecordIndex:
@@ -512,46 +513,39 @@
             break;
         case KNetworkRecordIndex:
             {
-            CCDNetworkRecord* networkRecord = static_cast<CCDNetworkRecord*>(
+            aCopyInstance->iNetworkRecord = static_cast<CCDNetworkRecord*>(
                     CCDRecordBase::RecordFactoryL( KCDTIdNetworkRecord ) );
-            CleanupStack::PushL( networkRecord );
-            CopyRecordFieldsL( *iNetworkRecord, *networkRecord );
-            CleanupStack::Pop( networkRecord );
-            aCopyInstance->iNetworkRecord = networkRecord;
+            CopyRecordFieldsL( *iNetworkRecord, *aCopyInstance->iNetworkRecord );
             }
             break;
         case KWAPAPRecordIndex:
             {
             aCopyInstance->iWapAPRecord = static_cast<CCDWAPAccessPointRecord*>(
-                    CCDRecordBase::CreateCopyRecordL( *iWapAPRecord ) );//TODO, convert to generic copy
+                    CCDRecordBase::RecordFactoryL( KCDTIdWAPAccessPointRecord ) );
+            CopyRecordFieldsL( *iWapAPRecord, *aCopyInstance->iWapAPRecord );
             }
             break;
         case KWAPBearerRecordIndex:
             {
             aCopyInstance->iWapIPBearerRecord = static_cast<CCDWAPIPBearerRecord*>(
-                    CCDRecordBase::CreateCopyRecordL( *iWapIPBearerRecord ) );//TODO, convert to generic copy
+                    CCDRecordBase::RecordFactoryL( KCDTIdWAPIPBearerRecord ) );
+            CopyRecordFieldsL( *iWapIPBearerRecord, *aCopyInstance->iWapIPBearerRecord );
             }
             break;
         case KMetaDataRecordIndex:
             {
-            CCDIAPMetadataRecord* metadataRecord =
-                    new( ELeave ) CCDIAPMetadataRecord( iMetadataTableId );
-            CleanupStack::PushL( metadataRecord );
-            CopyRecordFieldsL( *iMetaDataRecord, *metadataRecord );
-            CleanupStack::Pop( metadataRecord );
-            aCopyInstance->iMetaDataRecord = metadataRecord;
+            aCopyInstance->iMetaDataRecord = new( ELeave ) CCDIAPMetadataRecord( 
+                    iMetadataTableId );
+            CopyRecordFieldsL( *iMetaDataRecord, *aCopyInstance->iMetaDataRecord );
             }
             break;
         case KProxyRecordIndex:
             {
             if ( iProxyRecord )
                 {
-                CCDProxiesRecord* proxyRecord = static_cast<CCDProxiesRecord*>(
+                aCopyInstance->iProxyRecord = static_cast<CCDProxiesRecord*>(
                         CCDRecordBase::RecordFactoryL( KCDTIdProxiesRecord ) );
-                CleanupStack::PushL( proxyRecord );
-                CopyRecordFieldsL( *iProxyRecord, *proxyRecord );
-                CleanupStack::Pop( proxyRecord );
-                aCopyInstance->iProxyRecord = proxyRecord;
+                CopyRecordFieldsL( *iProxyRecord, *aCopyInstance->iProxyRecord );
                 }
             }
             break;
@@ -591,57 +585,49 @@
         ptrSource = aSource.GetFieldByIdL( recordInfo->iTypeId );
         ptrDest = aDestination.GetFieldByIdL( recordInfo->iTypeId );
 
-        // Make sure we see only basic type info. Masks out any additional info
-        // on links (CommsDat internal stuff).
-        switch ( recordInfo->iValType & 0x000000ff )
+        if ( !( ptrSource->IsNull() ) )
             {
-            case CommsDat::EInt:
-            case CommsDat::EBool:
+            // Make sure we see only basic type info. Masks out any additional info
+            // on links (CommsDat internal stuff).
+            switch ( recordInfo->iValType & 0x000000ff )
                 {
-                if ( !( ptrSource->IsNull() ) )
+                case CommsDat::EInt:
+                case CommsDat::EBool:
                     {
                     static_cast<CMDBField<TInt>&>( *ptrDest ).SetL(
                             static_cast<CMDBField<TInt>&>( *ptrSource ) );
                     }
-                }
-                break;
-            case CommsDat::EUint32:
-            case CommsDat::ELink:
-                {
-                if ( !( ptrSource->IsNull() ) )
+                    break;
+                case CommsDat::EUint32:
+                case CommsDat::ELink:
                     {
                     static_cast<CMDBField<TUint32>&>( *ptrDest ).SetL(
                             static_cast<CMDBField<TUint32>&>( *ptrSource ) );
                     }
-                }
-                break;
-            case CommsDat::EDesC8:
-                {
-                if ( !( ptrSource->IsNull() ) )
+                    break;
+                case CommsDat::EDesC8:
                     {
                     static_cast<CMDBField<TDesC8>&>( *ptrDest ).SetL(
                             static_cast<CMDBField<TDesC8>&>( *ptrSource ) );
                     }
-                }
-                break;
-            case CommsDat::EText:
-            case CommsDat::EMedText:
-            case CommsDat::ELongText:
-                {
-                if ( !( ptrSource->IsNull() ) )
+                    break;
+                case CommsDat::EText:
+                case CommsDat::EMedText:
+                case CommsDat::ELongText:
                     {
                     static_cast<CMDBField<TDesC>&>( *ptrDest ).SetL(
                             static_cast<CMDBField<TDesC>&>( *ptrSource ) );
                     }
+                    break;
+                default:
+                    {
+                    User::Leave( KErrCorrupt );
+                    }
+                    break;
                 }
-                break;
-            default:
-                {
-                User::Leave( KErrCorrupt );
-                }
-                break;
+            ptrDest->ClearAttributes( ptrDest->Attributes() );
+            ptrDest->SetAttributes( ptrSource->Attributes() );
             }
-        ptrDest->SetAttributes( ptrSource->Attributes() );
         recordInfo++;
         }
 
@@ -663,13 +649,8 @@
     LoadMetadataRecordL();
     LoadNetworkRecordL();
 
-    // This is a connectionmethodinfo instance, that has no
-    // service and proxy setting.
-    if ( KDummyBearerType != iBearerType )
-        {
-        LoadServiceRecordL();
-        LoadProxyRecordL();
-        }
+    LoadServiceRecordL();
+    LoadProxyRecordL();
 
     LoadBearerRecordsL();
 
@@ -895,6 +876,9 @@
         CheckIfNameModifiedL( iapRecord, iIapRecord );
 
         iIapRecord->StoreL( iSession );
+        // Have to be "reloaded" to get possible default values 
+        // from template records.
+        iIapRecord->LoadL( iSession );
 
         iCmId = iIapRecord->RecordId();
         aClientPluginInstance->iIapId = iCmId;
@@ -974,7 +958,9 @@
 
         iProxyRecord->SetRecordId( KCDNewRecordRequest );
         iProxyRecord->StoreL( iSession );
-        CopyRecordFieldsL( *iProxyRecord, *proxyRecord );
+        // Have to be "reloaded" to get possible default values from template records.
+        iProxyRecord->LoadL( iSession );
+
         proxyRecord->SetElementId( iProxyRecord->ElementId() );
         }
     else
@@ -982,6 +968,7 @@
         {
         iProxyRecord->ModifyL( iSession );
         }
+    CopyRecordFieldsL( *iProxyRecord, *proxyRecord );
 
     OstTraceFunctionExit0( CCMPLUGINBASEENG_UPDATEPROXYRECORDL_EXIT );
     }
@@ -1009,7 +996,9 @@
     delete iMetaDataRecord;
     iMetaDataRecord = NULL;
     iMetaDataRecord = new( ELeave ) CCDIAPMetadataRecord( iMetadataTableId );
+
     CopyRecordFieldsL( *clientMetadataRecord, *iMetaDataRecord );
+
     iMetaDataRecord->SetElementId( clientMetadataRecord->ElementId() );
 
     if ( !iMetaDataRecord->RecordId() )
@@ -1017,12 +1006,16 @@
         iMetaDataRecord->iIAP = IAPRecordElementId();
         iMetaDataRecord->SetRecordId( KCDNewRecordRequest );
         iMetaDataRecord->StoreL( iSession );
+        // Have to be "reloaded" to get possible default values from template records.
+        iMetaDataRecord->LoadL( iSession );
+
         clientMetadataRecord->SetElementId( iMetaDataRecord->ElementId() );
         }
     else
         {
         iMetaDataRecord->ModifyL( iSession );
         }
+    CopyRecordFieldsL( *iMetaDataRecord, *clientMetadataRecord );
 
     OstTraceFunctionExit0( CCMPLUGINBASEENG_UPDATEMETADATARECORDL_EXIT );
     }
@@ -1083,12 +1076,16 @@
         {
         iNetworkRecord->SetRecordId( KCDNewRecordRequest );
         iNetworkRecord->StoreL( iSession );
+        // Have to be "reloaded" to get possible default values from template records.
+        iNetworkRecord->LoadL( iSession );
+
         networkRecord->SetElementId( iNetworkRecord->ElementId() );
         }
     else
         {
         iNetworkRecord->ModifyL( iSession );
         }
+    CopyRecordFieldsL( *iNetworkRecord, *networkRecord );
 
     OstTraceFunctionExit0( CCMPLUGINBASEENG_UPDATENETWORKRECORDL_EXIT );
     }
@@ -1238,24 +1235,32 @@
     CheckIfNameModifiedL( iapRecord, wapAPRecord );
     CheckIfNameModifiedL( iapRecord, wapIPBearerRecord );
 
+    // WAP AP record
     iWapAPRecord = static_cast<CCDWAPAccessPointRecord*>(
-            CCDRecordBase::CreateCopyRecordL( *wapAPRecord ) );//TODO, convert to generic copy
+            CCDRecordBase::RecordFactoryL( KCDTIdWAPAccessPointRecord ) );
+    CopyRecordFieldsL( *wapAPRecord, *iWapAPRecord );
     iWapAPRecord->SetElementId( wapAPRecord->ElementId() );
 
-    iWapIPBearerRecord = static_cast<CCDWAPIPBearerRecord*>(
-            CCDRecordBase::CreateCopyRecordL( *wapIPBearerRecord ) );//TODO, convert to generic copy
+    // WAP IP Bearer record
+    iWapIPBearerRecord =static_cast<CCDWAPIPBearerRecord*>(
+            CCDRecordBase::RecordFactoryL( KCDTIdWAPIPBearerRecord ) );
+    CopyRecordFieldsL( *wapIPBearerRecord, *iWapIPBearerRecord );
     iWapIPBearerRecord->SetElementId( wapIPBearerRecord->ElementId() );
 
     if ( !iWapAPRecord->RecordId() )
         {
         iWapAPRecord->SetRecordId( KCDNewRecordRequest );
         iWapAPRecord->StoreL(iSession );
+        // Have to be "reloaded" to get possible default values from template records.
+        iWapAPRecord->LoadL(iSession );
+
         wapAPRecord->SetElementId( iWapAPRecord->ElementId() );
         }
     else
         {
         iWapAPRecord->ModifyL( iSession );
         }
+    CopyRecordFieldsL( *iWapAPRecord, *wapAPRecord );
 
     if ( !iWapIPBearerRecord->RecordId() )
         {
@@ -1264,15 +1269,16 @@
 
         iWapIPBearerRecord->SetRecordId( KCDNewRecordRequest );
         iWapIPBearerRecord->StoreL( iSession );
+        // Have to be "reloaded" to get possible default values from template records.
+        iWapIPBearerRecord->LoadL( iSession );
+
         wapIPBearerRecord->SetElementId( iWapIPBearerRecord->ElementId() );
-
-        wapIPBearerRecord->iWAPAccessPointId = iWapAPRecord->RecordId();
-        wapIPBearerRecord->iWAPIAP = iapRecord->RecordId();
         }
     else
         {
         iWapIPBearerRecord->ModifyL( iSession );
         }
+    CopyRecordFieldsL( *iWapIPBearerRecord, *wapIPBearerRecord );
 
     OstTraceFunctionExit0( DUP1_CCMPLUGINBASEENG_UPDATEWAPRECORDL_EXIT );
     }
@@ -2107,9 +2113,10 @@
     if ( iWapAPRecord )
         {
         CCDWAPAccessPointRecord* wapAPRecord = static_cast<CCDWAPAccessPointRecord*>(
-                CCDRecordBase::CreateCopyRecordL( *iWapAPRecord ) );//TODO, convert to generic copy
+                CCDRecordBase::RecordFactoryL( KCDTIdWAPAccessPointRecord ) );
+        CleanupStack::PushL( wapAPRecord );
+        CopyRecordFieldsL( *iWapAPRecord, *wapAPRecord );
         wapAPRecord->SetElementId( iWapAPRecord->ElementId() );
-        CleanupStack::PushL( wapAPRecord );
         aClientPluginInstance->iGenRecordArray.AppendL(
                 static_cast<CommsDat::CCDRecordBase*>( wapAPRecord ) );
         CleanupStack::Pop( wapAPRecord );
@@ -2122,9 +2129,10 @@
     if ( iWapIPBearerRecord )
         {
         CCDWAPIPBearerRecord* wapIPBearerRecord = static_cast<CCDWAPIPBearerRecord*>(
-                CCDRecordBase::CreateCopyRecordL( *iWapIPBearerRecord ) );//TODO, convert to generic copy
+                CCDRecordBase::RecordFactoryL( KCDTIdWAPIPBearerRecord ) );
+        CleanupStack::PushL( wapIPBearerRecord );
+        CopyRecordFieldsL( *iWapIPBearerRecord, *wapIPBearerRecord );
         wapIPBearerRecord->SetElementId( iWapIPBearerRecord->ElementId() );
-        CleanupStack::PushL( wapIPBearerRecord );
         aClientPluginInstance->iGenRecordArray.AppendL(
                 static_cast<CommsDat::CCDRecordBase*>( wapIPBearerRecord ) );
         CleanupStack::Pop( wapIPBearerRecord );
@@ -2339,7 +2347,9 @@
                 }
             else
                 {
-                retVal = IsProtected();
+                CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord*>(
+                        aClientPluginInstance->iGenRecordArray[KIapRecordIndex] );
+                retVal = iapRecord->Attributes() & ECDProtectedWrite;
                 }
             }
             break;
--- a/cmmanager/cmmgr/cmmplugins/cmpluginembdestination/src/cmpluginembdestination.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginembdestination/src/cmpluginembdestination.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -83,6 +83,7 @@
         CCmPluginBaseEng( aInitParam )
 	{
 	iBearerType = KUidEmbeddedDestination;
+	iDestMetadataTableId = 0;
 	}
 
 // ---------------------------------------------------------------------------
--- a/cmmanager/cmmgr/cmmplugins/cmpluginlan/src/cmpluginlan.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginlan/src/cmpluginlan.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -117,6 +117,7 @@
 
     iBearerType = KUidLanBearerType;
     iBearerRecord = NULL;
+    iBearerPriorityTableId = 0;
 
     OstTraceFunctionExit0( DUP1_CCMPLUGINLAN_CCMPLUGINLAN_EXIT );
     }
@@ -477,108 +478,7 @@
     CCDLANServiceRecord* clientServiceRecordCopy =
             static_cast<CCDLANServiceRecord*>( aGenRecordArray[KServiceRecordIndex] );
 
-    // LAN Service copy does not work so we have to copy it manually.
-
-    if ( !clientServiceRecordCopy->iRecordTag.IsNull() )
-        {
-        origServiceRecord->iRecordTag.SetL(
-                clientServiceRecordCopy->iRecordTag );
-        }
-    if ( !clientServiceRecordCopy->iRecordName.IsNull() )
-        {
-        origServiceRecord->iRecordName.SetL(
-                clientServiceRecordCopy->iRecordName );
-        }
-    if ( !clientServiceRecordCopy->iServiceEnableLlmnr.IsNull() )
-        {
-        origServiceRecord->iServiceEnableLlmnr.SetL(
-                clientServiceRecordCopy->iServiceEnableLlmnr );
-        }
-    if ( !clientServiceRecordCopy->iIfNetworks.IsNull() )
-        {
-        origServiceRecord->iIfNetworks.SetL(
-                clientServiceRecordCopy->iIfNetworks );
-        }
-    if ( !clientServiceRecordCopy->iIpNetmask.IsNull() )
-        {
-        origServiceRecord->iIpNetmask.SetL(
-                clientServiceRecordCopy->iIpNetmask );
-        }
-    if ( !clientServiceRecordCopy->iIpGateway.IsNull() )
-        {
-        origServiceRecord->iIpGateway.SetL(
-                clientServiceRecordCopy->iIpGateway );
-        }
-    if ( !clientServiceRecordCopy->iIpAddrFromServer.IsNull() )
-        {
-        origServiceRecord->iIpAddrFromServer.SetL(
-                clientServiceRecordCopy->iIpAddrFromServer );
-        }
-    if ( !clientServiceRecordCopy->iIpAddr.IsNull() )
-        {
-        origServiceRecord->iIpAddr.SetL(
-                clientServiceRecordCopy->iIpAddr );
-        }
-    if ( !clientServiceRecordCopy->iIpDnsAddrFromServer.IsNull() )
-        {
-        origServiceRecord->iIpDnsAddrFromServer.SetL(
-                clientServiceRecordCopy->iIpDnsAddrFromServer );
-        }
-    if ( !clientServiceRecordCopy->iIpNameServer1.IsNull() )
-        {
-        origServiceRecord->iIpNameServer1.SetL(
-                clientServiceRecordCopy->iIpNameServer1 );
-        }
-    if ( !clientServiceRecordCopy->iIpNameServer2.IsNull() )
-        {
-        origServiceRecord->iIpNameServer2.SetL(
-                clientServiceRecordCopy->iIpNameServer2 );
-        }
-    if ( !clientServiceRecordCopy->iIp6DnsAddrFromServer.IsNull() )
-        {
-        origServiceRecord->iIp6DnsAddrFromServer.SetL(
-                clientServiceRecordCopy->iIp6DnsAddrFromServer );
-        }
-    if ( !clientServiceRecordCopy->iIp6NameServer1.IsNull() )
-        {
-        origServiceRecord->iIp6NameServer1.SetL(
-                clientServiceRecordCopy->iIp6NameServer1 );
-        }
-    if ( !clientServiceRecordCopy->iIp6NameServer2.IsNull() )
-        {
-        origServiceRecord->iIp6NameServer2.SetL(
-                clientServiceRecordCopy->iIp6NameServer2 );
-        }
-    if ( !clientServiceRecordCopy->iIpAddrLeaseValidFrom.IsNull() )
-        {
-        origServiceRecord->iIpAddrLeaseValidFrom.SetL(
-                clientServiceRecordCopy->iIpAddrLeaseValidFrom );
-        }
-    if ( !clientServiceRecordCopy->iIpAddrLeaseValidTo.IsNull() )
-        {
-        origServiceRecord->iIpAddrLeaseValidTo.SetL(
-                clientServiceRecordCopy->iIpAddrLeaseValidTo );
-        }
-    if ( !clientServiceRecordCopy->iConfigDaemonManagerName.IsNull() )
-        {
-        origServiceRecord->iConfigDaemonManagerName.SetL(
-                clientServiceRecordCopy->iConfigDaemonManagerName );
-        }
-    if ( !clientServiceRecordCopy->iConfigDaemonName.IsNull() )
-        {
-        origServiceRecord->iConfigDaemonName.SetL(
-                clientServiceRecordCopy->iConfigDaemonName );
-        }
-    if ( !clientServiceRecordCopy->iServiceExtensionTableName.IsNull() )
-        {
-        origServiceRecord->iServiceExtensionTableName.SetL(
-                clientServiceRecordCopy->iServiceExtensionTableName );
-        }
-    if ( !clientServiceRecordCopy->iServiceExtensionTableRecordId.IsNull() )
-        {
-        origServiceRecord->iServiceExtensionTableRecordId.SetL(
-                clientServiceRecordCopy->iServiceExtensionTableRecordId ); //TODO, check this works ok.
-        }
+    CopyRecordFieldsL( *clientServiceRecordCopy, *origServiceRecord );
 
     origServiceRecord->SetElementId( clientServiceRecordCopy->ElementId() );
 
@@ -587,6 +487,9 @@
         origServiceRecord->SetRecordId( KCDNewRecordRequest );
         origServiceRecord->StoreL( iSession );
 
+        // Have to be "reloaded" to get possible default values from template records.
+        origServiceRecord->LoadL( iSession );
+
         // Update received element ID to client's copy too.
         clientServiceRecordCopy->SetElementId( origServiceRecord->ElementId() );
         }
@@ -595,6 +498,9 @@
         origServiceRecord->ModifyL( iSession );
         }
 
+    CCmPluginBaseEng::CopyRecordFieldsL( *origServiceRecord,
+            *clientServiceRecordCopy );
+
     OstTraceFunctionExit0( CCMPLUGINLAN_UPDATESERVICERECORDL_EXIT );
     }
 
--- a/cmmanager/cmmgr/cmmplugins/cmpluginpacketdata/src/cmpluginpacketdata.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginpacketdata/src/cmpluginpacketdata.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -295,6 +295,7 @@
     iBearerRecordId = 0;
     iBearerRecordName = NULL;
     iPacketDataQoSRecord = NULL;
+    iBearerPriorityTableId = 0;
 
     OstTraceFunctionExit0( DUP1_CCMPLUGINPACKETDATA_CCMPLUGINPACKETDATA_EXIT );
     }
@@ -813,250 +814,10 @@
 
     // Client's copy of packet service record.
     CCDWCDMAPacketServiceRecord* clientServiceRecordCopy =
-            static_cast<CCDWCDMAPacketServiceRecord*>( aGenRecordArray[KServiceRecordIndex] );
-
-    if ( !clientServiceRecordCopy->iRecordTag.IsNull() )
-        {
-        origServiceRecord->iRecordTag.SetL(
-                clientServiceRecordCopy->iRecordTag );
-        }
-    if ( !clientServiceRecordCopy->iRecordName.IsNull() )
-        {
-        origServiceRecord->iRecordName.SetL(
-                clientServiceRecordCopy->iRecordName );
-        }
-
-    if ( !clientServiceRecordCopy->iServiceEnableLlmnr.IsNull() )
-        {
-        origServiceRecord->iServiceEnableLlmnr.SetL(
-                clientServiceRecordCopy->iServiceEnableLlmnr );
-        }
-
-    if ( !clientServiceRecordCopy->iGPRSAPN.IsNull() )
-        {
-        origServiceRecord->iGPRSAPN.SetL(
-                clientServiceRecordCopy->iGPRSAPN );
-        }
-    if ( !clientServiceRecordCopy->iGPRSPDPType.IsNull() )
-        {
-        origServiceRecord->iGPRSPDPType.SetL(
-                clientServiceRecordCopy->iGPRSPDPType );
-        }
-    if ( !clientServiceRecordCopy->iGPRSPDPAddress.IsNull() )
-        {
-        origServiceRecord->iGPRSPDPAddress.SetL(
-                clientServiceRecordCopy->iGPRSPDPAddress );
-        }
-    if ( !clientServiceRecordCopy->iGPRSReqPrecedence.IsNull() )
-        {
-        origServiceRecord->iGPRSReqPrecedence.SetL(
-                clientServiceRecordCopy->iGPRSReqPrecedence );
-        }
-    if ( !clientServiceRecordCopy->iGPRSReqDelay.IsNull() )
-        {
-        origServiceRecord->iGPRSReqDelay.SetL(
-                clientServiceRecordCopy->iGPRSReqDelay );
-        }
-    if ( !clientServiceRecordCopy->iGPRSReqReliability.IsNull() )
-        {
-        origServiceRecord->iGPRSReqReliability.SetL(
-                clientServiceRecordCopy->iGPRSReqReliability );
-        }
-    if ( !clientServiceRecordCopy->iGPRSReqPeakThroughput.IsNull() )
-        {
-        origServiceRecord->iGPRSReqPeakThroughput.SetL(
-                clientServiceRecordCopy->iGPRSReqPeakThroughput );
-        }
-    if ( !clientServiceRecordCopy->iGPRSReqMeanThroughput.IsNull() )
-        {
-        origServiceRecord->iGPRSReqMeanThroughput.SetL(
-                clientServiceRecordCopy->iGPRSReqMeanThroughput );
-        }
-    if ( !clientServiceRecordCopy->iGPRSMinPrecedence.IsNull() )
-        {
-        origServiceRecord->iGPRSMinPrecedence.SetL(
-                clientServiceRecordCopy->iGPRSMinPrecedence );
-        }
-    if ( !clientServiceRecordCopy->iGPRSMinDelay.IsNull() )
-        {
-        origServiceRecord->iGPRSMinDelay.SetL(
-                clientServiceRecordCopy->iGPRSMinDelay );
-        }
-    if ( !clientServiceRecordCopy->iGPRSMinReliability.IsNull() )
-        {
-        origServiceRecord->iGPRSMinReliability.SetL(
-                clientServiceRecordCopy->iGPRSMinReliability );
-        }
-    if ( !clientServiceRecordCopy->iGPRSMinPeakThroughput.IsNull() )
-        {
-        origServiceRecord->iGPRSMinPeakThroughput.SetL(
-                clientServiceRecordCopy->iGPRSMinPeakThroughput );
-        }
-    if ( !clientServiceRecordCopy->iGPRSMinMeanThroughput.IsNull() )
-        {
-        origServiceRecord->iGPRSMinMeanThroughput.SetL(
-                clientServiceRecordCopy->iGPRSMinMeanThroughput );
-        }
-    if ( !clientServiceRecordCopy->iGPRSDataCompression.IsNull() )
-        {
-        origServiceRecord->iGPRSDataCompression.SetL(
-                clientServiceRecordCopy->iGPRSDataCompression );
-        }
-    if ( !clientServiceRecordCopy->iGPRSHeaderCompression.IsNull() )
-        {
-        origServiceRecord->iGPRSHeaderCompression.SetL(
-                clientServiceRecordCopy->iGPRSHeaderCompression );
-        }
-    if ( !clientServiceRecordCopy->iGPRSUseEdge.IsNull() )
-        {
-        origServiceRecord->iGPRSUseEdge.SetL(
-                clientServiceRecordCopy->iGPRSUseEdge );
-        }
-    if ( !clientServiceRecordCopy->iGPRSAnonymousAccess.IsNull() )
-        {
-        origServiceRecord->iGPRSAnonymousAccess.SetL(
-                clientServiceRecordCopy->iGPRSAnonymousAccess );
-        }
-    if ( !clientServiceRecordCopy->iGPRSIfParams.IsNull() )
-        {
-        origServiceRecord->iGPRSIfParams.SetL(
-                clientServiceRecordCopy->iGPRSIfParams );
-        }
-    if ( !clientServiceRecordCopy->iGPRSIfNetworks.IsNull() )
-        {
-        origServiceRecord->iGPRSIfNetworks.SetL(
-                clientServiceRecordCopy->iGPRSIfNetworks );
-        }
-    if ( !clientServiceRecordCopy->iGPRSIfPromptForAuth.IsNull() )
-        {
-        origServiceRecord->iGPRSIfPromptForAuth.SetL(
-                clientServiceRecordCopy->iGPRSIfPromptForAuth );
-        }
-    if ( !clientServiceRecordCopy->iGPRSIfAuthName.IsNull() )
-        {
-        origServiceRecord->iGPRSIfAuthName.SetL(
-                clientServiceRecordCopy->iGPRSIfAuthName );
-        }
-    if ( !clientServiceRecordCopy->iGPRSIfAuthPass.IsNull() )
-        {
-        origServiceRecord->iGPRSIfAuthPass.SetL(
-                clientServiceRecordCopy->iGPRSIfAuthPass );
-        }
-    if ( !clientServiceRecordCopy->iGPRSIfAuthRetries.IsNull() )
-        {
-        origServiceRecord->iGPRSIfAuthRetries.SetL(
-                clientServiceRecordCopy->iGPRSIfAuthRetries );
-        }
-    if ( !clientServiceRecordCopy->iGPRSIPNetMask.IsNull() )
-        {
-        origServiceRecord->iGPRSIPNetMask.SetL(
-                clientServiceRecordCopy->iGPRSIPNetMask );
-        }
-    if ( !clientServiceRecordCopy->iGPRSIPGateway.IsNull() )
-        {
-        origServiceRecord->iGPRSIPGateway.SetL(
-                clientServiceRecordCopy->iGPRSIPGateway );
-        }
-    if ( !clientServiceRecordCopy->iGPRSIPAddrFromServer.IsNull() )
-        {
-        origServiceRecord->iGPRSIPAddrFromServer.SetL(
-                clientServiceRecordCopy->iGPRSIPAddrFromServer );
-        }
-    if ( !clientServiceRecordCopy->iGPRSIPAddr.IsNull() )
-        {
-        origServiceRecord->iGPRSIPAddr.SetL(
-                clientServiceRecordCopy->iGPRSIPAddr );
-        }
-    if ( !clientServiceRecordCopy->iGPRSIPDNSAddrFromServer.IsNull() )
-        {
-        origServiceRecord->iGPRSIPDNSAddrFromServer.SetL(
-                clientServiceRecordCopy->iGPRSIPDNSAddrFromServer );
-        }
-    if ( !clientServiceRecordCopy->iGPRSIPNameServer1.IsNull() )
-        {
-        origServiceRecord->iGPRSIPNameServer1.SetL(
-                clientServiceRecordCopy->iGPRSIPNameServer1 );
-        }
-    if ( !clientServiceRecordCopy->iGPRSIPNameServer2.IsNull() )
-        {
-        origServiceRecord->iGPRSIPNameServer2.SetL(
-                clientServiceRecordCopy->iGPRSIPNameServer2 );
-        }
-    if ( !clientServiceRecordCopy->iGPRSIP6DNSAddrFromServer.IsNull() )
-        {
-        origServiceRecord->iGPRSIP6DNSAddrFromServer.SetL(
-                clientServiceRecordCopy->iGPRSIP6DNSAddrFromServer );
-        }
-    if ( !clientServiceRecordCopy->iGPRSIP6NameServer1.IsNull() )
-        {
-        origServiceRecord->iGPRSIP6NameServer1.SetL(
-                clientServiceRecordCopy->iGPRSIP6NameServer1 );
-        }
-    if ( !clientServiceRecordCopy->iGPRSIP6NameServer2.IsNull() )
-        {
-        origServiceRecord->iGPRSIP6NameServer2.SetL(
-                clientServiceRecordCopy->iGPRSIP6NameServer2 );
-        }
-    if ( !clientServiceRecordCopy->iGPRSIPAddrLeaseValidFrom.IsNull() )
-        {
-        origServiceRecord->iGPRSIPAddrLeaseValidFrom.SetL(
-                clientServiceRecordCopy->iGPRSIPAddrLeaseValidFrom );
-        }
-    if ( !clientServiceRecordCopy->iGPRSIPAddrLeaseValidTo.IsNull() )
-        {
-        origServiceRecord->iGPRSIPAddrLeaseValidTo.SetL(
-                clientServiceRecordCopy->iGPRSIPAddrLeaseValidTo );
-        }
-    if ( !clientServiceRecordCopy->iGPRSConfigDaemonManagerName.IsNull() )
-        {
-        origServiceRecord->iGPRSConfigDaemonManagerName.SetL(
-                clientServiceRecordCopy->iGPRSConfigDaemonManagerName );
-        }
-    if ( !clientServiceRecordCopy->iGPRSConfigDaemonName.IsNull() )
-        {
-        origServiceRecord->iGPRSConfigDaemonName.SetL(
-                clientServiceRecordCopy->iGPRSConfigDaemonName );
-        }
-    if ( !clientServiceRecordCopy->iGPRSEnableLCPExtension.IsNull() )
-        {
-        origServiceRecord->iGPRSEnableLCPExtension.SetL(
-                clientServiceRecordCopy->iGPRSEnableLCPExtension );
-        }
-    if ( !clientServiceRecordCopy->iGPRSDisablePlainTextAuth.IsNull() )
-        {
-        origServiceRecord->iGPRSDisablePlainTextAuth.SetL(
-                clientServiceRecordCopy->iGPRSDisablePlainTextAuth );
-        }
-    if ( !clientServiceRecordCopy->iGPRSAPType.IsNull() )
-        {
-        origServiceRecord->iGPRSAPType.SetL(
-                clientServiceRecordCopy->iGPRSAPType );
-        }
-    if ( !clientServiceRecordCopy->iGPRSQOSWarningTimeOut.IsNull() )
-        {
-        origServiceRecord->iGPRSQOSWarningTimeOut.SetL(
-                clientServiceRecordCopy->iGPRSQOSWarningTimeOut );
-        }
-    if ( !clientServiceRecordCopy->iGPRSR5DataCompression.IsNull() )
-        {
-        origServiceRecord->iGPRSR5DataCompression.SetL(
-                clientServiceRecordCopy->iGPRSR5DataCompression );
-        }
-    if ( !clientServiceRecordCopy->iGPRSR5HeaderCompression.IsNull() )
-        {
-        origServiceRecord->iGPRSR5HeaderCompression.SetL(
-                clientServiceRecordCopy->iGPRSR5HeaderCompression );
-        }
-    if ( !clientServiceRecordCopy->iGPRSPacketFlowIdentifier.IsNull() )
-        {
-        origServiceRecord->iGPRSPacketFlowIdentifier.SetL(
-                clientServiceRecordCopy->iGPRSPacketFlowIdentifier );
-        }
-    if ( !clientServiceRecordCopy->iGPRSUmtsGprsRelease.IsNull() )
-        {
-        origServiceRecord->iGPRSUmtsGprsRelease.SetL(
-                clientServiceRecordCopy->iGPRSUmtsGprsRelease );
-        }
+            static_cast<CCDWCDMAPacketServiceRecord*>(
+                    aGenRecordArray[KServiceRecordIndex] );
+
+    CopyRecordFieldsL( *clientServiceRecordCopy, *origServiceRecord );
 
     if ( iPacketDataQoSRecord )
         {
@@ -1069,6 +830,8 @@
         {
         origServiceRecord->SetRecordId( KCDNewRecordRequest );
         origServiceRecord->StoreL( iSession );
+        // Have to be "reloaded" to get possible default values from template records.
+        origServiceRecord->LoadL( iSession );
 
         // Update received element ID to client's copy too.
         clientServiceRecordCopy->SetElementId( origServiceRecord->ElementId() );
@@ -1078,6 +841,8 @@
         origServiceRecord->ModifyL( iSession );
         }
 
+    CopyRecordFieldsL( *origServiceRecord, *clientServiceRecordCopy );
+
     OstTraceFunctionExit0( CCMPLUGINPACKETDATA_UPDATESERVICERECORDL_EXIT );
     }
 
@@ -1105,6 +870,7 @@
         {
         iPacketDataQoSRecord->SetRecordId( KCDNewRecordRequest );
         iPacketDataQoSRecord->StoreL( iSession );
+        iPacketDataQoSRecord->LoadL( iSession );
         packetDataQoSRecord->SetElementId( iPacketDataQoSRecord->ElementId() );
 
         // Set service record to point to QoS record.
@@ -1120,6 +886,8 @@
         iPacketDataQoSRecord->ModifyL( iSession );
         }
 
+    CopyRecordFieldsL( *iPacketDataQoSRecord, *packetDataQoSRecord );
+
     OstTraceFunctionExit0( CCMPLUGINPACKETDATA_UPDATEBEARERRECORDSL_EXIT );
     }
 
--- a/cmmanager/cmmgr/cmmplugins/cmpluginwlan/src/cmpluginwlan.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginwlan/src/cmpluginwlan.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -130,6 +130,7 @@
     iWlanServiceRecord = NULL;
     iWlanTableId = 0;
     iWAPISupported = EFalse;
+    iBearerPriorityTableId = 0;
 
     OstTraceFunctionExit0( DUP1_CCMPLUGINWLAN_CCMPLUGINWLAN_EXIT );
     }
@@ -1297,14 +1298,14 @@
     {
     OstTraceFunctionEntry0( CCMPLUGINWLAN_DELETEBEARERRECORDSL_ENTRY );
 
-    // Save the wlan service record id for the EAP settings deletion 
+    // Save the wlan service record id for the EAP settings deletion.
     TUint wlanServiceRecordId = iWlanServiceRecord->RecordId();
-    
+
     // As base class deletes service record, in this case LAN, only WLAN
     // related stuff needs to be deleted.
     iWlanServiceRecord->DeleteL( iSession );
-    
-    // Delete EAP specific
+
+    // Delete EAP specific.
     CEapGeneralSettings* eapSettings( NULL );
     TRAPD( err, eapSettings = CEapGeneralSettings::NewL( ELan, wlanServiceRecordId ) );
     if ( err == KErrNone )
@@ -1520,95 +1521,15 @@
     iServiceRecord = static_cast<CCDLANServiceRecord *>(
             CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord ) );
 
-    // LAN Service copy does not work so we have to copy it manually.
-
     // Plugin's commsdat copy.
-    CCDLANServiceRecord* origServiceRecord = static_cast<CCDLANServiceRecord*>( iServiceRecord );
+    CCDLANServiceRecord* origServiceRecord =
+            static_cast<CCDLANServiceRecord*>( iServiceRecord );
 
     // Client's copy of lan service record.
     CCDLANServiceRecord* clientServiceRecordCopy =
             static_cast<CCDLANServiceRecord*>( aGenRecordArray[KServiceRecordIndex] );
 
-    if ( !clientServiceRecordCopy->iRecordTag.IsNull() )
-        {
-        origServiceRecord->iRecordTag.SetL( clientServiceRecordCopy->iRecordTag );
-        }
-    if ( !clientServiceRecordCopy->iRecordName.IsNull() )
-        {
-        origServiceRecord->iRecordName.SetL( clientServiceRecordCopy->iRecordName );
-        }
-    if ( !clientServiceRecordCopy->iServiceEnableLlmnr.IsNull() )
-        {
-        origServiceRecord->iServiceEnableLlmnr.SetL( clientServiceRecordCopy->iServiceEnableLlmnr );
-        }
-    if ( !clientServiceRecordCopy->iIfNetworks.IsNull() )
-        {
-        origServiceRecord->iIfNetworks.SetL( clientServiceRecordCopy->iIfNetworks );
-        }
-    if ( !clientServiceRecordCopy->iIpNetmask.IsNull() )
-        {
-        origServiceRecord->iIpNetmask.SetL( clientServiceRecordCopy->iIpNetmask );
-        }
-    if ( !clientServiceRecordCopy->iIpGateway.IsNull() )
-        {
-        origServiceRecord->iIpGateway.SetL( clientServiceRecordCopy->iIpGateway );
-        }
-    if ( !clientServiceRecordCopy->iIpAddrFromServer.IsNull() )
-        {
-        origServiceRecord->iIpAddrFromServer.SetL( clientServiceRecordCopy->iIpAddrFromServer );
-        }
-    if ( !clientServiceRecordCopy->iIpAddr.IsNull() )
-        {
-        origServiceRecord->iIpAddr.SetL( clientServiceRecordCopy->iIpAddr );
-        }
-    if ( !clientServiceRecordCopy->iIpDnsAddrFromServer.IsNull() )
-        {
-        origServiceRecord->iIpDnsAddrFromServer.SetL( clientServiceRecordCopy->iIpDnsAddrFromServer );
-        }
-    if ( !clientServiceRecordCopy->iIpNameServer1.IsNull() )
-        {
-        origServiceRecord->iIpNameServer1.SetL( clientServiceRecordCopy->iIpNameServer1 );
-        }
-    if ( !clientServiceRecordCopy->iIpNameServer2.IsNull() )
-        {
-        origServiceRecord->iIpNameServer2.SetL( clientServiceRecordCopy->iIpNameServer2 );
-        }
-    if ( !clientServiceRecordCopy->iIp6DnsAddrFromServer.IsNull() )
-        {
-        origServiceRecord->iIp6DnsAddrFromServer.SetL( clientServiceRecordCopy->iIp6DnsAddrFromServer );
-        }
-    if ( !clientServiceRecordCopy->iIp6NameServer1.IsNull() )
-        {
-        origServiceRecord->iIp6NameServer1.SetL( clientServiceRecordCopy->iIp6NameServer1 );
-        }
-    if ( !clientServiceRecordCopy->iIp6NameServer2.IsNull() )
-        {
-        origServiceRecord->iIp6NameServer2.SetL( clientServiceRecordCopy->iIp6NameServer2 );
-        }
-    if ( !clientServiceRecordCopy->iIpAddrLeaseValidFrom.IsNull() )
-        {
-        origServiceRecord->iIpAddrLeaseValidFrom.SetL( clientServiceRecordCopy->iIpAddrLeaseValidFrom );
-        }
-    if ( !clientServiceRecordCopy->iIpAddrLeaseValidTo.IsNull() )
-        {
-        origServiceRecord->iIpAddrLeaseValidTo.SetL( clientServiceRecordCopy->iIpAddrLeaseValidTo );
-        }
-    if ( !clientServiceRecordCopy->iConfigDaemonManagerName.IsNull() )
-        {
-        origServiceRecord->iConfigDaemonManagerName.SetL( clientServiceRecordCopy->iConfigDaemonManagerName );
-        }
-    if ( !clientServiceRecordCopy->iConfigDaemonName.IsNull() )
-        {
-        origServiceRecord->iConfigDaemonName.SetL( clientServiceRecordCopy->iConfigDaemonName );
-        }
-    if ( !clientServiceRecordCopy->iServiceExtensionTableName.IsNull() )
-        {
-        origServiceRecord->iServiceExtensionTableName.SetL( clientServiceRecordCopy->iServiceExtensionTableName );
-        }
-    if ( !clientServiceRecordCopy->iServiceExtensionTableRecordId.IsNull() )
-        {
-        origServiceRecord->iServiceExtensionTableRecordId.SetL( clientServiceRecordCopy->iServiceExtensionTableRecordId ); //TODO, check this works ok.
-        }
+    CopyRecordFieldsL( *clientServiceRecordCopy, *origServiceRecord );
 
     origServiceRecord->SetElementId( clientServiceRecordCopy->ElementId() );
 
@@ -1616,17 +1537,28 @@
         {
         origServiceRecord->SetRecordId( KCDNewRecordRequest );
         origServiceRecord->StoreL( iSession );
+        // Have to be "reloaded" to get possible default values from template records.
+        origServiceRecord->LoadL( iSession );
 
         // Update received element ID to client's copy too.
         clientServiceRecordCopy->SetElementId( origServiceRecord->ElementId() );
+
+        // Copy record back to client's copy to be exactly same as in database.
+        CCmPluginBaseEng::CopyRecordFieldsL( *origServiceRecord,
+                *clientServiceRecordCopy );
+
         // Update needed values to other table records too (wlanservice).
-        CCDWlanServiceRecord* wlanServiceRecord = static_cast<CCDWlanServiceRecord *>(
-                aBearerSpecRecordArray[KWlanServiceRecordIndex] );
+        CCDWlanServiceRecord* wlanServiceRecord =
+                static_cast<CCDWlanServiceRecord *>(
+                        aBearerSpecRecordArray[KWlanServiceRecordIndex] );
         wlanServiceRecord->iWlanServiceId.SetL( origServiceRecord->RecordId() );
         }
     else
         {
         origServiceRecord->ModifyL( iSession );
+
+        CCmPluginBaseEng::CopyRecordFieldsL( *origServiceRecord,
+                *clientServiceRecordCopy );
         }
 
     OstTraceFunctionExit0( CCMPLUGINWLAN_UPDATESERVICERECORDL_EXIT );
@@ -1649,139 +1581,11 @@
     iWlanServiceRecord = new( ELeave ) CCDWlanServiceRecord( iWlanTableId );
 
     // Client's copy of wlan service record.
-    CCDWlanServiceRecord* clientWlanServiceRecord = static_cast<CCDWlanServiceRecord*>(
-            aBearerSpecRecordArray[KWlanServiceRecordIndex] );
+    CCDWlanServiceRecord* clientWlanServiceRecord =
+            static_cast<CCDWlanServiceRecord*>(
+                    aBearerSpecRecordArray[KWlanServiceRecordIndex] );
 
-    if ( !clientWlanServiceRecord->iRecordTag.IsNull() )
-        {
-        iWlanServiceRecord->iRecordTag.SetL(
-                clientWlanServiceRecord->iRecordTag );
-        }
-    if ( !clientWlanServiceRecord->iRecordName.IsNull() )
-        {
-        iWlanServiceRecord->iRecordName.SetL(
-                clientWlanServiceRecord->iRecordName );
-        }
-    if ( !clientWlanServiceRecord->iWlanServiceId.IsNull() )
-        {
-        iWlanServiceRecord->iWlanServiceId.SetL(
-                clientWlanServiceRecord->iWlanServiceId );
-        }
-    if ( !clientWlanServiceRecord->iWlanConnMode.IsNull() )
-        {
-        iWlanServiceRecord->iWlanConnMode.SetL(
-                clientWlanServiceRecord->iWlanConnMode );
-        }
-    if ( !clientWlanServiceRecord->iWLanSSID.IsNull() )
-        {
-        iWlanServiceRecord->iWLanSSID.SetL(
-                clientWlanServiceRecord->iWLanSSID );
-        }
-    if ( !clientWlanServiceRecord->iWLanUsedSSID.IsNull() )
-        {
-        iWlanServiceRecord->iWLanUsedSSID.SetL(
-                clientWlanServiceRecord->iWLanUsedSSID );
-        }
-    if ( !clientWlanServiceRecord->iWLanWepKey1.IsNull() )
-        {
-        iWlanServiceRecord->iWLanWepKey1.SetL(
-                clientWlanServiceRecord->iWLanWepKey1 );
-        }
-    if ( !clientWlanServiceRecord->iWLanWepKey2.IsNull() )
-        {
-        iWlanServiceRecord->iWLanWepKey2.SetL(
-                clientWlanServiceRecord->iWLanWepKey2 );
-        }
-    if ( !clientWlanServiceRecord->iWLanWepKey3.IsNull() )
-        {
-        iWlanServiceRecord->iWLanWepKey3.SetL(
-                clientWlanServiceRecord->iWLanWepKey3 );
-        }
-    if ( !clientWlanServiceRecord->iWLanWepKey4.IsNull() )
-        {
-        iWlanServiceRecord->iWLanWepKey4.SetL(
-                clientWlanServiceRecord->iWLanWepKey4 );
-        }
-    if ( !clientWlanServiceRecord->iWlanWepIndex.IsNull() )
-        {
-        iWlanServiceRecord->iWlanWepIndex.SetL(
-                clientWlanServiceRecord->iWlanWepIndex );
-        }
-    if ( !clientWlanServiceRecord->iWlanSecMode.IsNull() )
-        {
-        iWlanServiceRecord->iWlanSecMode.SetL(
-                clientWlanServiceRecord->iWlanSecMode );
-        }
-    if ( !clientWlanServiceRecord->iWlanAuthMode.IsNull() )
-        {
-        iWlanServiceRecord->iWlanAuthMode.SetL(
-                clientWlanServiceRecord->iWlanAuthMode );
-        }
-    if ( !clientWlanServiceRecord->iWlanEnableWpaPsk.IsNull() )
-        {
-        iWlanServiceRecord->iWlanEnableWpaPsk.SetL(
-                clientWlanServiceRecord->iWlanEnableWpaPsk );
-        }
-    if ( !clientWlanServiceRecord->iWLanWpaPreSharedKey.IsNull() )
-        {
-        iWlanServiceRecord->iWLanWpaPreSharedKey.SetL(
-                clientWlanServiceRecord->iWLanWpaPreSharedKey );
-        }
-    if ( !clientWlanServiceRecord->iWlanWpaKeyLength.IsNull() )
-        {
-        iWlanServiceRecord->iWlanWpaKeyLength.SetL(
-                clientWlanServiceRecord->iWlanWpaKeyLength );
-        }
-    if ( !clientWlanServiceRecord->iWLanEaps.IsNull() )
-        {
-        iWlanServiceRecord->iWLanEaps.SetL(
-                clientWlanServiceRecord->iWLanEaps );
-        }
-    if ( !clientWlanServiceRecord->iWlanScanSSID.IsNull() )
-        {
-        iWlanServiceRecord->iWlanScanSSID.SetL(
-                clientWlanServiceRecord->iWlanScanSSID );
-        }
-    if ( !clientWlanServiceRecord->iWlanChannelID.IsNull() )
-        {
-        iWlanServiceRecord->iWlanChannelID.SetL(
-                clientWlanServiceRecord->iWlanChannelID );
-        }
-    if ( !clientWlanServiceRecord->iWlanFormatKey1.IsNull() )
-        {
-        iWlanServiceRecord->iWlanFormatKey1.SetL(
-                clientWlanServiceRecord->iWlanFormatKey1 );
-        }
-    if ( !clientWlanServiceRecord->iWlanFormatKey2.IsNull() )
-        {
-        iWlanServiceRecord->iWlanFormatKey2.SetL(
-                clientWlanServiceRecord->iWlanFormatKey2 );
-        }
-    if ( !clientWlanServiceRecord->iWlanFormatKey3.IsNull() )
-        {
-        iWlanServiceRecord->iWlanFormatKey3.SetL(
-                clientWlanServiceRecord->iWlanFormatKey3 );
-        }
-    if ( !clientWlanServiceRecord->iWlanFormatKey4.IsNull() )
-        {
-        iWlanServiceRecord->iWlanFormatKey4.SetL(
-                clientWlanServiceRecord->iWlanFormatKey4 );
-        }
-    if ( !clientWlanServiceRecord->iWlanAllowSSIDRoaming.IsNull() )
-        {
-        iWlanServiceRecord->iWlanAllowSSIDRoaming.SetL(
-                clientWlanServiceRecord->iWlanAllowSSIDRoaming );
-        }
-    if ( !clientWlanServiceRecord->iWLanEnabledEaps.IsNull() )
-        {
-        iWlanServiceRecord->iWLanEnabledEaps.SetL(
-                clientWlanServiceRecord->iWLanEnabledEaps );
-        }
-    if ( !clientWlanServiceRecord->iWLanDisabledEaps.IsNull() )
-        {
-        iWlanServiceRecord->iWLanDisabledEaps.SetL(
-                clientWlanServiceRecord->iWLanDisabledEaps );
-        }
+    CopyRecordFieldsL( *clientWlanServiceRecord, *iWlanServiceRecord );
 
     iWlanServiceRecord->SetElementId( clientWlanServiceRecord->ElementId() );
 
@@ -1789,6 +1593,8 @@
         {
         iWlanServiceRecord->SetRecordId( KCDNewRecordRequest );
         iWlanServiceRecord->StoreL( iSession );
+        // Have to be "reloaded" to get possible default values from template records.
+        iWlanServiceRecord->LoadL( iSession );
 
         // Update received element ID to client's copy too.
         clientWlanServiceRecord->SetElementId( iWlanServiceRecord->ElementId() );
@@ -1798,6 +1604,10 @@
         iWlanServiceRecord->ModifyL( iSession );
         }
 
+    // Copy record back to client's copy to be exactly same as in database.
+    CCmPluginBaseEng::CopyRecordFieldsL( *iWlanServiceRecord,
+            *clientWlanServiceRecord );
+
     OstTraceFunctionExit0( CCMPLUGINWLAN_UPDATEBEARERRECORDSL_EXIT );
     }
 
@@ -2528,7 +2338,6 @@
     OstTraceFunctionEntry0( CCMPLUGINWLAN_GETBEARERTABLEIDSTOBEOBSERVEDL_ENTRY );
 
     aTableIdArray.AppendL( KCDTIdLANServiceRecord );
-    aTableIdArray.AppendL( KCDTIdLANBearerRecord );
     aTableIdArray.AppendL( iWlanTableId );
 
     OstTraceFunctionExit0( CCMPLUGINWLAN_GETBEARERTABLEIDSTOBEOBSERVEDL_EXIT );
--- a/cmmanager/cmmgr/cmmserver/inc/cmmcache.h	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmserver/inc/cmmcache.h	Wed Aug 18 10:10:23 2010 +0300
@@ -167,7 +167,7 @@
             CCmmConnMethodInstance& aConnMethodInstance );
 
     /**
-     * Re-loads a destination record if needed and copies the latest version to
+     * Reloads a destination record if needed and copies the latest version to
      * the session instance given as parameter.
      */
     void LoadDestinationRecordL(
@@ -237,7 +237,7 @@
             CCmmDestinationInstance& aDestinationInstance,
             const TUint32 aValue );
 
-    void DbChangeDetected( const TUint32 aTableId );
+    void DbChangeDetectedL( const TUint32 aTableId );
     void DbChangeError( const TUint32 aTableId );
 
     void CloseDestination( CCmmDestinationInstance& aDestinationInstance );
@@ -582,6 +582,12 @@
      */
     void DeleteDestinationForcedL( CCmmDestinationInstance& aDestinationInstance );
 
+    /**
+     * Informs all the loaded iaps if something related to their tables
+     * changed in commsdat.
+     */
+    void NotifyPluginsForTableChangesL( const TUint32 aTableId );
+
 private:
     // Monitors changes in the database.
     CCmmListenerManager* iListenerManager; // Owned.
@@ -627,6 +633,11 @@
     // Counter to generate new unique IDs. These are used to link new objects
     // without valid IDs between session side and cache.
     TUint32 iCurrentTemporaryId;
+
+    // Destination network table ID.
+    CommsDat::TMDBElementId iSnapTableId;
+    // Destination metadata table ID.
+    CommsDat::TMDBElementId iSnapMetadataTableId;
     };
 
 #endif // CMMCACHE_H_
--- a/cmmanager/cmmgr/cmmserver/inc/cmmconnmethodinstance.h	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmserver/inc/cmmconnmethodinstance.h	Wed Aug 18 10:10:23 2010 +0300
@@ -190,9 +190,14 @@
             const TDesC8& aValue );
 
     /**
+     * Gets the current status value.
+     */
+    TCmmConnMethodStatus GetStatus() const;
+
+    /**
      * Sets a new status value.
      */
-    void SetStatus( const TCmmConnMethodStatus& aStatus );
+    void SetStatus( const TCmmConnMethodStatus aStatus );
 
     /*
      * Called after this connection method has been updated and database
@@ -243,6 +248,9 @@
     // Connection method handle status.
     TCmmConnMethodStatus iStatus;
 
+    // Current status of the loaded commsdat records of this connection method.
+    TCmmRecordStatus iRecordStatus;
+
     // Subsession handle ID.
     TInt iHandle;
     };
--- a/cmmanager/cmmgr/cmmserver/inc/cmmconnmethodstruct.h	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmserver/inc/cmmconnmethodstruct.h	Wed Aug 18 10:10:23 2010 +0300
@@ -75,17 +75,20 @@
     TCmmConnMethodStatus GetStatus() const;
 
     /**
+     * Gets the current record status of this connection method struct.
+     */
+    TCmmRecordStatus GetRecordStatus() const;
+
+    /**
      * Sets a new status value.
      */
     void SetStatus( const TCmmConnMethodStatus& aStatus );
 
     /**
-     * Refresh the connection method data in this cache side object to be in
-     * synch with the database and copy that data back to the session side
-     * connection method instance given as parameter.
+     * Reload the connection method data in this cache side object to be in
+     * synch with the database(only if needed).
      */
-    void RefreshConnMethodInstanceL(
-            CCmmConnMethodInstance& aConnMethodInstance );
+    void ReloadPluginDataIfNeededL();
 
     /**
      * Decrease the reference counter by one. Return the remaining number of
@@ -120,6 +123,17 @@
      */
     void DeleteSuccessful( const TUint32 aNewSecondaryId );
 
+    /**
+     * Notify about a possible change in database on specified record table.
+     */
+    void NotifyRecordChange( const TUint32 aRecordType );
+
+private:
+    /**
+     * Set the record status.
+     */
+    void SetRecordStatus( const TCmmRecordStatus aStatus );
+
 private:
     // The connection method plugin.
     CCmPluginBaseEng* iConnMethodPlugin; // Owned.
@@ -139,8 +153,8 @@
     // Current status of this connection method.
     TCmmConnMethodStatus iStatus;
 
-    //TODO
-    //TCmmRecordStatus iRecordStatus;
+    // Current status of the loaded commsdat records of this connection method.
+    TCmmRecordStatus iRecordStatus;
     };
 
 #endif // CMMCONNMETHODSTRUCT_H_
--- a/cmmanager/cmmgr/cmmserver/inc/cmmdbchangelistener.h	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmserver/inc/cmmdbchangelistener.h	Wed Aug 18 10:10:23 2010 +0300
@@ -55,7 +55,13 @@
 
 private: // Methods from base class
     void DoCancel();
-    void RunL(); // Don't leave, or implement RunError() //TODO, implement RunError()
+    void RunL();
+
+    /**
+     * From CActive, handles leaves from RunL.
+     * @param aLeaveCode The leave code.
+     */
+    TInt RunError( TInt aLeaveCode );
 
 private:
     TInt RequestNotification();
--- a/cmmanager/cmmgr/cmmserver/inc/cmmdestinationstruct.h	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmserver/inc/cmmdestinationstruct.h	Wed Aug 18 10:10:23 2010 +0300
@@ -97,10 +97,14 @@
     void SetStatus( const TCmmDestinationStatus& aStatus );
 
     /**
+     * Notify about a possible change in database on specified record table.
+     */
+    void NotifyRecordChange( const TCmmDbRecords aRecordType );
+
+    /**
      * Set the record status for all records.
      */
-    void SetStatusForAllRecords( const TCmmRecordStatus& aStatus );
-
+    void SetStatusForAllRecords( const TCmmRecordStatus aStatus );
 
     /**
      * Copies the data for this destination to a session instance and
@@ -118,7 +122,7 @@
             CCmmDestinationInstance& aDestinationInstance );
 
     /**
-     * Re-loads a destination record if needed and copies the latest version to
+     * Reloads a destination record if needed and copies the latest version to
      * the session instance given as parameter.
      */
     void LoadRecordL(
--- a/cmmanager/cmmgr/cmmserver/inc/cmmlistenermanager.h	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmserver/inc/cmmlistenermanager.h	Wed Aug 18 10:10:23 2010 +0300
@@ -62,7 +62,7 @@
 public:
     void AddListenerL( TUint32 aIdentifier );
     TInt RemoveListener( TUint32 aIdentifier );
-    void DbChangeDetected( TUint32 aIdentifier );
+    void DbChangeDetectedL( TUint32 aIdentifier );
     void DbChangeError( TUint32 aIdentifier );
 
 private:
--- a/cmmanager/cmmgr/cmmserver/src/cmmanagerimpl.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmserver/src/cmmanagerimpl.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -209,6 +209,7 @@
 //
 CommsDat::TMDBElementId CCmManagerImpl::TableId( TCmmDbRecords aRecord )
     {
+    // No traces.
     CommsDat::TMDBElementId tableId( 0 );
     switch ( aRecord )
         {
@@ -260,7 +261,6 @@
 //
 CommsDat::CMDBSession& CCmManagerImpl::Session() const
     {
-    OstTraceFunctionEntry0( CCMMANAGERIMPL_SESSION_ENTRY );
     return iTrans->Session();
     }
 
--- a/cmmanager/cmmgr/cmmserver/src/cmmcache.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmserver/src/cmmcache.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -125,6 +125,9 @@
     iBearerPriorityCache = NULL;
     iCurrentTemporaryId = KTemporaryIdCounterStart;
 
+    iSnapTableId = 0;
+    iSnapMetadataTableId = 0;
+
     OstTraceFunctionExit0( DUP1_CCMMCACHE_CCMMCACHE_EXIT );
     }
 
@@ -144,6 +147,41 @@
     iListenerManager = CCmmListenerManager::NewL( this );
     iInstanceMapping = CCmmInstanceMapping::NewL( *this );
 
+    // Create CommsDat listeners to detect changes to the database from external sources.
+    RArray<TUint32> tableIdArray;
+    CleanupClosePushL( tableIdArray );
+
+    iSnapTableId = iCmManagerImpl->TableId( ECmmDbSnapRecord );
+    iSnapMetadataTableId = iCmManagerImpl->TableId( ECmmDestMetadataRecord );
+
+    // Instancemapping needs notifications on following tables.
+    tableIdArray.Append( CommsDat::KCDTIdIAPRecord );
+    tableIdArray.Append( CommsDat::KCDTIdVPNServiceRecord );
+    tableIdArray.Append( iSnapTableId );
+    tableIdArray.Append( iSnapMetadataTableId );
+
+    // Destinations need notifications on following tables.
+    tableIdArray.Append( CommsDat::KCDTIdNetworkRecord );
+    tableIdArray.Append( CommsDat::KCDTIdAccessPointRecord );
+    // Destination metadata table was already added.
+
+    // Connection methods need notifications on following tables.
+    TInt pluginCount( iPlugins->Count() );
+    if ( pluginCount )
+        {
+        ( *iPlugins )[0]->GetGenericTableIdsToBeObservedL( tableIdArray );
+        for( TInt i = 0; i < pluginCount; i++ )
+            {
+            ( *iPlugins )[i]->GetBearerTableIdsToBeObservedL( tableIdArray );
+            }
+        }
+
+    for ( TInt i = 0; i < tableIdArray.Count(); i++ )
+        {
+        iListenerManager->AddListenerL( tableIdArray[i] );
+        }
+    CleanupStack::PopAndDestroy( &tableIdArray );
+
     OstTraceFunctionExit0( CCMMCACHE_CONSTRUCTL_EXIT );
     }
 
@@ -270,14 +308,17 @@
     if ( !aDestinationInstance )
         {
         // Check connection method exists in database.
-        validAttributes = iInstanceMapping->ValidConnMethodId( aConnMethodId ); // Embedded destinations not included.
+        // Embedded destinations not included.
+        validAttributes = iInstanceMapping->ValidConnMethodId( aConnMethodId );
         }
     else
         {
         // Check connection method is inside the destination.
-        if ( aDestinationInstance->ValidConnMethodIdInDestinationIncludeEmbedded( aConnMethodId ) )
+        if ( aDestinationInstance->
+                ValidConnMethodIdInDestinationIncludeEmbedded( aConnMethodId ) )
             {
-            // Check connection method (can be embedded destination too) exists in database.
+            // Check connection method (can be embedded destination too)
+            // exists in database.
             if ( iInstanceMapping->ValidConnMethodId( aConnMethodId ) ||
                     iInstanceMapping->ValidDestinationId( aConnMethodId ) )
                 {
@@ -296,9 +337,17 @@
     TInt index = FindConnMethodFromCache( aConnMethodId );
     if ( index != KErrNotFound )
         {
+        // Update data from commsdat if necessary.
+        if ( iConnMethodArray[index]->GetRecordStatus() == ECmmRecordStatusExpired )
+            {
+            iConnMethodArray[index]->ReloadPluginDataIfNeededL();
+            // CopyDataL() will set the internal state of aConnMethodInstance.
+            }
+
         // Already open in cache. Copy the connection method data to session
         // instance.
-        aConnMethodInstance.CopyDataL( iConnMethodArray[index] ); // Will increase reference counter.
+        // Will increase reference counter.
+        aConnMethodInstance.CopyDataL( iConnMethodArray[index] );
         }
     else
         {
@@ -339,7 +388,15 @@
         return;
         }
 
-    iConnMethodArray[index]->RefreshConnMethodInstanceL( aConnMethodInstance );
+    iConnMethodArray[index]->ReloadPluginDataIfNeededL();
+    if ( iConnMethodArray[index]->GetStatus() == ECmmConnMethodStatusValid
+            || iConnMethodArray[index]->GetStatus() == ECmmConnMethodStatusToBeDeleted )
+        {
+        iConnMethodArray[index]->GetPlugin()->GetPluginDataL( 
+                aConnMethodInstance.GetPluginDataInstance() );
+        }
+    // Internal state need to be set to the same state as after a successfull update.
+    aConnMethodInstance.UpdateSuccessful();
 
     OstTraceFunctionExit0( DUP1_CCMMCACHE_REFRESHCONNMETHODL_EXIT );
     }
@@ -475,7 +532,7 @@
     }
 
 // ---------------------------------------------------------------------------
-// Re-loads a destination record if needed and copies the latest version to
+// Reloads a destination record if needed and copies the latest version to
 // the session instance given as parameter.
 // ---------------------------------------------------------------------------
 //
@@ -1618,16 +1675,120 @@
 // needed.
 // ---------------------------------------------------------------------------
 //
-void CCmmCache::DbChangeDetected( const TUint32 aTableId )
+void CCmmCache::DbChangeDetectedL( const TUint32 aTableId )
     {
     OstTraceFunctionEntry0( CCMMCACHE_DBCHANGEDETECTED_ENTRY );
 
-    (void)aTableId; //TODO
-    // Flag the table as: currently not up-to-date
+    if ( aTableId == iSnapMetadataTableId )
+        {
+        for ( TInt i = 0; i < iDestinationArray.Count(); i++ )
+            {
+            iDestinationArray[i]->NotifyRecordChange( ECmmDestMetadataRecord );
+            }
+        }
+    else if ( aTableId == CommsDat::KCDTIdNetworkRecord )
+        {
+        // Affects destinations.
+        for ( TInt i = 0; i < iDestinationArray.Count(); i++ )
+            {
+            iDestinationArray[i]->NotifyRecordChange( ECmmDestNetworkRecord );
+            }
+        }
+    else if ( aTableId == CommsDat::KCDTIdAccessPointRecord )
+        {
+        // Affects destinations.
+        for ( TInt i = 0; i < iDestinationArray.Count(); i++ )
+            {
+            iDestinationArray[i]->NotifyRecordChange( ECmmDestApRecord );
+            }
+        }
+
+    // Notify Connection Methods about the table changes in CommsDat.
+    NotifyPluginsForTableChangesL( aTableId );
+
+    // Update instancemapping.
+    iInstanceMapping->RefreshL();
+
     OstTraceFunctionExit0( CCMMCACHE_DBCHANGEDETECTED_EXIT );
     }
 
 // ---------------------------------------------------------------------------
+// Informs all the loaded iaps if something related to their tables
+// changed in commsdat.
+// ---------------------------------------------------------------------------
+//
+void CCmmCache::NotifyPluginsForTableChangesL( const TUint32 aTableId )
+    {
+    OstTraceFunctionEntry0( CCMMCACHE_NOTIFYPLUGINSFORTABLECHANGESL_ENTRY );
+
+    if ( iConnMethodArray.Count() )
+        {
+        RArray<TUint32> tableIdArray;
+        CleanupClosePushL( tableIdArray );
+
+        // Check if change concerns some table generic for all iaps
+        ( *iPlugins )[0]->GetGenericTableIdsToBeObservedL( tableIdArray );
+        TBool generic( EFalse );
+        for( TInt i = 0; i < tableIdArray.Count(); i++ )
+            {
+            if ( aTableId == tableIdArray[i] )
+                {
+                generic = ETrue;
+                break;
+                }
+            }
+
+        if ( generic )
+            {
+            // generic-->Notify all iaps
+            for( TInt i = 0; i < iConnMethodArray.Count(); i++ )
+                {
+                iConnMethodArray[i]->NotifyRecordChange( aTableId );
+                }
+            }
+        else
+            {
+            // Not generic: Check bearer specific tables
+            RArray<TUint32> affectedBearersArray;
+            CleanupClosePushL( affectedBearersArray );
+            for( TInt i = 0; i < iPlugins->Count(); i++ )
+                {
+                tableIdArray.Reset();
+                ( *iPlugins )[i]->GetBearerTableIdsToBeObservedL( tableIdArray );
+                TInt idCount = tableIdArray.Count();
+                for( TInt j = 0; j < idCount; j++ )
+                    {
+                    if ( aTableId == tableIdArray[j] )
+                        {
+                        // Save the bearer type id which is affected
+                        affectedBearersArray.AppendL(
+                                ( *iPlugins )[i]->GetBearerInfoIntL(
+                                        CMManager::ECmBearerType ) );
+                        }
+                    }
+                }
+
+            // Go through all the loaded iaps and notify all the iaps
+            // which have the same bearer type saved above
+            for( TInt i = 0; i < iConnMethodArray.Count(); i++ )
+                {
+                for( TInt j = 0; j < affectedBearersArray.Count(); j++ )
+                    {
+                    if ( iConnMethodArray[i]->GetBearerType() == affectedBearersArray[j] )
+                        {
+                        iConnMethodArray[i]->NotifyRecordChange( aTableId );
+                        break;
+                        }
+                    }
+                }
+            CleanupStack::PopAndDestroy( &affectedBearersArray );
+            }
+        CleanupStack::PopAndDestroy( &tableIdArray );
+        }
+    OstTraceFunctionExit0( CCMMCACHE_NOTIFYPLUGINSFORTABLECHANGESL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
 // Tells the cache that an error has occured with a database listener. Any
 // reads to this table need go through the database, since cache can't know if
 // it has up-to-date information.
@@ -1639,6 +1800,15 @@
 
     (void)aTableId; //TODO
     // Flag the table as: permanently not up-to-date
+
+    //TODO, How to do this?
+    // Implement some 'status locked' flags that are always checked before changing status back to 'loaded' after reading database?
+    // Or move record status info to CCmmCache-class?
+    // What about plugins?
+	// Or just ignore errors with notifiers?
+
+    // For now, just ignore errors.
+
     OstTraceFunctionExit0( CCMMCACHE_DBCHANGEERROR_EXIT );
     }
 
@@ -2128,13 +2298,15 @@
 
     // Find out the connection method bearer type.
     TUint32 bearerType( 0 );
-    User::LeaveIfError( iInstanceMapping->GetConnMethodBearerType( aConnMethodId, bearerType ) );
+    User::LeaveIfError( iInstanceMapping->
+            GetConnMethodBearerType( aConnMethodId, bearerType ) );
 
     // Check bearer type support and create plugin instance.
     CCmPluginBaseEng* plugin = NULL;
     for ( TInt i = 0; i < iPlugins->Count(); i++ )
         {
-        if ( ( *iPlugins )[i]->GetBearerInfoIntL( CMManager::ECmBearerType ) == bearerType )
+        if ( ( *iPlugins )[i]->GetBearerInfoIntL(
+                CMManager::ECmBearerType ) == bearerType )
             {
             TCmPluginInitParam pluginParams( Session() );
             plugin = ( *iPlugins )[i]->CreateInstanceL( pluginParams );
@@ -2181,7 +2353,8 @@
     if ( index != KErrNotFound )
         {
         // Already open in cache. Copy the connection method to session instance.
-        cmInstance->CopyDataL( iConnMethodArray[index] ); // Will increase reference counter.
+        // Will increase reference counter.
+        cmInstance->CopyDataL( iConnMethodArray[index] );
         }
     else
         {
@@ -2215,7 +2388,8 @@
     if ( index != KErrNotFound )
         {
         // Already open in cache. Copy the connection method to session instance.
-        cmInstance->CopyDataL( iConnMethodArray[index] ); // Will increase reference counter.
+        // Will increase reference counter.
+        cmInstance->CopyDataL( iConnMethodArray[index] );
         }
     else
         {
@@ -2249,7 +2423,8 @@
     if ( index != KErrNotFound )
         {
         // Already open in cache. Copy the connection method to session instance.
-        cmInstance->CopyDataL( iConnMethodArray[index] ); // Will increase reference counter.
+        // Will increase reference counter.
+        cmInstance->CopyDataL( iConnMethodArray[index] );
         }
     else
         {
--- a/cmmanager/cmmgr/cmmserver/src/cmmconnmethodinstance.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmserver/src/cmmconnmethodinstance.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -104,6 +104,7 @@
     iConnMethodId = 0;
     iBearerType = 0;
     iStatus = ECmmConnMethodStatusChanged;
+    iRecordStatus = ECmmRecordStatusBlank;
     iHandle = 0;
 
     OstTraceFunctionExit0( DUP1_CCMMCONNMETHODINSTANCE_CCMMCONNMETHODINSTANCE_EXIT );
@@ -256,11 +257,13 @@
         case ECmmConnMethodStatusToBeDeleted:
             {
             iStatus = ECmmConnMethodStatusChanged;
+            iRecordStatus = ECmmRecordStatusUnsaved;
             }
             break;
         case ECmmConnMethodStatusValid:
             {
             iStatus = ECmmConnMethodStatusValid;
+            iRecordStatus = ECmmRecordStatusLoaded;
             }
             break;
         case ECmmConnMethodStatusChanged:
@@ -466,6 +469,8 @@
 
     iPlugin->SetIntAttributeL( aAttribute, aValue, iPluginDataInstance );
 
+    iRecordStatus = ECmmRecordStatusModified;
+
     OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_SETINTATTRIBUTEL_EXIT );
     }
 
@@ -486,6 +491,8 @@
 
     iPlugin->SetBoolAttributeL( aAttribute, aValue, iPluginDataInstance );
 
+    iRecordStatus = ECmmRecordStatusModified;
+
     OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_SETBOOLATTRIBUTEL_EXIT );
     }
 
@@ -506,6 +513,8 @@
 
     iPlugin->SetStringAttributeL( aAttribute, aValue, iPluginDataInstance );
 
+    iRecordStatus = ECmmRecordStatusModified;
+
     OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_SETSTRINGATTRIBUTEL_EXIT );
     }
 
@@ -526,6 +535,8 @@
 
     iPlugin->SetString8AttributeL( aAttribute, aValue, iPluginDataInstance );
 
+    iRecordStatus = ECmmRecordStatusModified;
+
     OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_SETSTRING8ATTRIBUTEL_EXIT );
     }
 
@@ -533,7 +544,7 @@
 // Sets a new status value.
 // ---------------------------------------------------------------------------
 //
-void CCmmConnMethodInstance::SetStatus( const TCmmConnMethodStatus& aStatus )
+void CCmmConnMethodInstance::SetStatus( const TCmmConnMethodStatus aStatus )
     {
     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_SETSTATUS_ENTRY );
 
@@ -553,6 +564,7 @@
     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_UPDATESUCCESSFUL_ENTRY );
 
     SetStatus( ECmmConnMethodStatusValid );
+    iRecordStatus = ECmmRecordStatusLoaded;
 
     OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_UPDATESUCCESSFUL_EXIT );
     }
@@ -568,6 +580,7 @@
     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_DELETESUCCESSFUL_ENTRY );
 
     SetStatus( ECmmConnMethodStatusChanged );
+    iRecordStatus = ECmmRecordStatusModified;
     SetId( aNewSecondaryId );
 
     OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_DELETESUCCESSFUL_EXIT );
@@ -606,4 +619,13 @@
         }
     }
 
+// ---------------------------------------------------------------------------
+// Gets the current status value.
+// ---------------------------------------------------------------------------
+//
+TCmmConnMethodStatus CCmmConnMethodInstance::GetStatus() const
+    {
+    return iStatus;
+    }
+
 // End of file
--- a/cmmanager/cmmgr/cmmserver/src/cmmconnmethodstruct.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmserver/src/cmmconnmethodstruct.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -90,9 +90,10 @@
     OstTraceFunctionEntry0( DUP1_CCMMCONNMETHODSTRUCT_CCMMCONNMETHODSTRUCT_ENTRY );
 
     iConnMethodPlugin = NULL;
+    iReferenceCounter = 0;
     iBearerType = 0;
     iStatus = ECmmConnMethodStatusNotSaved;
-    iReferenceCounter = 0;
+    iRecordStatus = ECmmRecordStatusBlank;
 
     OstTraceFunctionExit0( DUP1_CCMMCONNMETHODSTRUCT_CCMMCONNMETHODSTRUCT_EXIT );
     }
@@ -172,13 +173,11 @@
     }
 
 // ---------------------------------------------------------------------------
-// Refresh the connection method data in this cache side object to be in synch
-// with the database and copy that data back to the session side connection
-// method instance given as parameter.
+// Reload the connection method data in this cache side object to be in synch
+// with the database(only if needed).
 // ---------------------------------------------------------------------------
 //
-void CCmmConnMethodStruct::RefreshConnMethodInstanceL(
-        CCmmConnMethodInstance& aConnMethodInstance )
+void CCmmConnMethodStruct::ReloadPluginDataIfNeededL()
     {
     OstTraceFunctionEntry0( CCMMCONNMETHODSTRUCT_REFRESHCONNMETHODINSTANCEL_ENTRY );
 
@@ -192,12 +191,11 @@
         case ECmmConnMethodStatusValid:
         case ECmmConnMethodStatusToBeDeleted:
             {
-            //TODO, add record status check later and only call Reload() if necessary. TCmmRecordStatus
-            //if ( !aConnMethodStruct->UpToDate() )
-            //    {
+            if ( iRecordStatus == ECmmRecordStatusExpired )
+                {
                 iConnMethodPlugin->ReLoadL();
-            //    }
-            iConnMethodPlugin->GetPluginDataL( aConnMethodInstance.GetPluginDataInstance() );
+                SetRecordStatus( ECmmRecordStatusLoaded );
+                }
             }
             break;
         case ECmmConnMethodStatusNotSaved: // This is checked before.
@@ -207,9 +205,6 @@
             break;
         }
 
-    // Internal state need to be set to the same state as after a successfull update.
-    aConnMethodInstance.UpdateSuccessful();
-
     OstTraceFunctionExit0( CCMMCONNMETHODSTRUCT_REFRESHCONNMETHODINSTANCEL_EXIT );
     }
 
@@ -256,16 +251,26 @@
 
     switch ( aStatus )
         {
-        // Fallthrough intended
         case ECmmConnMethodStatusNotSaved:
+            {
+            iStatus = aStatus;
+            iRecordStatus = ECmmRecordStatusUnsaved;
+            }
+            break;
         case ECmmConnMethodStatusValid:
+            {
             iStatus = aStatus;
+            iRecordStatus = ECmmRecordStatusLoaded;
+            }
             break;
         case ECmmConnMethodStatusChanged:
         case ECmmConnMethodStatusToBeDeleted:
+        // Fallthrough intended.
         default:
+            {
             iStatus = ECmmConnMethodStatusChanged;
             ASSERT( 0 ); // Error, invalid status as argument.
+            }
             break;
         }
 
@@ -307,7 +312,40 @@
     {
     OstTraceFunctionEntry0( CCMMCONNMETHODSTRUCT_UPDATESUCCESSFUL_ENTRY );
     iStatus = ECmmConnMethodStatusValid;
+    SetRecordStatus( ECmmRecordStatusLoaded );
+
     OstTraceFunctionExit0( CCMMCONNMETHODSTRUCT_UPDATESUCCESSFUL_EXIT );
     }
 
+// ---------------------------------------------------------------------------
+// Set the record status.
+// ---------------------------------------------------------------------------
+//
+void CCmmConnMethodStruct::SetRecordStatus( const TCmmRecordStatus aStatus )
+    {
+    iRecordStatus = aStatus;
+    }
+
+// ---------------------------------------------------------------------------
+// Notify about a possible change in database on specified record table.
+// ---------------------------------------------------------------------------
+//
+void CCmmConnMethodStruct::NotifyRecordChange( const TUint32 /*aRecordType*/ )
+    {
+    // Only change status if it is currently ECmmRecordStatusLoaded.
+    if ( iRecordStatus == ECmmRecordStatusLoaded )
+        {
+        iRecordStatus = ECmmRecordStatusExpired;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Return the status of the records.
+// ---------------------------------------------------------------------------
+//
+TCmmRecordStatus CCmmConnMethodStruct::GetRecordStatus() const
+    {
+    return iRecordStatus;
+    }
+
 // End of file
--- a/cmmanager/cmmgr/cmmserver/src/cmmdbchangelistener.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmserver/src/cmmdbchangelistener.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -122,9 +122,7 @@
 //
 TUint32 CCmmDbChangeListener::GetTableId()
     {
-    OstTraceFunctionEntry0( CCMMDBCHANGELISTENER_GETTABLEID_ENTRY );
-    OstTraceFunctionExit0( CCMMDBCHANGELISTENER_GETTABLEID_EXIT );
-
+    // No traces.
     return iTableId;
     }
 
@@ -188,7 +186,7 @@
     TInt err = RequestNotification(); // Start to listen for next change.
 
     // React to current change notification
-    iListenerManager->DbChangeDetected( iTableId );
+    iListenerManager->DbChangeDetectedL( iTableId );
 
     if ( err )
         {
@@ -217,4 +215,15 @@
     return err;
     }
 
+// -----------------------------------------------------------------------------
+// Handles the leave from the RunL()
+// -----------------------------------------------------------------------------
+//
+TInt CCmmDbChangeListener::RunError( TInt /*aLeaveCode*/ )
+    {
+    OstTrace0( TRACE_ERROR, CCMMDBCHANGELISTENER_RUNERROR, "CCmmDbChangeListener::RunError" );
+
+    return KErrNone;
+    }
+
 // End of file
--- a/cmmanager/cmmgr/cmmserver/src/cmmdestinationinstance.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmserver/src/cmmdestinationinstance.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -469,7 +469,7 @@
             break;
         }
 
-    // Not Internet, operator or intranet, or something went wrong. 
+    // Not Internet, operator or intranet, or something went wrong.
     if ( !isLocalised || ( isLocalised && !resolvedText ) )
         {
         resolvedText = TPtrC( iNetworkRecord->iRecordName ).AllocL();
@@ -710,7 +710,7 @@
     }
 
 // ---------------------------------------------------------------------------
-// Return true if protection level has been changed. 
+// Return true if protection level has been changed.
 // ---------------------------------------------------------------------------
 //
 TBool CCmmDestinationInstance::ProtectionChanged()
@@ -813,24 +813,21 @@
     // The final position will be between 0 and relevantCount.
     TInt index( relevantCount );
 
-    // If this is a virtual IAP that doesn't point to an IAP, position it at
-    // the end of the list.
+    TBool positionFound( EFalse );
     TBool connMethodIsVirtual = aConnMethodInstance.GetBoolAttributeL( CMManager::ECmVirtual );
-    TUint32 linkedIapId( 0 );
     if ( connMethodIsVirtual )
         {
         // Ask link information only if this is a virtual IAP.
-        linkedIapId = aConnMethodInstance.GetIntAttributeL( CMManager::ECmNextLayerIapId );
+        TUint32 linkedIapId = aConnMethodInstance.GetIntAttributeL( CMManager::ECmNextLayerIapId );
         if ( linkedIapId == 0 )
             {
+            // If this is a virtual IAP that doesn't point to an IAP, position it at
+            // the end of the list.
             item.iPriority = CMManager::KDataMobilitySelectionPolicyPriorityWildCard;
             index = relevantCount;
+            positionFound = ETrue;
             }
-        }
-    else
-        {
-        TBool positionFound( EFalse );
-        if ( connMethodIsVirtual )
+        else
             {
             // If this is a virtual IAP that links to another IAP, position it
             // as if it was that IAP.
@@ -849,31 +846,31 @@
             bearerType = linkedItem.iBearerType;
             bearerPriority = linkedItem.iBearerPriority;
             }
+        }
 
-        if ( !positionFound )
+    if ( !positionFound )
+        {
+        // Search for any connection methods with the same bearer type.
+        for ( TInt i = 0; i < relevantCount; i++ )
             {
-            // Search for any connection methods with the same bearer type.
-            for ( TInt i = 0; i < relevantCount; i++ )
+            if ( iConnMethodItemArray[i].iBearerType == bearerType )
                 {
-                if ( iConnMethodItemArray[i].iBearerType == bearerType )
-                    {
-                    index = i + 1;
-                    positionFound = ETrue;
-                    // Don't break, need find last item.
-                    }
+                index = i + 1;
+                positionFound = ETrue;
+                // Don't break, need find last item.
                 }
             }
-        if ( !positionFound )
+        }
+    if ( !positionFound )
+        {
+        // No connection method found with the same bearer type. Position
+        // the connection method according to bearer priority.
+        for ( TInt i = 0; i < relevantCount; i++ )
             {
-            // No connection method found with the same bearer type. Position
-            // the connection method according to bearer priority.
-            for ( TInt i = 0; i < relevantCount; i++ )
+            if ( iConnMethodItemArray[i].iBearerPriority >= bearerPriority )
                 {
-                if ( iConnMethodItemArray[i].iBearerPriority >= bearerPriority )
-                    {
-                    index = i;
-                    break;
-                    }
+                index = i;
+                break;
                 }
             }
         }
--- a/cmmanager/cmmgr/cmmserver/src/cmmdestinationstruct.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmserver/src/cmmdestinationstruct.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -406,10 +406,57 @@
     }
 
 // ---------------------------------------------------------------------------
+// Notify about a possible change in database on specified record table.
+// ---------------------------------------------------------------------------
+//
+void CCmmDestinationStruct::NotifyRecordChange( const TCmmDbRecords aRecordType )
+    {
+    OstTraceFunctionEntry0( CCMMDESTINATIONSTRUCT_NOTIFYRECORDCHANGE_ENTRY );
+
+    // Only change status if it is currently ECmmRecordStatusLoaded.
+    switch ( aRecordType )
+        {
+        case ECmmDestNetworkRecord:
+            {
+            if ( iNetworkRecordStatus == ECmmRecordStatusLoaded )
+                {
+                iNetworkRecordStatus = ECmmRecordStatusExpired;
+                }
+            }
+            break;
+        case ECmmDestApRecord:
+            {
+            if ( iDestApRecordStatus == ECmmRecordStatusLoaded )
+                {
+                iDestApRecordStatus = ECmmRecordStatusExpired;
+                }
+            }
+            break;
+        case ECmmDestMetadataRecord:
+            {
+            if ( iMetadataRecordStatus == ECmmRecordStatusLoaded )
+                {
+                iMetadataRecordStatus = ECmmRecordStatusExpired;
+                }
+            }
+            break;
+        case ECmmDbSnapRecord:
+        case ECmmDbBearerPriorityRecord:
+        case ECmmDbDefConnRecord:
+        // Fallthrough intended.
+        default:
+            // The record table doesn't affect destinations, just ignore it.
+            break;
+        }
+
+    OstTraceFunctionExit0( CCMMDESTINATIONSTRUCT_NOTIFYRECORDCHANGE_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
 // Set the record status for all records.
 // ---------------------------------------------------------------------------
 //
-void CCmmDestinationStruct::SetStatusForAllRecords( const TCmmRecordStatus& aStatus )
+void CCmmDestinationStruct::SetStatusForAllRecords( const TCmmRecordStatus aStatus )
     {
     OstTraceFunctionEntry0( CCMMDESTINATIONSTRUCT_SETSTATUSFORALLRECORDS_ENTRY );
 
@@ -527,7 +574,7 @@
     }
 
 // ---------------------------------------------------------------------------
-// Re-loads a destination record if needed and copies the latest version to
+// Reloads a destination record if needed and copies the latest version to
 // the session instance given as parameter.
 // ---------------------------------------------------------------------------
 //
@@ -551,23 +598,6 @@
     // ECmmRecordStatusModified  Error, session side only status
     // ECmmRecordStatusUnsaved   Skip load, not in database
 
-    //TODO, temporary block start
-    // Remove this codeblock after database change listeners are in place. This
-    // will force a database reload.
-    if ( iNetworkRecordStatus == ECmmRecordStatusLoaded )
-        {
-        iNetworkRecordStatus = ECmmRecordStatusExpired;
-        }
-    if ( iDestApRecordStatus == ECmmRecordStatusLoaded )
-        {
-        iDestApRecordStatus = ECmmRecordStatusExpired;
-        }
-    if ( iMetadataRecordStatus == ECmmRecordStatusLoaded )
-        {
-        iMetadataRecordStatus = ECmmRecordStatusExpired;
-        }
-    //TODO, temporary block end
-
     CommsDat::CCDRecordBase* aRecordPointer;
 
     switch ( aRecordType )
@@ -661,7 +691,7 @@
         {
         case ECmmDestinationStatusValid:
             {
-            if ( iStatus != ECmmDestinationStatusValid ) //TODO, how will external db changes affect this?
+            if ( iStatus != ECmmDestinationStatusValid )
                 {
                 // Error, a 'valid'-status on session side implies a 'valid'-status on cache side.
                 User::Leave( KErrCorrupt );
--- a/cmmanager/cmmgr/cmmserver/src/cmminstancemapping.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmserver/src/cmminstancemapping.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -87,6 +87,7 @@
     OstTraceFunctionEntry0( DUP1_CDESTINATION_CDESTINATION_ENTRY );
 
     iId = 0;
+    iMetadata = 0;
 
     OstTraceFunctionExit0( DUP1_CDESTINATION_CDESTINATION_EXIT );
     }
@@ -523,10 +524,10 @@
         RArray<TUint32>& aDestinationIds ) const
     {
     OstTraceFunctionEntry0( CCMMINSTANCEMAPPING_DESTINATIONSCONTAININGCONNMETHODL_ENTRY );
-    
+
     aDestinationIds.Reset();
     TInt count( 0 );
-    
+
     // Go through each destination.
     for ( TInt i = 0; i < iDestinations.Count(); i++ )
         {
@@ -558,7 +559,7 @@
                 }
             }
         }
-    
+
     OstTraceFunctionExit0( CCMMINSTANCEMAPPING_DESTINATIONSCONTAININGCONNMETHODL_EXIT );
     }
 
@@ -1354,7 +1355,7 @@
                 }
             }
         }
-    
+
     OstTraceFunctionExit0( DUP1_CCMMINSTANCEMAPPING_REMOVECONNMETHOD_EXIT );
     }
 
@@ -1426,11 +1427,11 @@
     }
 
 // ---------------------------------------------------------------------------
-// Iterate through destinations to find the one identified with parameter
-// and returns its metadata mask.
+// Iterate through destinations to find the one identified with provided ID
+// and return its metadata.
 // ---------------------------------------------------------------------------
 //
-TUint32 CCmmInstanceMapping::DestinationMetadata( 
+TUint32 CCmmInstanceMapping::DestinationMetadata(
         const TUint32 aDestinationId ) const
     {
     OstTraceFunctionEntry0( CCMMINSTANCEMAPPING_DESTINATIONMETADATA_ENTRY );
--- a/cmmanager/cmmgr/cmmserver/src/cmmlistenermanager.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmserver/src/cmmlistenermanager.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -88,9 +88,6 @@
 void CCmmListenerManager::ConstructL()
     {
     OstTraceFunctionEntry0( CCMMLISTENERMANAGER_CONSTRUCTL_ENTRY );
-
-    // Create the basic set of listeners, start them if necessary and store them in iListeners-array.
-
     OstTraceFunctionExit0( CCMMLISTENERMANAGER_CONSTRUCTL_EXIT );
     }
 
@@ -156,11 +153,11 @@
 // database table.
 // ---------------------------------------------------------------------------
 //
-void CCmmListenerManager::DbChangeDetected( TUint32 aIdentifier )
+void CCmmListenerManager::DbChangeDetectedL( TUint32 aIdentifier )
     {
     OstTraceFunctionEntry0( CCMMLISTENERMANAGER_DBCHANGEDETECTED_ENTRY );
 
-    iCache->DbChangeDetected( aIdentifier );
+    iCache->DbChangeDetectedL( aIdentifier );
 
     OstTraceFunctionExit0( CCMMLISTENERMANAGER_DBCHANGEDETECTED_EXIT );
     }
--- a/cmmanager/cmmgr/cmmserver/src/cmmsrvstatic.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cmmgr/cmmserver/src/cmmsrvstatic.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -41,7 +41,8 @@
     // Initialisation complete, now signal the client.
     RProcess::Rendezvous( KErrNone );
 
-    // Ready to run.
+    // Ready to run. This will return only when CCmmDelayedShutdown calls
+    // CActiveScheduler::Stop().
     CActiveScheduler::Start();
 
     // Cleanup the server and scheduler.
--- a/cmmanager/cppacketdataapplugin/src/cppacketdataapadvancedview.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cppacketdataapplugin/src/cppacketdataapadvancedview.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -165,6 +165,7 @@
             SIGNAL(currentIndexChanged(int)),
             this,
             SLOT(changeNetworkType(int)));
+        mNetworkType->setContentWidgetData("objectName", "networkTypeCB");
         mIpGroup->appendChild(mNetworkType);
         
         mCurrentNetworkType = getNetworkType();
@@ -305,6 +306,7 @@
         SIGNAL(stateChanged(int)),
         this,
         SLOT(changeIpv4AddressMode(int)));
+    mIpv4Automatic->setContentWidgetData("objectName", "ipv4AutomaticCB");
     mIpGroup->appendChild(mIpv4Automatic);
     
     // Phone IP address
@@ -316,6 +318,7 @@
         SIGNAL(editingFinished()),
         this,
         SLOT(changeIpv4Address()));
+    mIpv4Address->setContentWidgetData("objectName", "ipv4AddressEdit");
     mIpGroup->appendChild(mIpv4Address);
     
     // DNS addresses
@@ -331,6 +334,7 @@
         SIGNAL(stateChanged(int)), 
         this,
         SLOT(changeIpv4DnsMode(int)));
+    mIpv4DnsAutomatic->setContentWidgetData("objectName", "ipv4DnsAutomaticCB");
     mIpGroup->appendChild(mIpv4DnsAutomatic);
     
     // Primary DNS address
@@ -342,6 +346,7 @@
         SIGNAL(editingFinished()), 
         this,
         SLOT(changeIpv4PrimaryDnsAddress()));
+    mIpv4DnsAddress1->setContentWidgetData("objectName", "ipv4DnsAddress1Edit");
     mIpGroup->appendChild(mIpv4DnsAddress1);
     
     // Secondary DNS address
@@ -353,6 +358,7 @@
         SIGNAL(editingFinished()), 
         this,
         SLOT(changeIpv4SecondaryDnsAddress()));
+    mIpv4DnsAddress2->setContentWidgetData("objectName", "ipv4DnsAddress2Edit");
     mIpGroup->appendChild(mIpv4DnsAddress2);
     
     OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CREATEIPV4SETTINGITEMS_EXIT);
@@ -424,6 +430,7 @@
         SIGNAL(currentIndexChanged(int)),
         this,
         SLOT(changeIpv6DnsMode(int)));
+    mIpv6DnsAutomatic->setContentWidgetData("objectName", "ipv6DnsAutomaticCB");
     mIpGroup->appendChild(mIpv6DnsAutomatic);
     
     // Primary DNS address
@@ -435,6 +442,7 @@
         SIGNAL(editingFinished()),
         this,
         SLOT(changeIpv6PrimaryDnsAddress()));
+    mIpv6DnsAddress1->setContentWidgetData("objectName", "ipv6DnsAddress1Edit");
     mIpGroup->appendChild(mIpv6DnsAddress1);
     
     // Secondary DNS address
@@ -445,7 +453,8 @@
         mIpv6DnsAddress2,
         SIGNAL(editingFinished()),
         this,
-        SLOT(changeIpv6SecondaryDnsAddress()));  
+        SLOT(changeIpv6SecondaryDnsAddress()));
+    mIpv6DnsAddress2->setContentWidgetData("objectName", "ipv6DnsAddress2Edit");
     mIpGroup->appendChild(mIpv6DnsAddress2);
     
     OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CREATEIPV6SETTINGITEMS_EXIT);
@@ -502,6 +511,7 @@
         SIGNAL(editingFinished()),
         this,
         SLOT(changeProxyServer()));
+    mProxyServer->setContentWidgetData("objectName", "proxyServerEdit");
     mProxyGroup->appendChild(mProxyServer);
     
     // Proxy port number
@@ -513,6 +523,7 @@
         SIGNAL(editingFinished()),
         this,
         SLOT(changeProxyPort()));
+    mProxyPort->setContentWidgetData("objectName", "proxyPortEdit");
     mProxyGroup->appendChild(mProxyPort);
     
     OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CREATEPROXYGROUP_EXIT);
--- a/cmmanager/cppacketdataapplugin/src/cppacketdataapview.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cppacketdataapplugin/src/cppacketdataapview.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -143,6 +143,7 @@
         SIGNAL(editingFinished()),
         this,
         SLOT(connectionNameChanged()));
+    mConnectionNameItem->setContentWidgetData("objectName", "connectionNameEdit");
     mApSettingsGroupItem->appendChild(mConnectionNameItem);
     
     // Access point name
@@ -155,6 +156,7 @@
         SIGNAL(editingFinished()),
         this,
         SLOT(accessPointNameChanged()));
+    mAccessPointNameItem->setContentWidgetData("objectName", "accessPointNameEdit");
     mApSettingsGroupItem->appendChild(mAccessPointNameItem);
     
     // User name
@@ -167,19 +169,21 @@
         SIGNAL(editingFinished()),
         this,
         SLOT(userNameChanged()));
+    mUserNameItem->setContentWidgetData("objectName", "userNameEdit");
     mApSettingsGroupItem->appendChild(mUserNameItem);
     
     // Password
     mPasswordItem = new CpSettingFormItemData(
         HbDataFormModelItem::TextItem,
         hbTrId("txt_occ_setlabel_password"));
-    mPasswordItem->setContentWidgetData("echoMode", "Password");
+    mPasswordItem->setContentWidgetData("echoMode", "PasswordEchoOnEdit");
     // Connect signal and add item to group
     mForm->addConnection(
         mPasswordItem,
         SIGNAL(editingFinished()),
         this,
         SLOT(passwordChanged()));
+    mPasswordItem->setContentWidgetData("objectName", "passwordEdit");
     mApSettingsGroupItem->appendChild(mPasswordItem);
     
     // Authentication
@@ -201,6 +205,7 @@
         SIGNAL(currentIndexChanged(int)),
         this,
         SLOT(authenticationChanged(int)));
+    mAuthenticationItem->setContentWidgetData("objectName", "authenticationCB");
     mApSettingsGroupItem->appendChild(mAuthenticationItem);
     
     // Homepage
@@ -213,6 +218,7 @@
         SIGNAL(editingFinished()),
         this,
         SLOT(homepageChanged()));
+    mHomepageItem->setContentWidgetData("objectName", "homePageEdit");
     mApSettingsGroupItem->appendChild(mHomepageItem);
     
     // Read settings from CommsDat and update widgets
--- a/cmmanager/cpwlanapplugin/src/cpwlanapadvancedview.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cpwlanapplugin/src/cpwlanapadvancedview.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -168,6 +168,7 @@
         SIGNAL(stateChanged(int)),
         this,
         SLOT(changeIpv4AddressMode(int)));
+    mIpv4Automatic->setContentWidgetData("objectName", "ipv4AutomaticCB");
     mIpv4Group->appendChild(mIpv4Automatic);
     
     // Phone IP address
@@ -179,6 +180,7 @@
         SIGNAL(editingFinished()),
         this,
         SLOT(changeIpv4Address()));
+    mIpv4Address->setContentWidgetData("objectName", "ipv4AddressEdit");
     mIpv4Group->appendChild(mIpv4Address);
     
     // Subnet mask
@@ -190,6 +192,7 @@
         SIGNAL(editingFinished()),
         this,
         SLOT(changeIpv4SubnetMask()));
+    mIpv4SubnetMask->setContentWidgetData("objectName", "ipv4SubnetmaskEdit");
     mIpv4Group->appendChild(mIpv4SubnetMask);
     
     // Gateway
@@ -201,6 +204,7 @@
         SIGNAL(editingFinished()),
         this,
         SLOT(changeIpv4Gateway()));
+    mIpv4Gateway->setContentWidgetData("objectName", "ipv4GatewayEdit");
     mIpv4Group->appendChild(mIpv4Gateway);
     
     // DNS addresses
@@ -216,6 +220,7 @@
         SIGNAL(stateChanged(int)), 
         this,
         SLOT(changeIpv4DnsMode(int)));
+    mIpv4DnsAutomatic->setContentWidgetData("objectName", "ipv4DnsAutomaticCB");
     mIpv4Group->appendChild(mIpv4DnsAutomatic);
     
     // Primary DNS address
@@ -227,6 +232,7 @@
         SIGNAL(editingFinished()), 
         this,
         SLOT(changeIpv4PrimaryDnsAddress()));
+    mIpv4DnsAddress1->setContentWidgetData("objectName", "ipv4DnsAddress1Edit");
     mIpv4Group->appendChild(mIpv4DnsAddress1);
     
     // Secondary DNS address
@@ -238,6 +244,7 @@
         SIGNAL(editingFinished()), 
         this,
         SLOT(changeIpv4SecondaryDnsAddress()));
+    mIpv4DnsAddress2->setContentWidgetData("objectName", "ipv4DnsAddress2Edit");
     mIpv4Group->appendChild(mIpv4DnsAddress2);
     
     OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_CREATEIPV4GROUP_EXIT);
@@ -328,6 +335,7 @@
         SIGNAL(currentIndexChanged(int)),
         this,
         SLOT(changeIpv6DnsMode(int)));
+    mIpv6DnsAutomatic->setContentWidgetData("objectName", "ipv6DnsAutomaticCB");
     mIpv6Group->appendChild(mIpv6DnsAutomatic);
     
     // Primary DNS address
@@ -339,6 +347,7 @@
         SIGNAL(editingFinished()),
         this,
         SLOT(changeIpv6PrimaryDnsAddress()));
+    mIpv6DnsAddress1->setContentWidgetData("objectName", "ipv6DnsAddress1Edit");
     mIpv6Group->appendChild(mIpv6DnsAddress1);
     
     // Secondary DNS address
@@ -349,7 +358,8 @@
         mIpv6DnsAddress2,
         SIGNAL(editingFinished()),
         this,
-        SLOT(changeIpv6SecondaryDnsAddress()));  
+        SLOT(changeIpv6SecondaryDnsAddress()));
+    mIpv6DnsAddress2->setContentWidgetData("objectName", "ipv6DnsAddress2Edit");
     mIpv6Group->appendChild(mIpv6DnsAddress2);
     
     OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_CREATEIPV6GROUP_EXIT);
@@ -403,6 +413,7 @@
         SIGNAL(editingFinished()),
         this,
         SLOT(changeProxyServer()));
+    mProxyServer->setContentWidgetData("objectName", "proxyServerEdit");
     mProxyGroup->appendChild(mProxyServer);
     
     // Proxy port number
@@ -414,6 +425,7 @@
         SIGNAL(editingFinished()),
         this,
         SLOT(changeProxyPort()));
+    mProxyPort->setContentWidgetData("objectName", "proxyPortEdit");
     mProxyGroup->appendChild(mProxyPort);
     
     OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_CREATEPROXYGROUP_EXIT);
--- a/cmmanager/cpwlanapplugin/src/cpwlanapview.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/cmmanager/cpwlanapplugin/src/cpwlanapview.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -167,7 +167,8 @@
         SIGNAL(editingFinished()),
         this,
         SLOT(connectionNameChanged()));
-    mApSettingsGroupItem->appendChild(mConnectionNameItem);
+    mConnectionNameItem->setContentWidgetData("objectName", "connectionNameEdit");
+    mApSettingsGroupItem->appendChild(mConnectionNameItem); 
     
     // WLAN network name
     mWlanNetworkNameItem = new CpSettingFormItemData(
@@ -179,6 +180,7 @@
         SIGNAL(editingFinished()),
         this,
         SLOT(wlanNetworkNameChanged()));
+    mWlanNetworkNameItem->setContentWidgetData("objectName", "wlanNetworkNameEdit");
     mApSettingsGroupItem->appendChild(mWlanNetworkNameItem);
     
     // Network status
@@ -200,6 +202,7 @@
         SIGNAL(currentIndexChanged(int)),
         this,
         SLOT(networkStatusChanged(int)));
+    mNetworkStatusItem->setContentWidgetData("objectName", "networkStatusCB");
     mApSettingsGroupItem->appendChild(mNetworkStatusItem);
     
     // Network mode
@@ -221,6 +224,7 @@
         SIGNAL(currentIndexChanged(int)),
         this,
         SLOT(networkModeChanged(int)));
+    mNetworkModeItem->setContentWidgetData("objectName", "networkModeCB");
     mApSettingsGroupItem->appendChild(mNetworkModeItem);
     
     // Ad-hoc channel
@@ -238,6 +242,7 @@
         SIGNAL(currentIndexChanged(int)),
         this,
         SLOT(securityModeChanged(int)));
+    mSecurityModeItem->setContentWidgetData("objectName", "securityModeCB");
     mApSettingsGroupItem->appendChild(mSecurityModeItem);
     
     // Homepage
@@ -250,6 +255,7 @@
         SIGNAL(editingFinished()),
         this,
         SLOT(homepageChanged()));
+    mHomepageItem->setContentWidgetData("objectName", "homepageEdit");
     mApSettingsGroupItem->appendChild(mHomepageItem);
     
     // Read settings from CommsDat and update widgets
@@ -616,7 +622,7 @@
             CMManagerShim::CmName);
         mConnectionNameItem->setContentWidgetData("text", connectionName);
     }
-    
+
     OstTraceFunctionExit0(CPWLANAPVIEW_CONNECTIONNAMECHANGED_EXIT);
 }
 
--- a/connectionmonitoring/cellularindicatorplugin/inc/cellularindicatorplugin.h	Tue Jul 06 14:42:41 2010 +0300
+++ b/connectionmonitoring/cellularindicatorplugin/inc/cellularindicatorplugin.h	Wed Aug 18 10:10:23 2010 +0300
@@ -22,7 +22,10 @@
 #include <hbindicatorinterface.h>
 #include <QtCore/QProcess>
 #include <QtCore/QVariant>
+#include <QSharedPointer>
 
+// Forward declarations
+class HbTranslator;
 
 /**
  * This class describes cellular indicator plug-in
@@ -81,6 +84,10 @@
     QVariant mParameter;
     // Process to start external programs
     QProcess process;
+    
+    // Translator for the localisation Text Id's
+    QSharedPointer<HbTranslator> mTranslator;
+
 };
 
 
--- a/connectionmonitoring/cellularindicatorplugin/src/cellularindicatorplugin.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/connectionmonitoring/cellularindicatorplugin/src/cellularindicatorplugin.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -94,8 +94,8 @@
     Q_UNUSED(indicatorType)
     
     // Install localization
-    HbTranslator *translator(new HbTranslator("cellularindicatorplugin"));
-    
+    mTranslator = QSharedPointer<HbTranslator>(new HbTranslator("cellularindicatorplugin"));
+        
     OstTraceFunctionExit0( CELLULARINDICATORPLUGIN_CREATEINDICATOR_EXIT );
     return this;
 }
--- a/connectionmonitoring/connectionview/inc/connectionview.h	Tue Jul 06 14:42:41 2010 +0300
+++ b/connectionmonitoring/connectionview/inc/connectionview.h	Wed Aug 18 10:10:23 2010 +0300
@@ -19,6 +19,7 @@
 #define __CONNECTIONVIEW_H__
 
 #include <QObject>
+#include <QSharedPointer>
 #include <HbMainWindow>
 #include <HbDialog>
 #include <QStringList>
@@ -32,6 +33,10 @@
 #include <qnetworksession.h>
 #include <qnetworkconfigmanager.h>
 
+// Forward declarations
+class HbTranslator;
+
+
 QTM_USE_NAMESPACE
 
 class QSignalMapper;
@@ -138,6 +143,9 @@
         /* The id of the timer used to close the application */
         int mClosingTimer;
         
+        /* Translator for the localisation Text Id's */
+        QSharedPointer<HbTranslator> mTranslator;
+        
         /* definition for unit test purposes */
         friend class TestConnectionView;
     
--- a/connectionmonitoring/connectionview/src/connectionview.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/connectionmonitoring/connectionview/src/connectionview.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -41,11 +41,10 @@
 #endif
 
 
-
 QTM_USE_NAMESPACE
 
-
 const qreal typeLabelWidth = 18.0;
+const QString iapIdentifierPrefix = "I_";
 
 ConnectionView::ConnectionView():
     mNetConfigurationManager(new QNetworkConfigurationManager(this)),
@@ -55,8 +54,8 @@
 {
     OstTraceFunctionEntry0( CONNECTIONVIEW_CONNECTIONVIEW_ENTRY );
     // Install localization
-    HbTranslator *translator(new HbTranslator("connectionview"));
-    
+    mTranslator = QSharedPointer<HbTranslator>(new HbTranslator("connectionview"));
+   
     // Register custom layout location
     bool registerStatus = HbStyleLoader::registerFilePath(":/layout/");
     Q_ASSERT(registerStatus);
@@ -190,7 +189,7 @@
         for (int i=0; i<mConnectionCount; i++) {
             // Get the iap id and the iap name for the UI construction
             bool ok = true;
-            int iapId = activeConfigurations[i].identifier().toInt(&ok);
+            int iapId = activeConfigurations[i].identifier().remove(iapIdentifierPrefix).toInt(&ok);
             QString iapName = activeConfigurations[i].name();
 
             if (ok) {
@@ -379,7 +378,7 @@
             
     for (int i=0; i < count; i++) {
         bool ok = true;
-        int loopedIapId = activeConfigurations[i].identifier().toInt(&ok);
+        int loopedIapId = activeConfigurations[i].identifier().remove(iapIdentifierPrefix).toInt(&ok);
         
         // if the looped iap matches the iap, stop the connection
         if (loopedIapId == iapId) {
--- a/connectionmonitoring/connmon/connectionmonitor/group/ConnMon.mmp	Tue Jul 06 14:42:41 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/group/ConnMon.mmp	Wed Aug 18 10:10:23 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 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"
@@ -57,6 +57,7 @@
 
 SOURCE          ConnMonBearerNotifier.cpp ConnMonEGprsNotifier.cpp ConnMonHsdpaNotifier.cpp
 SOURCE          cellulardatausagekeyupdater.cpp
+SOURCE          connmondialupoverridenotifier.cpp
 
 
 USERINCLUDE     ../inc
--- a/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonDef.h	Tue Jul 06 14:42:41 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonDef.h	Wed Aug 18 10:10:23 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 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"
@@ -108,6 +108,16 @@
     };
 
 /**
+ * Status values for dial-up PDP context override functionality.
+ */
+enum TConnMonDialUpOverrideStatus
+    {
+    EConnMonDialUpOverrideDisabled = 0,
+    EConnMonDialUpOverrideInactive,
+    EConnMonDialUpOverrideActive
+    };
+
+/**
  * TEventInfo
  */
 class TEventInfo
--- a/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonIAP.h	Tue Jul 06 14:42:41 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonIAP.h	Wed Aug 18 10:10:23 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 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"
@@ -401,10 +401,9 @@
          * closed event.
          * @since
          * @param aConnection The connection info. On return, will contain connection id.
-         * @param aSent On return, value is ETrue if event has been sent, EFalse otherwise.
          * @return KErrNone if successfull, otherwise a system wide error code.
          */
-        TBool GetDeleteNotifyStatus( TConnInfo& aConnection, TBool& aSent );
+        TBool GetDeleteNotifyStatus( TConnInfo& aConnection );
 
         /**
          * Gets a pointer to the activity notifier object for the given connection id.
@@ -492,6 +491,12 @@
         void GetActiveConnectionsIds( const TUint& aBearerId, RArray<TUint>& aIdArray );
 
         /**
+         * Return ETrue if one or more active packetdata connections are found,
+         * EFalse otherwise.
+         */
+        TBool ActivePacketdataConnectionsFound();
+
+        /**
          * Tells whether bearer is supported or not.
          * @since
          * @param aConnectionId Generic bearer id (EBearerIdGPRS, EBEarerIdCSD).
--- a/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonNoti.h	Tue Jul 06 14:42:41 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonNoti.h	Wed Aug 18 10:10:23 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 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"
@@ -674,6 +674,35 @@
         */
         void SetInterfaceClosed();
 
+        /**
+        * Tells whether interface has been closed or not.
+        * @since
+        * @return ETrue if interface has been closed, otherwise EFalse.
+        */
+        TBool InterfaceClosed();
+
+        /**
+        * Sets link layer status to closed.
+        * @since
+        * @return void.
+        */
+        void SetLinkLayerClosed();
+
+        /**
+        * Sets link layer status to NOT closed.
+        * @since
+        * @return void.
+        */
+        void SetLinkLayerOpen();
+
+        /**
+        * Return ETrue if KLinkLayerClosed has been received.
+        * @since
+        * @return ETrue if KLinkLayerClosed has been received, otherwise returns EFalse.
+        */
+        TBool LinkLayerClosed();
+
+
     private: // Methods from base classes
          /**
         * From CActive Cancels the asyncronous request
@@ -700,6 +729,7 @@
         TUint                         iTotalUplinkDataVolume;
         TBool                         iDeleteSent;
         TBool                         iInterfaceClosed;
+        TBool                         iLinkLayerClosed;
     };
 
 /**
--- a/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonServ.h	Tue Jul 06 14:42:41 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonServ.h	Wed Aug 18 10:10:23 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 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"
@@ -134,6 +134,8 @@
 class TConnMonSNAPInfo;
 class TConnMonId;
 class CCellularDataUsageKeyUpdater;
+class CConnMonDialUpOverrideNotifier;
+class CConnMonDialUpOverrideTimer;
 
 /**
 * CConnMonServer
@@ -335,6 +337,23 @@
     inline CCellularDataUsageKeyUpdater* CellularDataUsageKeyUpdater() 
                      { return iCellularDataUsageKeyUpdater; }
 
+    /**
+     * Return the current dial-up PDP context override status.
+     */
+    inline TInt GetDialUpOverrideStatus() { return iDialUpOverrideStatus; }
+
+    /**
+     * Set the dial-up PDP context override feature status. Either activates or
+     * deactivates it. Does nothing if the feature itself has not been enabled.
+     */
+    void SetDialUpOverrideStatus( TInt aStatus );
+
+    /**
+     * Signals that all internal PDP connections have closed through the
+     * KDialUpConnection P&S-property.
+     */
+    void ConnectionsClosedForDialUpOverride();
+
 public:
     /**
      * From CServer Creates a new session for a client.
@@ -377,6 +396,15 @@
 
     CConnMonBearerGroupManager*   iBearerGroupManager;
     CCellularDataUsageKeyUpdater* iCellularDataUsageKeyUpdater;
+
+    // Notifier to listen for changes in the the KDialUpConnection P&S-property.
+    CConnMonDialUpOverrideNotifier* iDialUpOverrideNotifier;
+
+    // Timeout timer for the dial-up PDP context override feature.
+    CConnMonDialUpOverrideTimer* iDialUpOverrideTimer;
+
+    // Current status of the dial-up PDP context override feature.
+    TInt iDialUpOverrideStatus;
     };
 
 /**
@@ -462,6 +490,34 @@
     CConnMonServer* iServer;
     };
 
+/**
+* CConnMonDialUpOverrideTimer
+* A simple timer to ensure dial-up PDP context override feature can not stay
+* active longer than the specied timeout value.
+*/
+NONSHARABLE_CLASS( CConnMonDialUpOverrideTimer ) : public CActive
+    {
+public:
+    static CConnMonDialUpOverrideTimer* NewL( CConnMonServer* aServer );
+    static CConnMonDialUpOverrideTimer* NewLC( CConnMonServer* aServer );
+    virtual ~CConnMonDialUpOverrideTimer();
+
+private:
+    CConnMonDialUpOverrideTimer( CConnMonServer* aServer );
+    void ConstructL();
+
+public:
+    void Start();
+
+private:
+    void DoCancel();
+    void RunL();
+
+private: // Data
+    RTimer iTimer;
+    CConnMonServer* iServer;
+    };
+
 // INLINES
 inline CConnMonScheduler::TSignal::TSignal()
         :
--- a/connectionmonitoring/connmon/connectionmonitor/inc/cellulardatausagekeyupdater.h	Tue Jul 06 14:42:41 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/cellulardatausagekeyupdater.h	Wed Aug 18 10:10:23 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 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"
@@ -38,6 +38,11 @@
     
     void UpdateKeyL( const TInt aRegistration ) const;
 
+    /**
+     * Return ETrue if dial-up PDP context override feature is enabled.
+     */
+    TBool DialUpOverrideEnabled() const;
+
 private:
     CCellularDataUsageKeyUpdater(
             CConnMonServer* aServer );
@@ -56,7 +61,13 @@
 private:
     CConnMonServer* iServer;
     TUint32         iTableId;
-    CRepository*    iRepository;
+
+    // CommsDat central repository.
+    CRepository*    iCommsRepository;
+
+    // CmManager central repository.
+    CRepository*    iCmmRepository;
+
     TInt            iErrorCounter;
     // used for complete runl. Not owned.
     TRequestStatus* iInitStatus;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/connmondialupoverridenotifier.h	Wed Aug 18 10:10:23 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2010 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 dial-up PDP context override P&S-key.
+*
+*/
+
+#ifndef CONNMONDIALUPOVERRIDENOTIFIER_H
+#define CONNMONDIALUPOVERRIDENOTIFIER_H
+
+class CConnMonServer;
+
+/**
+ * Stop requesting new notifications after this many consecutive errors.
+ */
+const TInt KConnMonPsEventErrorThreshold = 80;
+
+/**
+ * Maximum time that dial-up PDP context override is allowed to stay on.
+ */
+const TUint KConnMonDialUpOverrideInterval = 45000000; // 45sec
+
+/**
+ * Read policy for dial-up PDP context override key.
+ */
+_LIT_SECURITY_POLICY_PASS( KDialUpOverrideReadC0 );
+
+/**
+ * Write policy for dial-up PDP context override key.
+ */
+_LIT_SECURITY_POLICY_C2( KDialUpOverrideWriteC2, ECapabilityNetworkControl, ECapabilityNetworkServices );
+
+/**
+ * An active object to listen for changes in the dial-up PDP context override
+ * P&S-key. Only used if the feature is enabled by the CenRep key
+ * KDialUpOverride in CmManager repository (KCRUidCmManager).
+ */
+NONSHARABLE_CLASS( CConnMonDialUpOverrideNotifier ) : public CActive
+    {
+public:
+    static CConnMonDialUpOverrideNotifier* NewL( CConnMonServer* aServer );
+    static CConnMonDialUpOverrideNotifier* NewLC( CConnMonServer* aServer );
+    virtual ~CConnMonDialUpOverrideNotifier();
+
+    /**
+     * Set the KDialUpConnection-property in Connection Monitor RProperty
+     * category to the initial state of EConnMonReady.
+     */
+    TInt ResetStatus();
+
+private:
+    CConnMonDialUpOverrideNotifier( CConnMonServer* aServer );
+    void ConstructL();
+    void RequestNotifications();
+
+private: // Methods from base class
+    void DoCancel();
+    void RunL();
+
+private:
+    // Pointer back to ConnMon server class.
+    CConnMonServer* iServer;
+
+    // Counter for notification errors.
+    TInt iErrorCounter;
+
+    // Dial-up PDP context override property.
+    // Used to signal an incoming dial-up connection and the completion of
+    // preparatory actions by ConnMon (Closing down internal PDP contexts).
+    RProperty iDialUpProperty;
+    };
+
+#endif // CONNMONDIALUPOVERRIDENOTIFIER_H
+
+// End of file
--- a/connectionmonitoring/connmon/connectionmonitor/src/CPsdFax.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/src/CPsdFax.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 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"
@@ -737,7 +737,7 @@
         iOpen = ETrue;
 
         // Start status notifier
-        if ( !iStatusNotifier->IsActive() )
+        if ( iStatusNotifier && !iStatusNotifier->IsActive() )
             {
             LOGIT("OpenContext: start status notifier")
             iStatusNotifier->Start( iContext );
@@ -850,7 +850,7 @@
     err = status.Int();
 
     // Remove from server tables if status notifier is not active.
-    if ( !iStatusNotifier->IsActive() )
+    if ( !iStatusNotifier || !iStatusNotifier->IsActive() )
         {
         // Remove from server tables
         RemoveFromServer();
@@ -1284,6 +1284,11 @@
             // Close the context
             iConnDataModule->CloseContext();
 
+            // Dial-up connection has gone down. Make sure the dial-up PDP
+            // context override is disabled.
+            LOGIT("External PSD connection status EStatusDeleted, disabling dial-up override")
+            iServer->SetDialUpOverrideStatus( EConnMonDialUpOverrideInactive );
+
             // Delete all old connection objects. This method should be used
             // carefully because it will delete ConnectionData and
             // statusnotifier objects. Get out fast from RunL().
@@ -1292,6 +1297,13 @@
             // Stop listening
             return;
             }
+        else if ( iContextStatus == RPacketContext::EStatusActive )
+            {
+            // Dial-up connection has been established. Make sure the dial-up
+            // PDP context override is disabled.
+            LOGIT("External PSD connection status EStatusActive, disabling dial-up override")
+            iServer->SetDialUpOverrideStatus( EConnMonDialUpOverrideInactive );
+            }
 
         // New request
         Receive();
--- a/connectionmonitoring/connmon/connectionmonitor/src/ConnMonIAP.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonIAP.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 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"
@@ -421,7 +421,6 @@
 TInt CConnMonIAP::EnumerateConnections( TUint& aCount )
     {
     // Server must be 'blocked' while updating the connection table.
-    TConnectionInfoBuf connInfoBuf;
     TBearerInfo bearerInfo;
     TConnInfo connInfo( 0, 0, 0, 0, bearerInfo );
     TInt err( KErrNone );
@@ -2312,6 +2311,18 @@
             }
 
         iConnInfos.Remove( index );
+
+        // If dial-up PDP context override feature is enabled and active (a dial-up
+        // connection is about to start), connection closures need to be reported
+        // in case dial-up connection is waiting for a free PDP context.
+        if ( iServer->GetDialUpOverrideStatus() == EConnMonDialUpOverrideActive )
+            {
+            if ( !ActivePacketdataConnectionsFound() )
+                {
+                iServer->ConnectionsClosedForDialUpOverride();
+                }
+            }
+
         err = KErrNone;
         }
 
@@ -2979,7 +2990,7 @@
 // CConnMonIAP::GetDeleteNotifyStatus
 // -----------------------------------------------------------------------------------
 //
-TInt CConnMonIAP::GetDeleteNotifyStatus( TConnInfo& aConnection, TBool& aSent )
+TInt CConnMonIAP::GetDeleteNotifyStatus( TConnInfo& aConnection )
     {
     TInt index( KErrNotFound );
 
@@ -2998,29 +3009,6 @@
     aConnection.iConnectionId = iConnInfos[index].iConnectionId;
     aConnection.iBearer = iConnInfos[index].iBearer;
 
-    TInt connectionStatus( 0 );
-    GetConnectionStatus( index, connectionStatus );
-
-    if ( ( iConnInfos[index].iConnDownNotifier != 0 ) &&
-         ( iConnInfos[index].iProgressNotifier != 0 ) )
-        {
-        if ( !iConnInfos[index].iConnDownNotifier->DeleteSent() &&
-             !iConnInfos[index].iConnDownNotifier->IsActive() &&
-             ( !iConnInfos[index].iProgressNotifier->IsActive() ||
-               ( connectionStatus != KLinkLayerOpen ) ) )
-            {
-            aSent = EFalse;
-            }
-        else
-            {
-            aSent = ETrue;
-            }
-        }
-    else
-        {
-        aSent = EFalse;
-        }
-
     return KErrNone;
     }
 
@@ -3353,6 +3341,64 @@
     //LOGEXITFN("CConnMonIAP::GetActiveConnectionsIds()")
     }
 
+// -----------------------------------------------------------------------------
+// CConnMonIAP::ActivePacketdataConnectionsFound
+// Return ETrue if one or more active packetdata connections are found,
+// EFalse otherwise.
+// -----------------------------------------------------------------------------
+//
+TBool CConnMonIAP::ActivePacketdataConnectionsFound()
+    {
+    LOGENTRFN("CConnMonIAP::ActivePacketdataConnectionsFound()")
+    TBool result( EFalse );
+    TInt unknownBearers( 0 );
+
+    const TInt count = iConnInfos.Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        // Bearer might still be uninitialized
+        if ( iConnInfos[i].iBearer == EBearerUnknown )
+            {
+            unknownBearers++;
+            }
+        else if ( iConnInfos[i].iBearer == EBearerGPRS ||
+                iConnInfos[i].iBearer == EBearerEdgeGPRS ||
+                iConnInfos[i].iBearer == EBearerWCDMA )
+            {
+            result = ETrue;
+            break;
+            }
+        }
+    if ( !result && unknownBearers )
+        {
+        for ( TInt i = 0; i < count; i++ )
+            {
+            if ( iConnInfos[i].iBearer == EBearerUnknown )
+                {
+                LOGIT1("ActivePacketdataConnectionsFound: bearer unknown for conn.id %d",
+                        iConnInfos[i].iConnectionId)
+                TInt err = GetBearer(
+                        iConnInfos[i].iConnectionId,
+                        iConnInfos[i].iBearer,
+                        iConnInfos[i].iBearerInfo );
+
+                if ( err == KErrNone )
+                    {
+                    if ( iConnInfos[i].iBearer == EBearerGPRS ||
+                            iConnInfos[i].iBearer == EBearerEdgeGPRS ||
+                            iConnInfos[i].iBearer == EBearerWCDMA )
+                        {
+                        result = ETrue;
+                        break;
+                        }
+                    }
+                }
+            }
+        }
+
+    LOGEXITFN1("CConnMonIAP::ActivePacketdataConnectionsFound()", result)
+    return result;
+    }
 
 // -----------------------------------------------------------------------------
 // CConnMonIAP::GetBearerSupportInfo
--- a/connectionmonitoring/connmon/connectionmonitor/src/ConnMonNoti.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonNoti.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 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"
@@ -170,10 +170,8 @@
                 }
             else
                 {
-                TBool alreadyNotified( EFalse );
-
                 // This updates the correct 'iConnectionId' and 'iBearer' to connInfo
-                TInt ret = iServer->Iap()->GetDeleteNotifyStatus( connInfo, alreadyNotified );
+                TInt ret = iServer->Iap()->GetDeleteNotifyStatus( connInfo );
 
                 if ( ret == KErrNone )
                     {
@@ -202,8 +200,11 @@
                                 iServer->Iap()->EnableWlanScan();
                                 }
 
-                            // Progress and subconn notifiers have died and no delete has been sent
-                            subConnUpDownNotifier->SendDeletedEvent();
+                            if ( subConnUpDownNotifier->LinkLayerClosed() )
+                                {
+                                // KLinkLayerClosed already received, finish with this connection
+                                subConnUpDownNotifier->SendDeletedEvent();
+                                }
                             }
                         else
                             {
@@ -598,6 +599,7 @@
                         if ( !subConnUpDownNotifier->IsActive() )
                             {
                             subConnUpDownNotifier->Receive();
+                            subConnUpDownNotifier->SetLinkLayerOpen();
                             }
                         }
 
@@ -631,7 +633,29 @@
                         {
                         LOGIT("CProgressNotifier::RunL triggered HandleAvailabilityChange()")
                         iServer->AvailabilityManager()->HandleAvailabilityChange();	
-                        }	    
+                        }
+
+                    }
+                else if ( iInfoBuf().iStage == KLinkLayerClosed )
+                    {
+                    CSubConnUpDownNotifier* subConnUpDownNotifier = 0;
+
+                    TInt err = iServer->Iap()->GetSubConnUpDownNotifier(
+                               iConnectionId,
+                               &subConnUpDownNotifier );
+
+                    if ( KErrNone == err )
+                        {
+                        subConnUpDownNotifier->SetLinkLayerClosed();
+
+                        if ( subConnUpDownNotifier->InterfaceClosed() )
+                            {
+                            // EInterfaceDown has arrived before KLinkLayerClosed
+                            // Let's finish with this connection.
+                            subConnUpDownNotifier->SendDeletedEvent();
+                            return;
+                            }
+                        }
                     }
 
                 iFilter = KNoFiltering;
@@ -2116,6 +2140,8 @@
     {
     if ( !iDeleteSent )
         {
+        LOGIT("CSubConnUpDownNotifier::SendDeletedEvent")
+
         iEventInfo.Reset();
 
         iEventInfo.iEventType       = EConnMonDeleteConnection;
@@ -2176,6 +2202,41 @@
     iInterfaceClosed = ETrue;
     }
 
+// -----------------------------------------------------------------------------
+// CSubConnUpDownNotifier::InterfaceClosed
+// -----------------------------------------------------------------------------
+//
+TBool CSubConnUpDownNotifier::InterfaceClosed()
+    {
+    return iInterfaceClosed;
+    }
+
+// -----------------------------------------------------------------------------
+// CSubConnUpDownNotifier::SetLinkLayerClosed
+// -----------------------------------------------------------------------------
+//
+void CSubConnUpDownNotifier::SetLinkLayerClosed()
+    {
+    iLinkLayerClosed = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CSubConnUpDownNotifier::SetLinkLayerOpen
+// -----------------------------------------------------------------------------
+//
+void CSubConnUpDownNotifier::SetLinkLayerOpen()
+    {
+    iLinkLayerClosed = EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CSubConnUpDownNotifier::LinkLayerClosed
+// -----------------------------------------------------------------------------
+//
+TBool CSubConnUpDownNotifier::LinkLayerClosed()
+    {
+    return iLinkLayerClosed;
+    }
 
 // -----------------------------------------------------------------------------
 // CSubConnUpDownNotifier::DoCancel
@@ -2219,7 +2280,10 @@
                 // Is progress notifier still alive
                 if ( !progressNotifier->IsActive() )
                     {
+                    iStatus = KErrDied;
+                    // might delete this object
                     SendDeletedEvent();
+                    return;
                     }
                 }
             }
@@ -2240,6 +2304,8 @@
             LOGIT3("SERVER: EVENT -> Connection %d closed, u: %d, d: %d",
                     iConnectionId, iTotalUplinkDataVolume, iTotalDownlinkDataVolume)
 
+            iStatus = KErrDisconnected;
+
             CProgressNotifier* progressNotifier = 0;
             TInt err = iServer->Iap()->GetProgressNotifier( iConnectionId, &progressNotifier );
             if ( err == KErrNone )
@@ -2247,15 +2313,17 @@
                 // Progess notifier has stopped and allinterface closed event has arrived
                 if ( !progressNotifier->IsActive() )
                     {
+                    // might delete this object
                     SendDeletedEvent();
+                    return;
                     }
                 }
             else
                 {
+                // might delete this object
                 SendDeletedEvent();
+                return;
                 }
-
-            iStatus = KErrDisconnected;
             }
         else if ( ( event.iSubConnectionUniqueId == 0 ) &&
                   ( event.iEventType == ESubConnectionOpened ) )
--- a/connectionmonitoring/connmon/connectionmonitor/src/ConnMonServ.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonServ.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 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"
@@ -34,6 +34,7 @@
 #include "ConnMonBearerGroupManager.h"
 #include "connmoncommsdatnotifier.h"
 #include "cellulardatausagekeyupdater.h"
+#include "connmondialupoverridenotifier.h"
 
 // ============================ LOCAL FUNCTIONS ===============================
 
@@ -236,7 +237,21 @@
 CConnMonServer::CConnMonServer()
         :
         CPolicyServer( CActive::EPriorityStandard, KConnMonPolicy ),
-        iAvailabilityManager( NULL )
+        iIap( NULL ),
+        iEventQueue( NULL ),
+        iSessionCount( 0 ),
+        iShutdown( NULL ),
+        iContainerIndex( NULL ),
+        iCommsDatCache( NULL ),
+        iAvailabilityManager( NULL ),
+        iIapTableNotifier( NULL ),
+        iSnapTableNotifier( NULL ),
+        iVirtualTableNotifier( NULL ),
+        iBearerGroupManager( NULL ),
+        iCellularDataUsageKeyUpdater( NULL ),
+        iDialUpOverrideNotifier( NULL ),
+        iDialUpOverrideTimer( NULL ),
+        iDialUpOverrideStatus( EConnMonDialUpOverrideDisabled )
     {
     }
 
@@ -322,7 +337,18 @@
     
     iCellularDataUsageKeyUpdater = CCellularDataUsageKeyUpdater::NewL( this );
     LOGIT("ConstructL: CCellularDataUsageKeyUpdater constructed")
-    
+
+    // Add P&S listener for dial-up PDP context override, if feature enabled.
+    if ( iCellularDataUsageKeyUpdater->DialUpOverrideEnabled() )
+        {
+        iDialUpOverrideNotifier = CConnMonDialUpOverrideNotifier::NewL( this );
+        iDialUpOverrideStatus = EConnMonDialUpOverrideInactive;
+        LOGIT("ConstructL: Dial-up override notifier constructed")
+
+        // Construct dial-up PDP context override timer.
+        iDialUpOverrideTimer = CConnMonDialUpOverrideTimer::NewL( this );
+        }
+
     // Identify ourselves and open for service
     StartL( KConnectionMonitorServerName );
 
@@ -380,9 +406,15 @@
 
     // Bearer Group Manager
     delete iBearerGroupManager;
-    
+
     delete iCellularDataUsageKeyUpdater;
 
+    // Dial-up PDP context override timer.
+    delete iDialUpOverrideTimer;
+
+    // P&S listener for dial-up PDP context override.
+    delete iDialUpOverrideNotifier;
+
     FeatureManager::UnInitializeLib();
     }
 
@@ -792,6 +824,78 @@
     }
 
 // -----------------------------------------------------------------------------
+// Set the dial-up PDP context override feature status. Either activates or
+// deactivates it. Does nothing if the feature itself has not been enabled.
+// -----------------------------------------------------------------------------
+//
+void CConnMonServer::SetDialUpOverrideStatus( TInt aStatus )
+    {
+    LOGENTRFN("CConnMonServer::SetDialUpOverrideStatus()")
+
+    // Do nothing if whole feature is disabled.
+    LOGIT2("iDialUpOverrideStatus = %d, aStatus = %d", iDialUpOverrideStatus, aStatus)
+    if ( iDialUpOverrideStatus == EConnMonDialUpOverrideInactive &&
+            aStatus == EConnMonDialUpOverrideActive )
+        {
+        LOGIT("Setting dial-up override status from inactive to active")
+        // Start the dial-up override timer to ensure packetdata connectivity
+        // is restored to original state eventually. Normally it is restored
+        // after the dial-up connection has been successfully established.
+        iDialUpOverrideTimer->Start();
+        // Status must be set before updating cellular data usage key.
+        iDialUpOverrideStatus = aStatus;
+
+        // Disable cellular data usage until the expected dial-up
+        // connection has been established (or timeout).
+        TRAP_IGNORE( iCellularDataUsageKeyUpdater->UpdateKeyL( 0 ) );
+
+        LOGIT("SetDialUpOverrideStatus() triggered HandleAvailabilityChange()")
+        AvailabilityManager()->HandleAvailabilityChange();
+        }
+    else if ( iDialUpOverrideStatus == EConnMonDialUpOverrideActive &&
+            aStatus == EConnMonDialUpOverrideInactive )
+        {
+        LOGIT("Setting dial-up override status from active to inactive")
+        // Stop the dial-up override timer.
+        iDialUpOverrideTimer->Cancel();
+        // Status must be set before updating cellular data usage key.
+        iDialUpOverrideStatus = aStatus;
+
+        TInt registration( ENetworkRegistrationExtUnknown );
+        TInt err = iIap->GetNetworkRegistration_v2( registration );
+        if ( err == KErrNone )
+            {
+            TRAP_IGNORE( iCellularDataUsageKeyUpdater->UpdateKeyL( registration ) );
+            }
+        else
+            {
+            LOGIT1("GetNetworkRegistration_v2 failed <%d>", err)
+            }
+        iDialUpOverrideNotifier->ResetStatus();
+
+        LOGIT("SetDialUpOverrideStatus() triggered HandleAvailabilityChange()")
+        AvailabilityManager()->HandleAvailabilityChange();
+        }
+
+    LOGEXITFN("CConnMonServer::SetDialUpOverrideStatus()")
+    }
+
+// -----------------------------------------------------------------------------
+// Signals that all internal PDP connections have closed through the
+// KDialUpConnection P&S-property.
+// -----------------------------------------------------------------------------
+//
+void CConnMonServer::ConnectionsClosedForDialUpOverride()
+    {
+    LOGENTRFN("CConnMonServer::ConnectionsClosedForDialUpOverride()")
+    if ( iDialUpOverrideStatus == EConnMonDialUpOverrideActive )
+        {
+        iDialUpOverrideNotifier->ResetStatus();
+        }
+    LOGEXITFN("CConnMonServer::ConnectionsClosedForDialUpOverride()")
+    }
+
+// -----------------------------------------------------------------------------
 // CConnMonServer::CustomSecurityCheckL
 // Implements custom security checking for IPCs marked with
 // TSpecialCase::ECustomCheck.
@@ -889,4 +993,95 @@
     CActiveScheduler::Stop();
     }
 
-// End-of-file
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideTimer::NewL
+// -----------------------------------------------------------------------------
+//
+CConnMonDialUpOverrideTimer* CConnMonDialUpOverrideTimer::NewL(
+        CConnMonServer* aServer )
+    {
+    CConnMonDialUpOverrideTimer* self = CConnMonDialUpOverrideTimer::NewLC( aServer );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideTimer::NewLC
+// -----------------------------------------------------------------------------
+//
+CConnMonDialUpOverrideTimer* CConnMonDialUpOverrideTimer::NewLC(
+        CConnMonServer* aServer )
+    {
+    CConnMonDialUpOverrideTimer* self = new( ELeave ) CConnMonDialUpOverrideTimer( aServer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideTimer::~CConnMonDialUpOverrideTimer
+// -----------------------------------------------------------------------------
+//
+CConnMonDialUpOverrideTimer::~CConnMonDialUpOverrideTimer()
+    {
+    Cancel();
+    iTimer.Close();
+    iServer = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideTimer::CConnMonDialUpOverrideTimer
+// -----------------------------------------------------------------------------
+//
+CConnMonDialUpOverrideTimer::CConnMonDialUpOverrideTimer(
+        CConnMonServer* aServer )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iServer( aServer )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideTimer::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CConnMonDialUpOverrideTimer::ConstructL()
+    {
+    CActiveScheduler::Add( this );
+    User::LeaveIfError( iTimer.CreateLocal() );
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideTimer::Start
+// -----------------------------------------------------------------------------
+//
+void CConnMonDialUpOverrideTimer::Start()
+    {
+    if ( !IsActive() )
+        {
+        iTimer.After( iStatus, KConnMonDialUpOverrideInterval );
+        SetActive();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideTimer::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CConnMonDialUpOverrideTimer::DoCancel()
+    {
+    iTimer.Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideTimer::RunL
+// -----------------------------------------------------------------------------
+//
+void CConnMonDialUpOverrideTimer::RunL()
+    {
+    LOGIT(".")
+    LOGIT1("RunL: CConnMonDialUpOverrideTimer <%d>", iStatus.Int())
+    iServer->SetDialUpOverrideStatus( EConnMonDialUpOverrideInactive );
+    }
+
+// End of file
--- a/connectionmonitoring/connmon/connectionmonitor/src/cellulardatausagekeyupdater.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/src/cellulardatausagekeyupdater.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 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"
@@ -71,7 +71,8 @@
     {
     // Cancel outstanding request, if exists
     Cancel();
-    delete iRepository;
+    delete iCommsRepository;
+    delete iCmmRepository;
     }
 
 // -----------------------------------------------------------------------------
@@ -81,50 +82,75 @@
 void CCellularDataUsageKeyUpdater::UpdateKeyL( const TInt aRegistration ) const
     {
     LOGENTRFN("CCellularDataUsageKeyUpdater::UpdateKeyL()")
-    LOGIT1("CCellularDataUsageKeyUpdater::UpdateKeyL: aRegistration <%d>", 
+    LOGIT1("CCellularDataUsageKeyUpdater::UpdateKeyL: aRegistration <%d>",
             aRegistration)
-                
-    TCmGenConnSettings occSettings = ReadGenConnSettingsL();
-  
+
     TInt value( ECmCellularDataUsageDisabled );
-        
-    if ( aRegistration == ENetworkRegistrationExtRoamingInternational )
-        {           
-        value = occSettings.iCellularDataUsageVisitor;
-        }
-    else if ( aRegistration == ENetworkRegistrationExtHomeNetwork || 
-              aRegistration == ENetworkRegistrationExtRoamingNational )
-        {           
-        value = occSettings.iCellularDataUsageHome;
+
+    // If dial-up PDP context override is active, disable cellular data usage (temporarily).
+    if ( iServer->GetDialUpOverrideStatus() != EConnMonDialUpOverrideActive )
+        {
+        TCmGenConnSettings occSettings = ReadGenConnSettingsL();
+
+        if ( aRegistration == ENetworkRegistrationExtRoamingInternational )
+            {
+            value = occSettings.iCellularDataUsageVisitor;
+            }
+        else if ( aRegistration == ENetworkRegistrationExtHomeNetwork ||
+                  aRegistration == ENetworkRegistrationExtRoamingNational )
+            {
+            value = occSettings.iCellularDataUsageHome;
+            }
         }
 
-    CRepository* cmRepository = NULL;
-    
-    TRAPD( err, cmRepository = CRepository::NewL( KCRUidCmManager ) )
-    
-    if ( err == KErrNone )
+    TInt previous( 0 );
+    TInt err = iCmmRepository->Get( KCurrentCellularDataUsage, previous );
+    if ( err == KErrNone && ( value != previous ) )
+        {
+        iCmmRepository->Set( KCurrentCellularDataUsage, value );
+        LOGIT1("KCurrentCellularDataUsage set to %d", value)
+        }
+    else
         {
-        TInt previous( 0 );
-        err = cmRepository->Get( KCurrentCellularDataUsage, previous );
-           
-        if ( err == KErrNone && ( value != previous ) )
+        LOGIT2("KCurrentCellularDataUsage already up-to-date %d <%d>", previous, err)
+        }
+
+    LOGEXITFN("CCellularDataUsageKeyUpdater::UpdateKeyL()")
+    }
+
+// -----------------------------------------------------------------------------
+// Return ETrue if dial-up PDP context override feature is enabled.
+// -----------------------------------------------------------------------------
+//
+TBool CCellularDataUsageKeyUpdater::DialUpOverrideEnabled() const
+    {
+    LOGENTRFN("CCellularDataUsageKeyUpdater::DialUpOverrideEnabled()")
+    TBool result( EFalse );
+
+    if ( iCmmRepository )
+        {
+        TInt value( 0 );
+        TInt err = iCmmRepository->Get( KDialUpOverride, value );
+        if ( err == KErrNone )
             {
-            cmRepository->Set( KCurrentCellularDataUsage, value );
-            LOGIT1("KCurrentCellularDataUsage set to %d", value)
+            if ( value )
+                {
+                result = ETrue;
+                LOGIT("ConstructL: Dial-up override enabled")
+                }
+            else
+                {
+                LOGIT("ConstructL: Dial-up override disabled")
+                }
             }
         else
             {
-            LOGIT1("KCurrentCellularDataUsage already up-to-date %d", previous)
+            LOGIT1("Failed to read KDialUpOverride-key from repository <%d>", err)
             }
-        
-        delete cmRepository;    
-        }
-    else
-        {
-        LOGIT1("CCRepository::NewL( KCRUidCmManager ) FAILED <%d>", err)
         }
 
-    LOGEXITFN("CCellularDataUsageKeyUpdater::UpdateKeyL()")
+    LOGEXITFN1("CCellularDataUsageKeyUpdater::DialUpOverrideEnabled()", result)
+    return result;
     }
 
 // -----------------------------------------------------------------------------
@@ -136,7 +162,8 @@
         CActive( EConnMonPriorityNormal ),
         iServer( aServer )
     {
-    iRepository = NULL;
+    iCommsRepository = NULL;
+    iCmmRepository = NULL;
     iErrorCounter = 0;
     }
 
@@ -146,13 +173,21 @@
 //
 void CCellularDataUsageKeyUpdater::ConstructL()
     {
-    iRepository = CRepository::NewL( KCDCommsRepositoryId );
-    
+    iCommsRepository = CRepository::NewL( KCDCommsRepositoryId );
+
+    // Open CmManager central repository.
+    TRAPD( err, iCmmRepository = CRepository::NewL( KCRUidCmManager ) )
+    if ( err )
+        {
+        LOGIT1("CRepository::NewL( KCRUidCmManager ) FAILED <%d>", err)
+        err = KErrNone;
+        }
+
     // Find out Default connection table id.
     // It contains iCellularDataUsageHome and iCellularDataUsageVisitor keys.
     CMDBSession* db = CMDBSession::NewLC( CMDBSession::LatestVersion() );	
-    TRAPD( err, iTableId = CCDDefConnRecord::TableIdL( *db ) )
-    	
+    TRAP( err, iTableId = CCDDefConnRecord::TableIdL( *db ) )
+
     if ( err )
         {
         LOGIT1("ERROR, CCDDefConnRecord::TableIdL() <%d>", err)
@@ -176,8 +211,8 @@
 //
 TInt CCellularDataUsageKeyUpdater::RequestNotifications()
     {  	    	
-    LOGIT1("Calling iRepository->NotifyRequest() for table 0x%08X", iTableId)
-    TInt err = iRepository->NotifyRequest( iTableId, KCDMaskShowRecordType, iStatus );
+    LOGIT1("Calling iCommsRepository->NotifyRequest() for table 0x%08X", iTableId)
+    TInt err = iCommsRepository->NotifyRequest( iTableId, KCDMaskShowRecordType, iStatus );
 
     if ( err == KErrNone )
         {
@@ -185,7 +220,7 @@
         }
     else
         {
-        LOGIT1("ERROR, iRepository->NotifyRequest() <%d>", err)
+        LOGIT1("ERROR, iCommsRepository->NotifyRequest() <%d>", err)
         }
 
     return err;
@@ -197,7 +232,7 @@
 //
 void CCellularDataUsageKeyUpdater::DoCancel()
     {
-    iRepository->NotifyCancel( iTableId, KCDMaskShowRecordType );
+    iCommsRepository->NotifyCancel( iTableId, KCDMaskShowRecordType );
     }
 
 // -----------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/connmondialupoverridenotifier.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -0,0 +1,216 @@
+/*
+* Copyright (c) 2010 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 dial-up PDP context override P&S-key.
+*
+*/
+
+#include <e32base.h>
+#include <e32property.h>
+
+#include "connmondialupoverridenotifier.h"
+#include "connectionmonitorpskeys.h"
+#include "ConnMonServ.h"
+#include "ConnMonIAP.h"
+#include "log.h"
+
+
+// -----------------------------------------------------------------------------
+// Two phased construction.
+// -----------------------------------------------------------------------------
+//
+CConnMonDialUpOverrideNotifier* CConnMonDialUpOverrideNotifier::NewL(
+        CConnMonServer* aServer )
+    {
+    CConnMonDialUpOverrideNotifier* self =
+            CConnMonDialUpOverrideNotifier::NewLC( aServer );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Two phased construction.
+// -----------------------------------------------------------------------------
+//
+CConnMonDialUpOverrideNotifier* CConnMonDialUpOverrideNotifier::NewLC(
+        CConnMonServer* aServer )
+    {
+    CConnMonDialUpOverrideNotifier* self =
+            new( ELeave ) CConnMonDialUpOverrideNotifier( aServer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CConnMonDialUpOverrideNotifier::~CConnMonDialUpOverrideNotifier()
+    {
+    // Cancel outstanding request, if exists.
+    Cancel();
+    iDialUpProperty.Delete( KConnectionMonitorPS, KDialUpConnection );
+    iDialUpProperty.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideNotifier::ResetStatus
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonDialUpOverrideNotifier::ResetStatus()
+    {
+    // Set property value to EConnMonReady.
+    TInt err = iDialUpProperty.Set( EConnMonReady );
+    LOGIT1("ResetStatus: Dial-up property value set to EConnMonReady <%d>", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CConnMonDialUpOverrideNotifier::CConnMonDialUpOverrideNotifier(
+        CConnMonServer* aServer )
+        :
+        CActive( EConnMonPriorityMedium ),
+        iServer( aServer),
+        iErrorCounter( 0 )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Two phased construction.
+// -----------------------------------------------------------------------------
+//
+void CConnMonDialUpOverrideNotifier::ConstructL()
+    {
+    LOGENTRFN("CConnMonDialUpOverrideNotifier::ConstructL()")
+
+    // Define Dial-up property.
+    TInt err = iDialUpProperty.Define(
+            KConnectionMonitorPS,
+            KDialUpConnection,
+            RProperty::EInt,
+            KDialUpOverrideReadC0,  // Read: Always pass
+            KDialUpOverrideWriteC2, // Write: NetworkControl, NetworkServices
+            0 );
+    LOGIT1("Dial-up property defined <%d>", err)
+    User::LeaveIfError( err );
+
+    // Attach to property.
+    err = iDialUpProperty.Attach(
+            KConnectionMonitorPS,
+            KDialUpConnection );
+    LOGIT1("Dial-up property attach <%d>", err)
+    User::LeaveIfError( err );
+
+    // Set property value to EConnMonReady.
+    ResetStatus();
+
+    CActiveScheduler::Add( this );
+    RequestNotifications();
+
+    LOGEXITFN("CConnMonDialUpOverrideNotifier::ConstructL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideNotifier::RequestNotifications
+// -----------------------------------------------------------------------------
+//
+void CConnMonDialUpOverrideNotifier::RequestNotifications()
+    {
+    LOGENTRFN("CConnMonDialUpOverrideNotifier::RequestNotifications()")
+
+    if ( !IsActive() )
+        {
+        iDialUpProperty.Subscribe( iStatus );
+        LOGIT("KDialUpConnection-key, Subscribe()")
+        SetActive();
+        }
+
+    LOGEXITFN("CConnMonDialUpOverrideNotifier::RequestNotifications()")
+    return;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideNotifier::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CConnMonDialUpOverrideNotifier::DoCancel()
+    {
+    LOGIT("Canceling dialup property subscription.")
+    iDialUpProperty.Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDialUpOverrideNotifier::RunL
+// -----------------------------------------------------------------------------
+//
+void CConnMonDialUpOverrideNotifier::RunL()
+    {
+    LOGIT(".")
+    LOGIT1("RunL: CConnMonDialUpOverrideNotifier <%d>", iStatus.Int())
+
+    if ( iStatus.Int() == KErrNone )
+        {
+        iErrorCounter = 0;
+        TInt value = -1;
+        TInt err = iDialUpProperty.Get( value );
+        LOGIT2("Dial-up override value is %d <%d>", value, err)
+
+        switch ( value )
+            {
+            case EConnMonDialUpClosed:
+                {
+                // Deactivate the dial-up override (if active). This will return
+                // cellular data connectivity back to normal.
+                iServer->SetDialUpOverrideStatus( EConnMonDialUpOverrideInactive );
+                ResetStatus();
+                }
+                break;
+            case EConnMonDialUpInit:
+                {
+                // Set the dial-up override status to active. This will block
+                // other cellular data connectivity and start the timeout timer.
+                iServer->SetDialUpOverrideStatus( EConnMonDialUpOverrideActive );
+
+                // If there are no active packetdata connections, signal EConnMonReady
+                // immediately. If there are active connections, EConnMonReady is
+                // signaled when those connections have gone down.
+                if ( !iServer->Iap()->ActivePacketdataConnectionsFound() )
+                    {
+                    ResetStatus();
+                    }
+                }
+                break;
+            case EConnMonReady:
+            default:
+                break;
+            }
+        }
+    else
+        {
+        LOGIT1("Dial-up override notification error <%d>", iStatus.Int())
+        iErrorCounter++;
+        if ( iErrorCounter > KConnMonPsEventErrorThreshold )
+            {
+            LOGIT1("Over %d consecutive errors, stopping", KConnMonPsEventErrorThreshold)
+            return;
+            }
+        }
+    RequestNotifications();
+    }
+
+// End of file
--- a/connectionutilities/confirmqueries/inc/cellularpromptdialog.h	Tue Jul 06 14:42:41 2010 +0300
+++ b/connectionutilities/confirmqueries/inc/cellularpromptdialog.h	Wed Aug 18 10:10:23 2010 +0300
@@ -22,6 +22,10 @@
 #include <QObject>
 #include <HbDialog>
 #include <hbdevicedialoginterface.h>
+#include <QSharedPointer>
+
+// Forward declarations
+class HbTranslator;
 
 class CellularPromptDialog: public HbDialog, public HbDeviceDialogInterface
     {
@@ -79,6 +83,9 @@
         
         /* Tells whether close has already been called for the dialog */
         bool mClose;
+
+        /* Translator for the localisation Text Id's */
+        QSharedPointer<HbTranslator> mTranslator;
     };
 
 
--- a/connectionutilities/confirmqueries/src/cellularpromptdialog.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/connectionutilities/confirmqueries/src/cellularpromptdialog.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -45,7 +45,7 @@
     OstTraceFunctionEntry0( CELLULARPROMPTDIALOG_CELLULARPROMPTDIALOG_ENTRY );
 
     // Install localization
-    HbTranslator *translator(new HbTranslator("cellularpromptdialog"));
+    mTranslator = QSharedPointer<HbTranslator>(new HbTranslator("cellularpromptdialog"));
 
     createDialog(parameters);
     mClose = false;
--- a/ipcm_plat/bearer_settings_plugin_api/inc/cmpluginbaseeng.h	Tue Jul 06 14:42:41 2010 +0300
+++ b/ipcm_plat/bearer_settings_plugin_api/inc/cmpluginbaseeng.h	Wed Aug 18 10:10:23 2010 +0300
@@ -387,18 +387,7 @@
          * @param aTableIdArray A reference to an array where iap related generic
          * table ids are added.
          */
-        IMPORT_C void GetGenericTableIdsToBeObserved( RArray<TUint32>& aTableIdArray ) const;
-
-        /**
-         * Requests CommsDat table ids to be observed for changes by the cmm
-         * server. If a table used is not mentioned to be modified a bearer
-         * shouldn't return this. Bearers do not reset the array before adding
-         * ids.
-         * @param aTableIdArray A reference to an array where plugin must add
-         * the ids of the tables it want's to be observed.
-         */
-        IMPORT_C virtual void GetBearerTableIdsToBeObservedL(
-                RArray<TUint32>& aTableIdArray ) const = 0;
+        IMPORT_C void GetGenericTableIdsToBeObservedL( RArray<TUint32>& aTableIdArray ) const;
 
     public: // plugin interface
         /**
@@ -609,6 +598,17 @@
          */
         virtual void BearerRecordNameLC( HBufC* &aBearerName ) = 0;
 
+        /**
+         * Requests CommsDat table ids to be observed for changes by the cmm
+         * server. If a table used is not mentioned to be modified a bearer
+         * shouldn't return this. Bearers do not reset the array before adding
+         * ids.
+         * @param aTableIdArray A reference to an array where plugin must add
+         * the ids of the tables it want's to be observed.
+         */
+        IMPORT_C virtual void GetBearerTableIdsToBeObservedL(
+                RArray<TUint32>& aTableIdArray ) const = 0;
+
     protected:
         /**
          * Constructor
--- a/ipcm_plat/connection_monitor_extension_api/group/bld.inf	Tue Jul 06 14:42:41 2010 +0300
+++ b/ipcm_plat/connection_monitor_extension_api/group/bld.inf	Wed Aug 18 10:10:23 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 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"
@@ -11,8 +11,8 @@
 *
 * Contributors:
 *
-* Description:  File that exports the files belonging to Connection
-*                Monitor Extension API.
+* Description:
+* File that exports the files belonging to Connection Monitor Extension API.
 *
 */
 
@@ -23,4 +23,5 @@
 
 PRJ_EXPORTS
 
-../inc/ConnMonExt.h     MW_LAYER_PLATFORM_EXPORT_PATH(ConnMonExt.h)
+../inc/ConnMonExt.h                 MW_LAYER_PLATFORM_EXPORT_PATH(ConnMonExt.h)
+../inc/connectionmonitorpskeys.h    MW_LAYER_PLATFORM_EXPORT_PATH(connectionmonitorpskeys.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/connection_monitor_extension_api/inc/connectionmonitorpskeys.h	Wed Aug 18 10:10:23 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2010 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:  Connection Monitor Publish & Subscribe keys.
+*
+*/
+
+
+#ifndef CONNECTIONMONITORPSKEYS_H
+#define CONNECTIONMONITORPSKEYS_H
+
+/**
+ * Connection Monitor RProperty category.
+ */
+const TUid KConnectionMonitorPS = {0x101F6CF0};
+
+/**
+ * Dial-Up override key.
+ * Used only when dial-up override feature is enabled. The purpose for this
+ * feature is to stop and block any packetdata connections while a dial-up
+ * connection is beeing established in single PDP context networks.
+ */
+const TUint KDialUpConnection = 0x00000001;
+
+/**
+ * Values for KDialUpConnection key.
+ */
+enum TDialUpStates
+    {
+    /**
+     * Can be used to indicate to Connection Monitor Server that a dial-up
+     * connection has ended. If the dial-up connection setup fails, this can be
+     * used to restore normal packetdata connectivity a little faster in some
+     * error situations.
+     */
+    EConnMonDialUpClosed,
+    /**
+     * Indicates to Connection Monitor Server that a Dial-Up connection is
+     * starting. Connection Monitor will stop any active packetdata connection
+     * and block further packetdata connections during the dial-up connection
+     * setup.
+     */
+    EConnMonDialUpInit,
+    /**
+     * Connection Monitor Server will indicate with this value that any
+     * preparations for an upcoming dial-up connection are completed.
+     */
+    EConnMonReady
+    };
+
+#endif // CONNECTIONMONITORPSKEYS_H
--- a/ipcm_plat/extended_connection_settings_api/group/bld.inf	Tue Jul 06 14:42:41 2010 +0300
+++ b/ipcm_plat/extended_connection_settings_api/group/bld.inf	Wed Aug 18 10:10:23 2010 +0300
@@ -27,7 +27,6 @@
 ../inc/cmdestinationext.h       MW_LAYER_PLATFORM_EXPORT_PATH(cmdestinationext.h)
 ../inc/cmconnectionmethodext.h  MW_LAYER_PLATFORM_EXPORT_PATH(cmconnectionmethodext.h)
 ../inc/cmpsettingsconsts.h      MW_LAYER_PLATFORM_EXPORT_PATH(cmpsettingsconsts.h)
-../inc/cmsettingsui.h           MW_LAYER_PLATFORM_EXPORT_PATH(cmsettingsui.h)
 ../inc/cmcommonui.h             MW_LAYER_PLATFORM_EXPORT_PATH(cmcommonui.h)
 ../inc/cmmanagerext.h           MW_LAYER_PLATFORM_EXPORT_PATH(cmmanagerext.h)
 ../inc/cmmanagerkeys.h          MW_LAYER_PLATFORM_EXPORT_PATH(cmmanagerkeys.h)
--- a/ipcm_plat/extended_connection_settings_api/inc/cmmanagerkeys.h	Tue Jul 06 14:42:41 2010 +0300
+++ b/ipcm_plat/extended_connection_settings_api/inc/cmmanagerkeys.h	Wed Aug 18 10:10:23 2010 +0300
@@ -21,7 +21,7 @@
 /**
  * UID of CmManager repository
  *
- * @since S60 5.1
+ * @since S60 5.2
  */
 const TUid KCRUidCmManager = {0x10207376}; 
 
@@ -33,8 +33,19 @@
  * but the value is provided for the country the device is at the moment.
  * See TCmCellularDataUsage in cmgenconnsettings.h for more info.
  *
- * @since S60 5.1
+ * @since S60 5.2
  */
 const TUint32 KCurrentCellularDataUsage  = 0x00000001;
+
+/**
+ * Dial-up override setting.
+ *
+ * When this key is enabled dial-up connection overrides all
+ * internal cellular connections. Internal cellular connections 
+ * are automatically disconnected when dial-up connection starts.
+ *
+ * @since S60 5.2
+ */
+const TUint32 KDialUpOverride  = 0x00000002;
     
 #endif // CMMANAGERKEYS_H
--- a/ipcm_plat/extended_connection_settings_api/inc/cmsettingsui.h	Tue Jul 06 14:42:41 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
-* Copyright (c) 2006 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:  Implementation of settings UI
-*
-*/
-
-#ifndef C_CMSETTINGSUI_H
-#define C_CMSETTINGSUI_H
-
-// Deprecation warning
-#warning This header file is deprecated and will be removed. See Polonium CR #461 for details.
-
-#include <e32def.h>
-#include <e32base.h>
-
-class CCmSettingsUiImpl;
-
-/**
- *  Implementation of Setting UI
- *
- *  @lib cmmanager.lib
- *  @since S60 v3.2
- */
-NONSHARABLE_CLASS(CCmSettingsUi) : public CBase
-    {
-    public:
-
-        enum TResult
-                {
-                EBack,
-                EExit
-                };
-
-        /** Epoc constructor */
-        IMPORT_C static CCmSettingsUi* NewL();
-
-        /** Destructor */
-        virtual ~CCmSettingsUi();
-
-    //=========================================================================    
-    // UI API
-    //
-    public:
-
-        /**
-        * Launches the Settings UI 
-        * for handling Destinations and Connection Methods
-        * @since 3.2
-        * @return TResult - the softkey the user exited with
-        */
-        IMPORT_C TResult RunSettingsL();
-        
-        /**
-        * Launches a dialog with a list of Destination
-        * @since 3.2
-        * @param  aDestinationId ID of the selected Destination
-        * @return TBool
-        */
-        IMPORT_C TBool SelectDestinationDlgL( TUint32& aDestinationId );
-
-    private:
-
-        /** First stage constructor */
-        CCmSettingsUi();
-
-        /** Epoc constructor */
-        void ConstructL();
-
-    private: // data
-
-        CCmSettingsUiImpl* iImpl;
-    };
-
-#endif // C_CMSETTINGSUI_H
--- a/ipcm_pub/connection_settings_api/group/bld.inf	Tue Jul 06 14:42:41 2010 +0300
+++ b/ipcm_pub/connection_settings_api/group/bld.inf	Wed Aug 18 10:10:23 2010 +0300
@@ -37,5 +37,4 @@
 ../inc/cmpluginvpndef.h             MW_LAYER_PUBLIC_EXPORT_PATH(cmpluginvpndef.h)
 ../inc/cmpluginhscsddef.h           MW_LAYER_PUBLIC_EXPORT_PATH(cmpluginhscsddef.h)
 ../inc/cmmanager.h                  MW_LAYER_PUBLIC_EXPORT_PATH(cmmanager.h)
-../inc/cmsettingsui.h               MW_LAYER_PUBLIC_EXPORT_PATH(cmsettingsui.h)
 ../inc/cmgenconnsettings.h          MW_LAYER_PUBLIC_EXPORT_PATH(cmgenconnsettings.h)
--- a/ipcm_pub/connection_settings_api/inc/cmsettingsui.h	Tue Jul 06 14:42:41 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
-* Copyright (c) 2006 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:  Implementation of settings UI
-*
-*/
-
-#ifndef C_CMSETTINGSUI_H
-#define C_CMSETTINGSUI_H
-
-#include <E32def.h>
-#include <e32base.h>
-
-class CCmSettingsUiImpl;
-
-/**
- *  Implementation of Setting UI
- *
- *  @lib cmmanager.lib
- *  @since S60 v3.2
- */
-NONSHARABLE_CLASS(CCmSettingsUi) : public CBase
-    {
-    public:
-
-        enum TResult
-                {
-                EBack,
-                EExit
-                };
-
-        /** Epoc constructor */
-        IMPORT_C static CCmSettingsUi* NewL();
-
-        /** Destructor */
-        virtual ~CCmSettingsUi();
-
-    //=========================================================================    
-    // UI API
-    //
-    public:
-
-        /**
-        * Launches the Settings UI 
-        * for handling Destinations and Connection Methods
-        * @since 3.2
-        * @return TResult - the softkey the user exited with
-        */
-        IMPORT_C TResult RunSettingsL();
-        
-        /**
-        * Launches a dialog with a list of Destination
-        * @since 3.2
-        * @param  aDestinationId ID of the selected Destination
-        * @return TBool
-        */
-        IMPORT_C TBool SelectDestinationDlgL( TUint32& aDestinationId );
-
-    private:
-
-        /** First stage constructor */
-        CCmSettingsUi();
-
-        /** Epoc constructor */
-        void ConstructL();
-
-    private: // data
-
-        CCmSettingsUiImpl* iImpl;
-    };
-
-#endif // C_CMSETTINGSUI_H