Merge heads.
authorPat Downey <patd@symbian.org>
Wed, 23 Jun 2010 17:49:20 +0100
changeset 42 017c42709822
parent 27 489cf6208544 (diff)
parent 25 d840bfde7d40 (current diff)
Merge heads.
--- a/accesspointcontrol/apcontrollistplugin/data/10281BB4.rss	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +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: 
-*        ECOM plugin resource file for VPN Settings plugin.
-*
-*/
-
-#include <ecom/registryinfo.rh>
-
-RESOURCE REGISTRY_INFO theInfo
-    {
-    dll_uid     = 0x10281BB4; // Plugin dll UID
-    interfaces  = 
-        {
-        INTERFACE_INFO
-            {
-            interface_uid   = 0x10207236; // UID for CGSPluginInterface
-            implementations = 
-                {
-                IMPLEMENTATION_INFO
-                    {
-                    implementation_uid  = 0x10281BB5; // Plugin UID
-                    version_no          = 1;
-                    display_name        = "AP Control List Plugin"; // Plugin debug name
-#ifdef RD_CONTROL_PANEL
-                    default_data        = "0x200255B9"; // Parent UID (gsconnsettingsplugin)
-                    opaque_data         = "70"; // Order number
-#else //RD_CONTROL_PANEL
-                    default_data        = "0x10207250"; // Parent UID (Connection View)
-                    opaque_data         = "210"; // Order number
-#endif //RD_CONTROL_PANEL
-                    }
-                };
-            }
-        };
-    }
-
--- a/accesspointcontrol/apcontrollistplugin/data/apcontrollistpluginrsc.rss	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,357 +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: 
-*        Resource file for APControlListPlugin
-*
-*/
-
-
-//  RESOURCE IDENTIFIER
-NAME    APCL
-
-//  INCLUDES
-#include <eikon.rh>
-#include <eikon.rsg>
-#include <avkon.rh>
-#include <avkon.rsg>
-#include <avkon.loc>
-
-#include "apcontrollistplugin.hrh"
-#include <apcontrollistplugin.loc>
-
-
-
-
-//  MACROS
-
-//  RESOURCE DEFINITIONS
-RESOURCE RSS_SIGNATURE
-    {
-    }
-
-RESOURCE TBUF
-    {
-    buf = "apnlist";
-    }
-
-//----------------------------------------------------
-//
-//    r_apclplugin_title
-//
-//
-//----------------------------------------------------
-//
-RESOURCE TBUF r_apclplugin_title                         
-    { 
-    buf = qtn_acl_title; 
-    }
-
-//----------------------------------------------------
-//
-//    r_qtn_acl_navi_active
-//
-//
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_acl_navi_active                          
-    { 
-    buf = qtn_acl_navi_active ; 
-    }
-    
-//----------------------------------------------------
-//
-//    r_qtn_acl_navi_not_active
-//
-//
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_acl_navi_not_active                          
-    { 
-    buf = qtn_acl_navi_not_active ; 
-    }
-    
-//----------------------------------------------------
-//
-//    r_qtn_acl_empty_view_primary
-//
-//
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_acl_empty_view_primary                          
-    { 
-    buf = qtn_acl_empty_view_primary ; 
-    }
-    
-//----------------------------------------------------
-//
-//    qtn_acl_empty_view_secondary
-//
-//
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_acl_empty_view_secondary                          
-    { 
-    buf = qtn_acl_empty_view_secondary ; 
-    }
-
-//----------------------------------------------------
-//
-//    r_qtn_acl_wait_reading_sim
-//
-//
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_acl_wait_reading_sim                         
-    { 
-    buf = qtn_acl_wait_reading_sim; 
-    }
-
-//----------------------------------------------------
-//
-//    r_qtn_acl_network_provided_apn
-//
-//
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_acl_network_provided_apn                         
-    { 
-    buf = qtn_acl_network_provided_apn; 
-    }
-
-//----------------------------------------------------
-//
-//    r_qtn_acl_conf_nwp_apn_added
-//
-//
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_acl_conf_nwp_apn_added                         
-    { 
-    buf = qtn_acl_conf_nw_provided_apn_added; 
-    }
-
-//----------------------------------------------------
-//   
-//    r_qtn_acl_conf_apn_added 
-//
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_acl_conf_apn_added { buf = qtn_acl_conf_apn_added ; }
-
-//----------------------------------------------------
-//   
-//    r_qtn_acl_conf_apn_removed 
-//
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_acl_conf_apn_removed { buf = qtn_acl_conf_apn_removed ; }
-
-//----------------------------------------------------
-//   
-//    r_qtn_acl_conf_control_activated 
-//
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_acl_conf_control_activated { buf = qtn_acl_conf_control_activated ; }
-
-//----------------------------------------------------
-//   
-//    r_qtn_acl_conf_control_deactivated 
-//
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_acl_conf_control_deactivated { buf = qtn_acl_conf_control_deactivated ; }
-
-//----------------------------------------------------
-//   
-//    r_qtn_acl_info_active 
-//
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_acl_info_active { buf = qtn_acl_info_active ; }
-
-//----------------------------------------------------
-//   
-//    r_qtn_acl_info_not_active 
-//
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_acl_info_not_active { buf = qtn_acl_info_not_active ; }
-
-//----------------------------------------------------
-//   
-//    r_qtn_acl_err_invalid_input 
-//
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_acl_err_invalid_input { buf = qtn_acl_err_invalid_input; }
-
-//----------------------------------------------------
-//   
-//    r_qtn_acl_err_sim_card 
-//
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_acl_err_sim_card { buf = text_fdn_card_error; }
-
-//----------------------------------------------------
-//   
-//    r_two_string_for_empty_view 
-//
-//----------------------------------------------------
-//
-RESOURCE TBUF r_two_string_for_empty_view { buf = "%0U\n%1U"; }
-
-//----------------------------------------------------
-//
-//    r_apclplugin_main_menubar
-//
-//
-//----------------------------------------------------
-//
-RESOURCE MENU_BAR r_apclplugin_main_menubar
-    {
-    titles =
-        {
-        MENU_TITLE 
-            { 
-            menu_pane = r_apclplugin_main_menu; 
-            }
-        };
-    }
-
-//----------------------------------------------------
-//
-//    r_apclplugin_main_menu
-//
-//
-//----------------------------------------------------
-//
-RESOURCE MENU_PANE r_apclplugin_main_menu
-    {
-    items =
-        {
-        MENU_ITEM 
-            { 
-            command = EAPControlListCmdActivate; 
-            txt = qtn_acl_options_activate_control; 
-            },
-        MENU_ITEM 
-            { 
-            command = EAPControlListCmdDeactivate; 
-            txt = qtn_acl_options_deactivate_control; 
-            },
-        MENU_ITEM 
-            { 
-            command = EAPControlListCmdAdd; 
-            txt = qtn_acl_options_add_apn_manually; 
-            },
-        MENU_ITEM 
-            { 
-            command = EAPControlListCmdRemove; 
-            txt = qtn_acl_options_remove;
-            flags = EEikMenuItemSpecific;
-            },
-        MENU_ITEM 
-            { 
-            command = EAknCmdHelp; 
-            txt = qtn_options_help; 
-            },
-        MENU_ITEM 
-            { 
-            command = EEikCmdExit; 
-            txt = qtn_options_exit; 
-            }
-        };
-    }
-
-//----------------------------------------------------
-//
-//    r_apclplugin_softkeys_options_back
-//
-//
-//----------------------------------------------------
-//
-RESOURCE CBA r_apclplugin_softkeys_options_back
-    {
-    buttons =
-        {
-        CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;},
-        CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back;},
-        CBA_BUTTON {id=EAknSoftkeyEmpty; txt = text_softkey_empty;}
-        };
-    }
-
-//----------------------------------------------------
-//   
-//    r_apclplugin_main_view
-//    Main view.
-//
-//----------------------------------------------------
-//
-RESOURCE AVKON_VIEW    r_apclplugin_main_view    
-    {
-    menubar=r_apclplugin_main_menubar;  
-    cba=r_apclplugin_softkeys_options_back;   
-    }
-
-RESOURCE LISTBOX r_apcontrol_listbox
-{
-   flags = EAknListBoxSelectionList;
-}
-//----------------------------------------------------
-//
-//    r_apn_name_query
-//
-//
-//----------------------------------------------------
-//
-RESOURCE DIALOG r_apn_name_query
-   {
-   flags = EGeneralQueryFlags;
-   buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
-   items =
-       {
-       DLG_LINE
-             {
-             type = EAknCtQuery;
-             id = EGeneralQuery;
-             control = AVKON_DATA_QUERY
-                    {
-                    layout = EDataLayoutAllowEmptyInput;
-                    label = qtn_acl_prmpt_apn_to_add;
-                    control = EDWIN
-                        {
-                        maxlength = KMaxApnNameWitoutLabelLength;
-                        default_case = EAknEditorLowerCase;
-                        // accepts only ASCII
-                        flags = EEikEdwinNoWrap;
-                        avkon_flags = EAknEditorFlagLatinInputModesOnly;
-                        };
-                    };
-             }
-        };
-    }
-    
-//----------------------------------------------------
-//   
-//    r_qtn_vpn_main 
-//    Caption for Plugin.
-//
-//----------------------------------------------------
-//
-RESOURCE TBUF r_qtn_acl_menu_item { buf = qtn_acl_menu_item ; }
-
-
-//End of File
--- a/accesspointcontrol/apcontrollistplugin/group/apcontrollistplugin.mmp	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
-* Copyright (c) 2005 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: 
-*     This is project specification file for the apcontrollistplugin.
-*
-*
-*/
-
-#include <data_caging_paths.hrh>    //this is needed for RESOURCE_FILES_DIR
-#include <platform_paths.hrh>
-
-CAPABILITY          CAP_ECOM_PLUGIN
-TARGET              apcontrollistplugin.dll
-TARGETTYPE          PLUGIN
-UID                 0x10009D8D 0x10281BB4
-VENDORID            VID_DEFAULT
-
-SOURCEPATH          ../src
-SOURCE				apcontrollistapiwrapper.cpp
-SOURCE              apcontrollistbox.cpp
-SOURCE              apcontrollistboxmodel.cpp
-SOURCE              apcontrollistcapschange.cpp
-SOURCE              apcontrollistplugin.cpp
-SOURCE              apcontrollistplugincontainer.cpp 
-SOURCE              apcontrollistpluginimplementationtable.cpp
-SOURCE              apcontrollistpluginlogger.cpp
-
-USERINCLUDE         ../data
-
-// Component specific internal headers 
-USERINCLUDE			../inc
-
-// ADO specific internal headers 
-SYSTEMINCLUDE		../../../inc
-
-//Macro to /epoc32 headers
-MW_LAYER_SYSTEMINCLUDE
-
-#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
-APP_LAYER_SYSTEMINCLUDE
-#endif
-
-SOURCEPATH          ../data
-
-//ECOM resource definition
-START RESOURCE      10281BB4.rss
-TARGET              apcontrollistplugin.rsc
-END 
-// ECOM resource definition
-
-//apcontrollistplugin resources
-START RESOURCE      apcontrollistpluginrsc.rss
-HEADER
-TARGETPATH          RESOURCE_FILES_DIR
-LANGUAGE_IDS
-END
-
-LIBRARY             hlplch.lib      // for "Help" options menu
-LIBRARY             euser.lib
-LIBRARY             ecom.lib
-LIBRARY             efsrv.lib
-LIBRARY             avkon.lib
-LIBRARY             bafl.lib 
-LIBRARY             cone.lib 
-LIBRARY             eikcoctl.lib 
-LIBRARY             eikcore.lib
-LIBRARY             eikctl.lib
-LIBRARY             commonengine.lib//For RConeResourceLoader
-LIBRARY             GSFramework.lib
-LIBRARY             egul.lib        // CGulIcon
-LIBRARY             aknskins.lib    // AknsUtils.h
-LIBRARY             flogger.lib
-LIBRARY             GSEcomPlugin.lib
-LIBRARY             commonui.lib 
-LIBRARY 			aknnotify.lib 
-LIBRARY             centralrepository.lib
-LIBRARY 			etel.lib 
-LIBRARY 			etelmm.lib 
-LIBRARY 			customapi.lib 
-LIBRARY 			ws32.lib 
-LIBRARY 			FeatMgr.lib 
-
-
-// This is optional - used only by Codewarrior for convenience.
-DOCUMENT            10281BB4.rss
--- a/accesspointcontrol/apcontrollistplugin/group/apcontrollistpluginicons_dc.mk	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-#
-# Copyright (c) 2003 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:  Makefile for icons of APControlListPlugin
-#
-
-ifeq (WINS,$(findstring WINS, $(PLATFORM)))
-ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z
-else
-ZDIR=\epoc32\data\z
-endif
-
-
-TARGETDIR=$(ZDIR)\resource\apps
-ICONTARGETFILENAME=$(TARGETDIR)\apcontrollistplugin.mif
-
-HEADERDIR=\epoc32\include
-HEADERFILENAME=$(HEADERDIR)\apcontrollistplugin.mbg
-
-do_nothing :
-	@rem do_nothing
-
-MAKMAKE : do_nothing
-
-BLD : do_nothing
-
-CLEAN : do_nothing
-
-LIB : do_nothing
-
-CLEANLIB : do_nothing
-
-# ----------------------------------------------------------------------------
-# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by
-# MifConv if the mask detph is defined.
-#
-# NOTE 2: Usually, source paths should not be included in the bitmap
-# definitions. MifConv searches for the icons in all icon directories in a
-# predefined order, which is currently \s60\icons, \s60\bitmaps2, \s60\bitmaps.
-# The directory \s60\icons is included in the search only if the feature flag
-# __SCALABLE_ICONS is defined.
-# ----------------------------------------------------------------------------
-
-RESOURCE :
-	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
-		/c16,8 qgn_prop_set_conn_acl.bmp 
-
-FREEZE : do_nothing
-
-SAVESPACE : do_nothing
-
-RELEASABLES :
-	@echo $(HEADERFILENAME)&& \
-	@echo $(ICONTARGETFILENAME)
-
-FINAL : do_nothing
--- a/accesspointcontrol/apcontrollistplugin/group/bld.inf	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
-* Copyright (c) 2005 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:  Build information for the APControlListsPlugin
-*
-*/
-
-
-#ifdef RD_GS_RENOVATION // This is the GS_RENOVATION
-	
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-// export iby files
-../rom/APControlListPlugin.iby		CORE_MW_LAYER_IBY_EXPORT_PATH(APControlListPlugin.iby)
-../rom/APControlListPluginResources.iby	LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(APControlListPluginResources.iby)
-
-// export localised loc file
-../loc/apcontrollistplugin.loc	MW_LAYER_LOC_EXPORT_PATH(apcontrollistplugin.loc)
-
-PRJ_MMPFILES
-// gnumakefile apcontrollistpluginicons_dc.mk
-
-./apcontrollistplugin.mmp
-
-PRJ_EXTENSIONS
-
-START EXTENSION s60/mifconv
-OPTION TARGETFILE apcontrollistplugin.mif
-OPTION HEADERFILE apcontrollistplugin.mbg
-OPTION SOURCES -c16,8 qgn_prop_set_conn_acl
-END
-
-#endif
-
-// End of File
--- a/accesspointcontrol/apcontrollistplugin/inc/apcontrollistapiwrapper.h	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,240 +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:  
-* 		 Wrapper class for asyncron calls in RMyPhone and RMyCustomAPI.
-*
-*/
-
-#ifndef APCONTROLLISTAPIWRAPPER_H
-#define APCONTROLLISTAPIWRAPPER_H
-
-// INCLUDES
-#include <e32base.h>
-#include <rmmcustomapi.h>
-
-// FORWARD DECLARATIONS
-class CAPControlListPlugin;
-
-// CLASS DECLARATION
-/**
-*  Wrapper class for asyncron calls in RMyPhone and RMyCustomAPI.
-*/
-class CAPControlListAPIWrapper : public CActive
-	{
-	private: 
-		// Enum for the states checked in RunL()
-		enum TRequestType { EGetACLStatus, EAddAPN, EAddAPNSecurity, 
-		                    ERemoveAPN, ERemoveAPNSecurity, EActivateACL, 
-							EActivateACLSecurity, EDeactivateACL, 
-							EDeactivateACLSecurity, EReadData, 
-							EEnumerateAPN, ENoRequest};
-
-    public:  
-    	// Constructor and destructor
-    	    			
-        /**
-        * Constructor.
-        * @param aPlugin reference to the view
-        * @param aPriority priority for CActive
-        */
-		CAPControlListAPIWrapper(CAPControlListPlugin& aPlugin,
-									TInt aPriority = EPriorityStandard );
-        /**
-        * Destructor.
-        */
-		~CAPControlListAPIWrapper();
-		
-        // New functions     
-          
-        /**
-        * Initialises iPhone and iCustomAPI members. 
-        * Uses User::WaitForRequest
-        * because we need to know the ACL status before Visible() is called.
-        */
-		void ConstructL();
-		
-		// Primary functions for the API calls
-		// These are the functions for which security check is necessary.
-		// If the security was already checked they call the correspondig
-		// secondary function. If the security wasn't already checked they
-		// call the asyncron security check and let RunL call the correspondig
-		// secondary function when the security check is finished.
-        /**
-        * Add APN to the ACL list
-        */
-		void AddAPNL();		
-        /**
-        * Remove APN from the ACL list which is currently selected in the
-        * listbox.
-        */
-		void RemoveAPN();		
-        /**
-        * Activates the ACL list
-        */
-		void ActivateACL();
-        /**
-        * Deactivates the ACL list
-        */
-		void DeActivateACL();
-				
-        /**
-        * Gets the ACL status then reads the ACL list.
-        * If this call is succesfull then RunL calls EnumerateAPN 
-        * then it calls DoReadData
-        */
-		void ReadData();
-		
-        /**
-        * Method for checking if plugin should be visible and used in 
-        * the Connection settings.
-        * @return ETrue if plugin should be visible.
-        * @return EFalse if plugin should not be visible.
-        */
-		TBool Visible() const;
-		
-        /**
-        * Method for checking if the ACL list is enabled or not. 
-        * @return ETrue if the ACL list is enabled.
-        * @return EFalse if the ACL list is not enabled.
-        */
-		TBool Enabled() const;
-		
-        /**
-      	* Calls RMyPhone::NotifyIccAccessCapsChange
-        * Used by CAPControlListCapsChange class. This function is nescessary
-        * since iPhone is a private member.
-        */
-		void NotifyIccAccessCapsChange(TRequestStatus& aReqStatus, 
-														TUint32& aCaps);				
-        /**
-      	* Calls RTelSubSessionBase::CancelAsyncRequest
-        * Used by CAPControlListCapsChange class. This function is nescessary
-        * since iPhone is a private member.
-        */
-        void CancelNotify(); 
-				
-        // Functions from CActive
-        /**
-        * Closes API in case of Cancel() 
-        */
-		void DoCancel();		
-        /**
-        * Handles asynchronous function completion 
-        */
-		void RunL(); 
-		
-	private:
-        // New functions
-        
-        /**
-		* Called from one of the primary functions for the API calls
-        * Calls RMmCustomAPI::CheckSecurityCode asyncron call. This functon is
-        * called only once.
-        * @param aRequest We need this to set the state so we'll know in RunL
-        * which primary function called it.
-        */
-		void SecurityCheck( TRequestType aRequest ); 
-		
-		// Secondary functions for the API calls		
-        /**
-        * Secondary function for AddAPNL().Makes the asyncron call to 
-        * add an APN to the ACL list.
-        * If the security was already checked it is called from AddAPNL.
-        * If the security was not checked it is called from the RunL()
-        * when RunL() is called for RMmCustomAPI::CheckSecurityCode()
-        */
-		void DoAddAPNL();		
-        /**
-        * Secondary function for RemoveAPN().Makes the asyncron call to 
-        * remove an APN from the ACL list.
-        * If the security was already checked it is called from AddAPNL.
-        * If the security was not checked it is called from the RunL()
-        * when RunL() is called for RMmCustomAPI::CheckSecurityCode()
-        */
-		void DoRemoveAPN();
-        /**
-        * Secondary function for ActivateACL() and DeActivateACL().Makes the 
-        * asyncron call to SetACLStatus either EAclStatusEnabled or
-        * EAclStatusDisabled.
-        * If the security was already checked it is called from ActivateACL()
-        * or DeActivateACL().
-        * If the security was not checked it is called from the RunL()
-        * when RunL() is called for RMmCustomAPI::CheckSecurityCode()
-        * @param aAclStatus the status we want to set.
-        */
-		void SetACLStatus( const RMobilePhone::TAPNControlListServiceStatus 
-		                                        aAPNControlListServiceStatus );
-		
-        /**
-        * Reads the ACL list. 
-        * Gets the number of items with an asyncron call. The actual reading
-        * of the APNs happens in DoReadData()
-        */
-		void EnumerateAPN();
-		
-        /**
-        * Reads an APN entry from the ACL list and puts it in the listbox. 
-        * Called from RunL() when RunL() after ReadData() was called. It is
-        * called iSize times. 
-        */
-		void DoReadData();
-
-        /**
-        * Case EReadData in RunL 
-        * Code removed from RunL to make it's size smaller
-        */
-		void FinishReadDataL();
-		
-	private: // Data
-		
-        //@var reference to the view
-		CAPControlListPlugin&			iPlugin;
-	
-		// API objects
-        //@var RTelServer object for the ACL API
-		RTelServer 						iServer;	
-        //@var RMobilePhone object for the ACL API
-		RMobilePhone 					iPhone;
-        //@var RMmCustomAPI object for the ACL API
-		RMmCustomAPI 					iCustomAPI;
-
-        //@var state to store which is the current request
-		TRequestType iRequest;
-		
-        //@var  ACL status
-		RMobilePhone::TAPNControlListServiceStatus		iAclStatus;   
-		
-        //@var phone is online
-		TBool 							iConnAllowed;
-		
-        //@var security checked
-		TBool 							iSecurityChecked;
-		
-        //@var AP Name from the user input ( AddAPN2L() )
-		HBufC* 							iAPN;
-
-		//members for reading data ( ReadData() ReadData2() )
-        //@var AP Name in the form expected by the API
-		RMobilePhone::TAPNEntryV3 		iApn;
-        //@var iApn packaged
-		RMobilePhone::TAPNEntryV3Pckg 	iApnPKG;
-        //@var size of the ACL list
-		TUint32 						iSize;
-        //@var index of item currently read from the ACL list 
-		TUint32 						iIndex;
-	} ;
-
-#endif
-
-// End of file
--- a/accesspointcontrol/apcontrollistplugin/inc/apcontrollistbox.h	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +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:  Declaration of class CApControlListbox.
-*
-*/
-
-
-#ifndef APSELECTOR_LISTBOX_H
-#define APSELECTOR_LISTBOX_H
-
-// INCLUDE FILES
-#include <aknlists.h>
-class CAPControlListPluginContainer;
-
-
-// CLASS DECLARATION
-
-/**
-* Listbox to display the list of access points.
-* 
-*/
-NONSHARABLE_CLASS(CApControlListbox): public CAknSingleStyleListBox
-    {
-    public:     // Construct / destruct
-
-        /**
-        * Destructor.
-        */
-        virtual ~CApControlListbox();
-
-
-        /**
-        * Constructor.
-        */
-        CApControlListbox();
-
-    public :
-        /**
-        * Handle key event.
-        * @param aKeyEvent The key event.
-        * @param aType Key event type.
-        * @return Response (was the key event consumed?).
-        */
-        TKeyResponse OfferKeyEventL
-            ( const TKeyEvent& aKeyEvent, TEventCode aType );
-
-        /**
-        * Handle focus change.
-        * @param aDrawNow Draw now?
-        */
-        void FocusChanged( TDrawNow aDrawNow );
-
-
-        /**
-        * From CCoeControl. Handles a change to the control's resources.
-        * The types of resources handled are those which are shared across 
-        * the environment, e.g. colours or fonts.
-        * Called if Skinning is changed.
-        * @param aType A message UID value.
-        */
-        virtual void HandleResourceChange(TInt aType); 
-
-        /**
-        * Set EmptyText in the listbox
-        */
-        void SetListEmptyTextL();
-    };
-
-
-#endif
-
-// End of file
--- a/accesspointcontrol/apcontrollistplugin/inc/apcontrollistboxmodel.h	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +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:  Declaration of class CApControlListboxModel.
-*
-*/
-
-
-#ifndef APCONTROL_LISTBOX_MODEL_H
-#define APCONTROL_LISTBOX_MODEL_H
-
-// INCLUDES
-#include <aknlists.h>
-
-// CLASS DECLARATION
-
-/**
-* Data model for the access point listbox. It is an array of CApListItem
-* pointers; items are owned.
-*/
-NONSHARABLE_CLASS( CApControlListboxModel ):
-        public CTextListBoxModel,
-        public MDesCArray
-    {
-    public:     // Construct / destruct
-
-        /**
-        * Constructor.
-        * @param aGraphicType Graphic type
-        */
-        CApControlListboxModel( );
-
-        /**
-        * Destructor.
-        */
-        virtual ~CApControlListboxModel();
-
-    public:     // from MDesCArray
-
-        /**
-        * Get number of items in the model.
-        * @return Number of items.
-        */
-        TInt MdcaCount() const;
-
-        /**
-        * Text to be displayed for this item.
-        * @param aIndex Index of item.
-        * @return TPtrC for this item text (text owned by the model).
-        */
-        TPtrC MdcaPoint( TInt aIndex ) const;
-
-    };
-
-
-#endif
-
-// End of file
--- a/accesspointcontrol/apcontrollistplugin/inc/apcontrollistcapschange.h	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +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:  Class for asyncron API call NotifyIccAccessCapsChange.
-*
-*/
-
-#ifndef APCONTROLLISTCAPSCHANGE_H
-#define APCONTROLLISTCAPSCHANGE_H
-
-// INCLUDES
-#include <e32base.h>
-
-// FORWARD DECLARATIONS
-class CAPControlListPlugin;
-
-// CLASS DECLARATION
-/**
-*  Wrapper class for asyncron syncron API call NotifyIccAccessCapsChange.
-*/
-class CAPControlListCapsChange : public CActive
-	{
-	public: 
-    	// Constructor and destructor
-    	    			
-        /**
-        * Constructor.
-        * @param aPlugin reference to the view
-        * @param aPriority priority for CActive
-        */
-		CAPControlListCapsChange(CAPControlListPlugin& aPlugin,
-									TInt aPriority = EPriorityStandard );
-        /**
-        * Destructor.
-        */
-		~CAPControlListCapsChange();
-		
-        // New functions     
-        /**
-        * Makes asyncron API call RMobilePhone::NotifyIccAccessCapsChange
-        */
-		void NotifyCapsChange();
-		 
-				
-        // Functions from CActive
-        /**
-        * Called by Cancel() 
-        */
-		void DoCancel();		
-        /**
-        * Handles asynchronous function completion 
-        */
-		void RunL();
-		
-	private:
-        //@var reference to the view
-		CAPControlListPlugin&	iPlugin;
-		
-        //@var Caps set by NotifyIccAccessCapsChange
-		TUint32 				iCaps;
-	} ;
-
-#endif
-
-// End of file
--- a/accesspointcontrol/apcontrollistplugin/inc/apcontrollistplugin.h	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,256 +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: 
-*        Header file for CAPControlListPlugin class.
-*
-*/
-
-#ifndef APCONTROLLIST_PLUGIN_H__
-#define APCONTROLLIST_PLUGIN_H__
-
-// System includes
-#include <eikclb.h>
-#include <gsplugininterface.h>
-#include <ConeResLoader.h>
-
-// This UID is used for both the view UID and the ECOM plugin implementation UID.
-const TUid KAPControlListPluginUid = { 0x10281BB5 };
-
-
-// Forward declarations
-class CAPControlListPluginContainer;
-class CAPControlListAPIWrapper;
-class MUiRunnerObserver;
-class MEikListBoxObserver;
-class CAPControlListCapsChange;
-
-/**
-* Interface class for AP Settings Handler UI. 
-*/
-class CAPControlListPlugin : public CGSPluginInterface,
-                           public MEikListBoxObserver
-    {
-    public://Constructors & destructors
-
-        /**
-        * First phase constructor
-        * Creates new Plugin and Launches CAPControlListPlugin
-        * with default parameters
-        * @param aAppUi pointer to the application Ui
-        */ 
-        static CAPControlListPlugin* NewL( TAny* aInitParams );
-                        
-        /**
-        * Destructor
-        */
-        inline ~CAPControlListPlugin();
-        
-    public: // Functions from base class
-        
-        /**
-        * From CAknView
-        */
-        TUid Id() const;
-        
-        /**
-        * From CAknView
-        */
-        void HandleCommandL( TInt aCommand );
-          
-        /**
-        * From CAknView
-        */    
-        void DoActivateL( const TVwsViewId& aPrevViewId, 
-                          TUid aCustomMessageId, 
-                          const TDesC8& aCustomMessage );
-        
-        /**
-        * From CAknView
-        */    
-        void DoDeactivate();
-        
-        /**
-        * Exit plugin
-        */    
-        void ExitOnUSIMRemovalL();
-        
-
-    public:
-    
-        /**
-        * from CGSPluginInterface
-        */
-        
-        /**
-        * Method for checking plugin's Uid. Uid identifies this GS plugin. Use
-        * same Uid as the ECOM plugin implementation Uid.
-        *
-        * @return PluginUid
-        */
-        TUid PluginUid() const;
-
-        /**
-        * Method for getting caption of this plugin. This should be the 
-        * localized name of the settings view to be shown in parent view.
-        *
-        * @param aCaption pointer to Caption variable
-        */
-        void GetCaptionL( TDes& aCaption ) const;
-
-        /**
-        * Method for checking, if item has bitmap icon to be shown in list
-        *
-        * @return ETrue if plugin has icon bitmap
-        * @return EFalse if plugin does not have a bitmap
-        */
-        TBool HasBitmap() const;
-
-        /**
-        * Method for reading bitmap icon.
-        *
-        * @param aBitmap plugin bitmap
-        * @param aMask plugin icon bitmap mask
-        */
-        void GetBitmapL( CFbsBitmap* aBitmap, CFbsBitmap* aMask ) const;
-
-        /**
-        * Method for reading the ID of the plugin provider category. See 
-        *
-        * @return Plugin provider category ID defined by 
-        *         
-        */
-        TInt PluginProviderCategory() const;
-        
-        /**
-        * Creates a new icon of desired type. Override this to provide custom
-        * icons. Othervise default icon is used. Ownership of the created icon
-        * is transferred to the caller.
-        *
-        * Icon type UIDs (use these defined constants):
-        * KGSIconTypeLbxItem  -   ListBox item icon.
-        * KGSIconTypeTab      -   Tab icon.
-        *
-        * @param aIconType UID Icon type UID of the icon to be created.
-        * @return Pointer of the icon. NOTE: Ownership of this icon is
-        *         transferred to the caller.
-        */
-        CGulIcon* CreateIconL( const TUid aIconType );
-        
-        /**
-        * Method for checking, if plugin should be visible and used in GS FW.
-        * (for example shown in listbox of the parent view).
-        *
-        * On default plugin is visible. Overwrite this function to enable or
-        * disable your plugin dynamically.
-        *
-        * @return ETrue if plugin should be visible in GS.
-        * @return EFalse if plugin should not be visible in GS.
-        */
-        virtual TBool Visible() const;
-                
-        /**
-        * From MUiRunnerObserver
-        */                    
-        void UiComplete( TInt aUirEvent );
-        
-        /**
-        * From MEikListBoxObserver
-        */
-        void HandleListBoxEventL( CEikListBox* aListBox,
-                                  TListBoxEvent aEventType );
-                                          
-        /**
-        * Shows a information note.
-        * @param aResourceId Resource id of the showed text .
-        */
-        void ShowInfoNoteL( TInt aResourceId );
-
-        /**
-        * Shows a confirmation note.
-        * @param aResourceId Resource id of the showed text .
-        */
-        void ShowConfirmNoteL( TInt aResourceId );
-
-        /**
-        * Shows a confirmation note.
-        * @param aResourceId Resource id of the showed text .
-        */
-        void ShowConfirmNoteAPNL( TInt aResourceId, TPtrC& aAPN  );
-   
-      /**
-        * Init menu pane
-        */
-        virtual void DynInitMenuPaneL( TInt aResourceId, 
-                                       CEikMenuPane* aMenuPane );
-		
-        /**
-        * Method for getting the container 
-        *
-        * @return the container 
-        *         
-        */
-        CAPControlListPluginContainer* Container();
-                
-        /**
-        * Method for getting the APIWrapper 
-        *
-        * @return the APIWrapper 
-        *         
-        */
-        CAPControlListAPIWrapper* APIWrapper();
-
-    protected:
-    
-        /**
-        * Constructor
-        */
-        CAPControlListPlugin();
-
-    private:
-    
-        /**
-        * Second phase constructor
-        */
-        TAny ConstructL();
-                                                     
-                    
-    private: //data
-        
-        //@var pointer to the container - owned
-        CAPControlListPluginContainer* 	iContainer; 
-        
-        //@var Previous view.
-        TVwsViewId 						iPrevViewId; 
-        
-        //@var resource loader
-        RConeResourceLoader 			iResources;
-
-        //@var should the plugin should be visible and used in 
-        // the Connection settings.        
-        TBool 							iVisible;
-        
-        //@var class for wrapping asyncron API calls - owned
-        CAPControlListAPIWrapper* 		iAPIWrapper;
-        
-		//@var Wrapper class for asyncron syncron API call 
-		//NotifyIccAccessCapsChange - owned        
-        CAPControlListCapsChange* 		iChangeNotifier;
-        
-        // for the FeatureManager
-        TBool                           iHelp;
-	};
-
-#endif //APCONTROLLIST_PLUGIN_H__
-
-//End of file
--- a/accesspointcontrol/apcontrollistplugin/inc/apcontrollistplugin.hrh	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +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: 
-*     This file contains declarations for resources of APControl List Plugin.
-*     The file can be included in C++ or resource file.
-*
-*/
-
-
-#ifndef APCONTROLLISTUI_HRH
-#define APCONTROLLISTUI_HRH
-
-//Menu commands.
-enum TAPControlListMenuCommands
-    {
-    EAPControlListCmdActivate = 7777,
-    EAPControlListCmdDeactivate,
-    EAPControlListCmdAdd,
-    EAPControlListCmdRemove,
-    EAPControlListCmdExit
-    };
-    
-enum { KMaxApnNameWitoutLabelLength = 99 }; //MaxApnName - 1
-    
-#endif      //  APCONTROLLISTUI_HRH
-
-// End of File
--- a/accesspointcontrol/apcontrollistplugin/inc/apcontrollistplugincontainer.h	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +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:  
-*     Container class for APControl list plugin.
-*
-*/
-
-
-#ifndef APCONTROLLIST_PLUGIN_CONTAINER_H
-#define APCONTROLLIST_PLUGIN_CONTAINER_H
-
-// INCLUDES
-#include <coeccntx.h>
-#include <eikclb.h>
-
-// FORWARD DECLARATIONS
-class CApControlListbox;
-class CAknNavigationDecorator;
-class CAknNavigationControlContainer;
-class CAPControlListPlugin;
-class MEikListBoxObserver;
-class CApControlListboxModel;
-
-// UID of general settings app, in which help texts are included
-const   TUid    KHelpUidAPControlList = { 0x100058EC };
-
-
-// CLASS DECLARATION
-
-/**
-*  CAPControlListPluginContainer container class
-*  container class for APControl list plugin 
-*/
-class CAPControlListPluginContainer : public CCoeControl
-    {
-    
-    public: 
-        
-        /**
-        * Symbian OS constructor.
-        *
-        * @param aRect Listbox's rect.
-        * @param aListObserver pointer to the list observer
-        */
-        void ConstructL( const TRect& aRect, 
-                         MEikListBoxObserver* aListObserver );
-
-        /**
-        * Destructor.
-        */
-        ~CAPControlListPluginContainer();
-    
-    public: // From CCoeControl
-    
-        /**
-        * From CCoeControl, gives back the count of contained controls.
-        */
-        virtual TInt CountComponentControls() const;
-
-        /**
-        * From CCoeControl, gives back the given indexed 
-        * from contained controls.
-		* @param aIndex index
-        */        
-        CCoeControl* ComponentControl( TInt aIndex ) const;
-
-        /**
-        * From CCoeControl, resizes the contained controls.
-        */
-        virtual void SizeChanged();
-        
-        /**
-        * From CCoeControl, processes the given key event.
-	    * @param aKeyEvent The key event that occured.
-		* @param aType The type of key event that occured.
-	    * @return @c EKeyWasConsumed if the event was processed,
-        */
-        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
-                                     TEventCode aType );
-    
-        /** 
-        * From CCoeControl, gets the control's help context.
-     	* @param aContext help context.
-        */
-        virtual void GetHelpContext( TCoeHelpContext& aContext ) const;
-        
-        /**
-        * From CCoeControl, used for sclable ui and landscape support.
-     	* @param aType A message UID value.
-        */        
-        void HandleResourceChange( TInt aType );
-          
-        /**
-        * From CoeControl,SizeChanged.
-        * @param aDrawNow Contains the value that was passed to it by 
-        *        @c SetFocus(). 
-        */        
-        virtual void FocusChanged(TDrawNow aDrawNow);  
-        
-        /**
-        * Adds to the ListBox
-        * @param newItem new item.
-        */        
-        void AddToListBoxL(TPtrC& newItem);              
-        
-        /**
-        * Sets Current Item Index in the ListBox
-        * @param index Current item index.
-        */        
-		void SetCurrentItemIndex(TInt index);
-		
-        /**
-        * Gets current item index
-        * @return Current item index in the ListBox
-        */        
-		TInt CurrentItemIndex();
-		
-        /**
-        * Removes current item from ListBox
-        */        
-		void RemoveFromListBoxL();
-		
-        /**
-        * Gets the number of items in the list
-        * @return the number of items in the list
-        */
-        TInt NumberOfItems() const;
-		
-        /**
-        * Writes text with ID to the NaviPane
-        */
-        void WriteToNaviPaneL( TInt aResourceId );
-        
-    private:
-
-        /**
-        * Sets the title pane to the appropriate text.
-        * @param aResourceId Resource id of the showed text .
-        */
-        void TitlePaneTextsL( TInt aResourceId );
-
-    public:
-        
-        //@var Listbox  - owned
-        CApControlListbox* 				iListBox;
-        //@var Model for the listbox  - owned
-        CApControlListboxModel*     	iModel;
-
-    private:
-    
-        //@var For NaviPane. - owned
-        CAknNavigationDecorator* 		iNaviDecorator;
-
-        //@var For NaviPane. - owned
-        CAknNavigationControlContainer* iNaviPane;
-        
-    };
-
-#endif //APCONTROLLIST_PLUGIN_CONTAINER_H   
--- a/accesspointcontrol/apcontrollistplugin/inc/apcontrollistpluginlogger.h	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,155 +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: 
-*      Logging macros for APControl List Plugin
-*
-*/
-
-
-#ifndef APCONROL_LIST_PLUGIN_LOGGER_H
-#define APCONROL_LIST_PLUGIN_LOGGER_H
-
-// INCLUDES
-
-#ifdef _DEBUG
-    #include <e32std.h>
-    #include <e32def.h>
-    #include <flogger.h>
-
-    // TYPES
-
-    enum TAPControlListPluginLogMask             ///< Log mask bits.
-        {
-        ELogOff         = 0x00000000,   ///< Don't log.
-        EApUi           = 0x00000001,   ///< Log transaction activity.
-        ESelector       = 0x00000002,   ///< Log Selection activity.
-        EEditing        = 0x00000004,   ///< Log editing activity.
-        EModel          = 0x00000008,   ///< Log model activity.
-
-        EProtection     = 0x00000020,   ///< Log protection activity.
-        EApItem         = 0x00000040,   ///< Log ApItem activity.
-        ECommons        = 0x00000080,   ///< Log transaction activity.
-        EActiveDb       = 0x000000F0,   ///< Log active db&notific. activity.
-        ELogAll         = 0xFFFFFFFF    ///< Log all.
-        };
-
-    // MACROS
-
-    /// Determines what to log. Construct this from TApEngineLogMask values.
-    #define APCONTROL_LIST_LOG_MASK ELogAll
-    /// Determines log detail (0==basic level).
-    #define APCONTROL_LIST_LOG_LEVEL 4
-
-    // CLASS DECLARATION
-
-    /**
-    * Logger class.
-    */
-NONSHARABLE_CLASS( APControlListPluginLogger )
-        {
-        public:     // new methods
-
-        /**
-        * Write formatted log.
-        * @param aMask Log mask.
-        * @param aLevel Log level.
-        * @param aFmt Format string.
-        */
-        static void Write
-            ( TInt32 aMask, TInt aLevel, 
-              TRefByValue<const TDesC16> aFmt, ... );
-
-        /**
-        * Write formatted log.
-        * @param aMask Log mask.
-        * @param aLevel Log level.
-        * @param aFmt Format string.
-        * @param aList Variable argument list.
-        */
-        static void Write
-            (
-            TInt32 aMask,
-            TInt aLevel,
-            TRefByValue<const TDesC16> aFmt,
-            VA_LIST& aList
-            );
-
-        /**
-        * Write formatted log.
-        * @param aMask Log mask.
-        * @param aLevel Log level.
-        * @param aFmt Format string.
-        */
-        static void Write
-            ( TInt32 aMask, TInt aLevel, 
-              TRefByValue<const TDesC8> aFmt, ... );
-
-        /**
-        * Write formatted log.
-        * @param aMask Log mask.
-        * @param aLevel Log level.
-        * @param aFmt Format string.
-        * @param aList Variable argument list.
-        */
-        static void Write
-            (
-            TInt32 aMask,
-            TInt aLevel,
-            TRefByValue<const TDesC8> aFmt,
-            VA_LIST& aList
-            );
-
-        /**
-        * Write hex dump.
-        * @param aMask Log mask.
-        * @param aLevel Log level.
-        * @param aHeader Header string.
-        * @param aMargin Margin.
-        * @param aPtr Data.
-        * @param aLen Data length.
-        */
-        static void HexDump
-            (
-            TInt32 aMask,
-            TInt aLevel, 
-            const TText* aHeader,
-            const TText* aMargin,
-            const TUint8* aPtr,
-            TInt aLen
-            );
-
-        /**
-        * Create log dir.
-        */
-		static void FCreate();
-        };
-
-
-	#define CLOG_CREATE()  {APControlListPluginLogger::FCreate();}
-    /// Write formatted to log.
-    #define CLOG( body ) APControlListPluginLogger::Write body
-    /// Write hex dump.
-    #define CDUMP( body ) APControlListPluginLogger::HexDump body
-
-#else /* not defined _DEBUG */
-
-    /// Do nothing (log disabled).
-    #define CLOG( body )
-    /// Do nothing (log disabled).
-    #define CDUMP( body )
-	#define CLOG_CREATE()
-
-#endif /* def _DEBUG */
-
-#endif /* def APCONROL_LIST_PLUGIN_LOGGER_H */
--- a/accesspointcontrol/apcontrollistplugin/loc/apcontrollistplugin.loc	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +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: 
-*        Localization strings for Plugin
-*
-*/
-
-
-//  LOCALISATION STRINGS
-
-//d:Text of a list item in Connection view's list
-//d:Item opens APN control list view
-//l:list_single_large_graphic_pane_t1 
-//r:3.1
-//
-#define qtn_acl_menu_item "Access point name (APN) control list"
-
-
-//d:Title pane text of the APN control list view
-//l:title_pane_t2/opt12
-//r:3.1
-//
-#define qtn_acl_title "APN control list"
-
-//d:Text of the wait window while the program reads the info from the SIM card
-//l:popup_note_wait_window
-//r:3.1
-//
-#define qtn_acl_wait_reading_sim "Reading info from SIM card"
-
-//d:Text in a note window
-//l:popup_note_window
-//r:3.1
-//
-#define qtn_acl_info_not_active "APN control list not active"
-
-//d:Text in a note window
-//l:popup_note_window
-//r:3.1
-//
-#define qtn_acl_info_active "APN control list is activated"
-
-//d:Text in the navi text pane pane when the control is not active
-//l:navi_text_pane_t1   
-//r:3.1
-//
-#define qtn_acl_navi_not_active "Control not active"
-
-//d:Text in the navi text pane pane when the control is active
-//l:navi_text_pane_t1   
-//r:3.1
-//
-#define qtn_acl_navi_active "Control active"
-
-//d:This is the text in the ABC column when when the list is empty
-//l:main_pane_empty_t1/opt2
-//r:3.1
-//
-#define qtn_acl_empty_view_primary "(no APNs)"
-
-//d:This is the secondary text in the ABC column when when the list is empty
-//l:main_list_empty_pane/opt2
-//r:3.1
-//
-#define qtn_acl_empty_view_secondary "Select Add APN from Options menu to add it to control list" 
-
-//d:Command in options menu.
-//d:Activates the currently selected list item.
-//l:list_single_pane_t1_cp2
-//r:3.1
-//
-#define qtn_acl_options_activate_control "Activate control"
-
-//d:Command in options menu.
-//d:Deactivates the currently selected list item.
-//l:list_single_pane_t1_cp2
-//r:3.1
-//
-#define qtn_acl_options_deactivate_control "Deactivate control"
-
-//d:If the APN control list is activated
-//d:this note is displayed.
-//l:popup_note_window
-//r:3.1
-//
-#define qtn_acl_conf_control_activated "APN control list activated"
-
-//d:If the APN control list is deactivated
-//d:this note is displayed.
-//l:popup_note_window
-//r:3.1
-//
-#define qtn_acl_conf_control_deactivated "APN control list deactivated"
-
-//d:Command in options menu.
-//d:Adds an APN manually
-//l:list_single_pane_t1_cp2
-//r:3.1
-//
-#define qtn_acl_options_add_apn_manually "Add APN manually"
-
-//d:Text in data query window
-//d:text of the data query window with wich is possible to add APN manually
-//l:popup_query_data_window
-//r:3.1
-//
-#define qtn_acl_prmpt_apn_to_add "APN to add:"
-
-//d:Text in the popup window whics comes up when the APN is
-//d:added to the control list
-//l:popup_note_window
-//r:3.1
-//
-#define qtn_acl_conf_apn_added "APN '%U' added to control list"
-
-//d:Text in the popup window whics comes up when a Network-provided APN is
-//d:added to the control list
-//l:popup_note_window
-//r:3.1
-//
-#define qtn_acl_conf_nw_provided_apn_added "Network-provided APN added to control list"
-
-//d:Command in options menu.
-//d:Removes currently selected list item from the list.
-//l:list_single_pane_t1_cp2
-//r:3.1
-//
-#define qtn_acl_options_remove "Remove"
-
-//d:Text in the popup window whics comes up when
-//d:the APN is removed from list
-//l:popup_note_window
-//r:3.1
-//
-#define qtn_acl_conf_apn_removed "APN removed from list"
-
-//d:APN name for network-provided APN in the list
-//l:list_single_pane_t1
-//r:3.1
-//
-#define qtn_acl_network_provided_apn "Network-provided APN"
-
-//d:Text in a note window
-//l:popup_note_window
-//r:3.1
-//
-#define qtn_acl_err_invalid_input "Invalid input value"
-
-// End of File
-
-
--- a/accesspointcontrol/apcontrollistplugin/rom/APControlListPlugin.iby	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +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:  Image description file for project APControlListPlugin
-*
-*/
-
-
-#ifndef __APControlListPLUGIN_IBY__
-#define __APControlListPLUGIN_IBY__
-
-#ifdef __PROTOCOL_WCDMA
-#ifdef _DEBUG
-ECOM_PLUGIN_UDEB(APControlListPlugin.DLL,10281BB4.rsc)
-SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,APControlListplugin)
-#else
-ECOM_PLUGIN(APControlListPlugin.DLL,10281BB4.rsc)
-SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,APControlListplugin)
-#endif
-#endif //__PROTOCOL_WCDMA
-
-#endif __APControlListPLUGIN_IBY__
\ No newline at end of file
--- a/accesspointcontrol/apcontrollistplugin/rom/APControlListPluginResources.iby	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +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:  Image description file for project APControlListPlugin
-*
-*/
-
-
-#ifndef __APControlListPLUGIN_RESOURCES_IBY__
-#define __APControlListPLUGIN_RESOURCES_IBY__
-
-#ifdef __PROTOCOL_WCDMA
-data=DATAZ_\RESOURCE_FILES_DIR\APControlListPluginRsc.rsc RESOURCE_FILES_DIR\APControlListPluginRsc.rsc
-#endif //__PROTOCOL_WCDMA
-
-#endif __APControlListPLUGIN_RESOURCES_IBY__
\ No newline at end of file
--- a/accesspointcontrol/apcontrollistplugin/src/apcontrollistapiwrapper.cpp	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,709 +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:  Class for asyncron calls.
-*
-*/
-
-// INCLUDE FILES
-#include <AknQueryDialog.h>
-#include <rmmcustomapi.h>
-#include <etelmm.h>
-#include <apcontrollistpluginrsc.rsg>
-#include <errorres.rsg>
-#include <StringLoader.h>
-#include <aknnotewrappers.h> 
-
-#include "apcontrollistapiwrapper.h"
-#include "apcontrollistpluginlogger.h"
-#include "apcontrollistplugincontainer.h"
-#include "apcontrollistplugin.h"
-#include "apcontrollistbox.h"
-#include "centralrepository.h"
-#include "CoreApplicationUIsSDKCRKeys.h"
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// ----------------------------------------------------------------------------- 
-// CAPControlListAPIWrapper::CAPControlListAPIWrapper
-// Description: CAPControlListAPIWrapper constructer 
-// ----------------------------------------------------------------------------- 
-//
-CAPControlListAPIWrapper::CAPControlListAPIWrapper(
-							CAPControlListPlugin& aPlugin, TInt aPriority ) : 
-											CActive( aPriority ), 
-											iPlugin(aPlugin),
-											iApnPKG(iApn)
-	{
-	CActiveScheduler::Add( this ); 
-	}
-
-//
-//----------------------------------------------------------------------------- 
-// CAPControlListAPIWrapper:: CAPControlListAPIWrapper
-// Description: CAPControlListAPIWrapper Destructer
-// ----------------------------------------------------------------------------- 
-// 
-CAPControlListAPIWrapper::~CAPControlListAPIWrapper()
-	{
-    CLOG( ( ESelector, 0, _L( 
-    			"-> CAPControlListAPIWrapper::~CAPControlListAPIWrapper" ) ) );
-	Cancel();
-	iCustomAPI.Close();
-	iPhone.Close();
-	iServer.Close();
-	delete iAPN;
-    CLOG( ( ESelector, 0, _L( 
-    			"<- CAPControlListAPIWrapper::~CAPControlListAPIWrapper" ) ) );
-	}
-
-//
-//----------------------------------------------------------------------------- 
-// CAPControlListAPIWrapper::RequestFunction
-// Description: Request Function for CAPControlListAPIWrapper 
-// ---------------------------------------------------------------------------- 
-//
-void CAPControlListAPIWrapper::SecurityCheck(TRequestType aRequest) 
-	{
-    CLOG( ( ESelector, 0, _L( 
-    			"-> CAPControlListAPIWrapper::SecurityCheck" ) ) );
-	if( !IsActive() )
-		{
-		iCustomAPI.CheckSecurityCode (iStatus, 
-								RMmCustomAPI::ESecurityCodePin2 ); 	 	
-		iRequest = aRequest;	
-		SetActive();
-		}
-    CLOG( ( ESelector, 0, _L( 
-    			"<- CAPControlListAPIWrapper::SecurityCheck" ) ) );
-	}
-
-
-//
-//----------------------------------------------------------------------------- 
-// CAPControlListAPIWrapper::DoCancel
-// Description: This is called from CActive's Cancel 
-//----------------------------------------------------------------------------- 
-//
-void CAPControlListAPIWrapper::DoCancel()
-	{
-    CLOG( ( ESelector, 0, _L( 
-    			"-> CAPControlListAPIWrapper::DoCancel" ) ) );
-	CLOG( ( ESelector, 0, _L( "Current request: %d" ), iRequest ) );
-	switch(iRequest)
-	{
-	case EEnumerateAPN: 
-        iPhone.CancelAsyncRequest(EMobilePhoneEnumerateAPNEntries);
-	    break; 
-	case EReadData: 
-        iPhone.CancelAsyncRequest(EMobilePhoneGetAPNname);
-	    break;
-	    
-	// Since there are no enums for these, can't cancel  
-	case EAddAPNSecurity:
-	case EAddAPN:
-	case ERemoveAPNSecurity:
-	case ERemoveAPN: 
-	case EActivateACLSecurity:
-	case EActivateACL: 
-	case EDeactivateACLSecurity:
-	case EDeactivateACL:
-	    break; 	
-	 
-	case ENoRequest: // no active request
-	    break; 	
-	default:
-		// This could be only in case of programming error
-		CLOG( ( ESelector, 0, _L( "State Error: %d" ), iRequest ) );
-	    break;
-	}
-    CLOG( ( ESelector, 0, _L( 
-    			"<- CAPControlListAPIWrapper::DoCancel" ) ) );
-	}
-
-//
-//----------------------------------------------------------------------------- 
-// CAPControlListAPIWrapper::FinishReadDataL
-// Description: Case EReadData in RunL  
-//----------------------------------------------------------------------------- 
-//
-void CAPControlListAPIWrapper::FinishReadDataL()
-	{
-    CLOG( ( ESelector, 0, _L( 
-    			"-> CAPControlListAPIWrapper::FinishReadDataL" ) ) );
-	if (iIndex > 0)
-		{
-		iApn = iApnPKG();
-		// lablel lengthes must be replaced with dots and  
-	    // removed from the beginnig
-	    if ( iApn.iApn.Length() )
-    	    {
-    	    TUint8 lablelLength	= (TUint8)(iApn.iApn[0]);
-    	    TUint8 wholeLength	= lablelLength;
-    	    iApn.iApn.Delete(0,1);
-    	    while (iApn.iApn.Length() > wholeLength)
-    	        {
-    	        wholeLength = wholeLength + 
-    	            (TUint8)(iApn.iApn[lablelLength]) + 1;
-    	        iApn.iApn[lablelLength] = '.';
-    	        lablelLength = wholeLength;//place of next dot
-    	        }	        
-		    HBufC* buf = HBufC::NewLC( RMobilePhone::KMaxApnName );
-		    buf->Des().Copy( iApn.iApn );
-		    TPtrC itemPtr(buf->Des());
-			iPlugin.Container()->AddToListBoxL(itemPtr);			
-		    CleanupStack::PopAndDestroy( buf );
-    	    }
-	    else
-	        {
-			// Empty APN means network provided APN
-    		HBufC* buf = StringLoader::LoadLC ( 
-    							R_QTN_ACL_NETWORK_PROVIDED_APN );
-    		TPtrC nPtr(buf->Des());
-			iPlugin.Container()->AddToListBoxL(nPtr);			
-		    CleanupStack::PopAndDestroy( buf );
-	        }
-		}
-	if (iIndex < iSize)
-		{
-		DoReadData();
-		iIndex++;
-		}
-	else
-		{
-		iRequest = ENoRequest;			
-		if ( iSize > 0 )
-			{
-			iPlugin.Container()->SetCurrentItemIndex(0);    		
-			}				
-		}
-    CLOG( ( ESelector, 0, _L( 
-    			"<- CAPControlListAPIWrapper::FinishReadDataL" ) ) );
-	}
-
-//
-//----------------------------------------------------------------------------- 
-// CAPControlListAPIWrapper::RunL 
-// Description: CActive::RunL implementation which will either stop the
-// Scheduler or increment the count
-//----------------------------------------------------------------------------- 
-//
-void CAPControlListAPIWrapper::RunL()
-	{
-	if ( iStatus != KErrNone )
-		{
-		CLOG( ( ESelector, 0, _L( "Bad RequestStatus: %d for request: %d" ), 
-													iStatus.Int(), iRequest) );	    
-
-		// KErrOverflow can occur during APN adding process, if the APN list is full
-		// or there is no space for an additional entry in SIM card.
-	    if( iStatus.Int() == KErrOverflow && iRequest == EAddAPN)
-	        {
-            HBufC* text = StringLoader::LoadLC ( 
-                R_QTN_ACL_ERR_SIM_CARD );
-            CAknErrorNote* note = new ( ELeave ) CAknErrorNote(
-                 ETrue );
-            note->ExecuteLD( *text );
-
-            CleanupStack::PopAndDestroy( text );
-	        }
-	    
-	    iRequest = ENoRequest;  
-
-		return;
-		}
-	switch(iRequest)
-	{
-	case EGetACLStatus:
-	    {
-		CLOG( ( ESelector, 0, _L( "EGetACLStatus OK" ) ) );
-#ifdef _DEBUG
-    	if (iAclStatus == RMobilePhone::EAPNControlListServiceEnabled)
-    		{		
-        	CLOG( ( ESelector, 0, _L( "iAclStatus == EAclStatusEnabled" ) ) );
-    		}
-    	else if (iAclStatus == RMobilePhone::EAPNControlListServiceDisabled)
-    		{		
-        	CLOG( ( ESelector, 0, _L( "iAclStatus == EAclStatusDisabled" ) ) );
-    		}
-    	else
-    		{		
-        	CLOG( ( ESelector, 0, _L( "iAclStatus is bad!!!" ) ) );
-    		}
-#endif 		    
-		if ( Enabled() )
-			{
-		    iPlugin.ShowInfoNoteL(R_QTN_ACL_INFO_ACTIVE);
-		    iPlugin.Container()->WriteToNaviPaneL(R_QTN_ACL_NAVI_ACTIVE);
-			}
-		else
-			{
-		    iPlugin.ShowInfoNoteL(R_QTN_ACL_INFO_NOT_ACTIVE);
-		    iPlugin.Container()->WriteToNaviPaneL(R_QTN_ACL_NAVI_NOT_ACTIVE);
-			}
-        EnumerateAPN();
-	    break; 	        
-	    }
-	case EAddAPNSecurity:
-		CLOG( ( ESelector, 0, _L( "EAddAPNSecurity OK" ) ) );
-		iSecurityChecked = ETrue;
-		DoAddAPNL();
-	    break; 
-	case EAddAPN:
-	    {
-		iRequest = ENoRequest;	
-		CLOG( ( ESelector, 0, _L( "EAddAPN OK" ) ) );
-        TPtrC tptrc(iAPN->Des());
-		if (tptrc.Length())
-			{
-	    	iPlugin.Container()->AddToListBoxL(tptrc);        
-			iPlugin.ShowConfirmNoteAPNL(R_QTN_ACL_CONF_APN_ADDED, tptrc);
-			}
-		else
-			{
-			HBufC* buf = StringLoader::LoadLC ( 
-						R_QTN_ACL_NETWORK_PROVIDED_APN );
-			TPtrC itemPtr(buf->Des());
-			iPlugin.Container()->AddToListBoxL(itemPtr);			
-			CleanupStack::PopAndDestroy( buf );
-			iPlugin.ShowConfirmNoteL(R_QTN_ACL_CONF_NWP_APN_ADDED);
-			}
-	    break; 	        
-	    } 
-	case ERemoveAPNSecurity:
-		CLOG( ( ESelector, 0, _L( "ERemoveAPNSecurity OK" ) ) );
-		iSecurityChecked = ETrue;
-		DoRemoveAPN();
-	    break; 
-	case ERemoveAPN: 
-		iRequest = ENoRequest;	
-		CLOG( ( ESelector, 0, _L( "ERemoveAPN OK" ) ) );
-		iPlugin.ShowConfirmNoteL(R_QTN_ACL_CONF_APN_REMOVED);	
-		iPlugin.Container()->RemoveFromListBoxL();    			
-	    break; 
-	case EActivateACLSecurity:
-		CLOG( ( ESelector, 0, _L( "EActivateACLSecurity OK" ) ) );
-		iSecurityChecked = ETrue;
-		SetACLStatus( RMobilePhone::EAPNControlListServiceEnabled );
-	    break; 
-	case EActivateACL: 
-		iRequest = ENoRequest;	
-		CLOG( ( ESelector, 0, _L( "EActivateACL OK" ) ) );
-		iAclStatus = RMobilePhone::EAPNControlListServiceEnabled;
-		iPlugin.ShowConfirmNoteL(R_QTN_ACL_CONF_CONTROL_ACTIVATED);	
-		iPlugin.Container()->WriteToNaviPaneL(R_QTN_ACL_NAVI_ACTIVE);
-	    break; 
-	case EDeactivateACLSecurity:
-		CLOG( ( ESelector, 0, _L( "EDeactivateACLSecurity OK" ) ) );
-		iSecurityChecked = ETrue;
-		SetACLStatus( RMobilePhone::EAPNControlListServiceDisabled );
-	    break; 
-	case EDeactivateACL: 
-		iRequest = ENoRequest;	
-		CLOG( ( ESelector, 0, _L( "EDeactivateACL OK" ) ) );
-		iAclStatus = RMobilePhone::EAPNControlListServiceDisabled;
-		iPlugin.ShowConfirmNoteL(R_QTN_ACL_CONF_CONTROL_DEACTIVATED);	
-		iPlugin.Container()->WriteToNaviPaneL(R_QTN_ACL_NAVI_NOT_ACTIVE);
-	    break; 
-	case EEnumerateAPN: 
-		CLOG( ( ESelector, 0, _L( "EEnumerateAPN OK" ) ) );
-		iRequest = EReadData;	
-		FinishReadDataL();
-	    break; 
-	case EReadData: 
-		CLOG( ( ESelector, 0, _L( "EReadData OK" ) ) );
-		FinishReadDataL();
-	    break; 
-	default:
-		{
-		// This could be only in case of programming error
-		CLOG( ( ESelector, 0, _L( "State Error: %d" ), iRequest ) );
-		User::Leave(KErrGeneral);			
-		}
-	    break;
-	}
-	}
-	
-
-// ---------------------------------------------------------
-// CAPControlListAPIWrapper::DoReadData
-// ---------------------------------------------------------
-void CAPControlListAPIWrapper::DoReadData() 
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListAPIWrapper::ReadData2" ) ) );
-	if( !IsActive() )
-		{
-		iRequest = EReadData;			
-		iApn.iApn.Zero();
-		iApn.iApn.SetMax();
-		iPhone.GetAPNname(iStatus, iIndex, iApnPKG);
-		SetActive();
-		}    
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListAPIWrapper::ReadData2" ) ) );
-    }
-// ---------------------------------------------------------
-// CAPControlListAPIWrapper::ReadData
-// ---------------------------------------------------------
-void CAPControlListAPIWrapper::ReadData() 
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListAPIWrapper::ReadData" ) ) );
-	if( !IsActive() )
-		{
-		iRequest = EGetACLStatus;			
-	    iPhone.GetAPNControlListServiceStatus( iStatus, iAclStatus );
-		SetActive();
-		}    
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListAPIWrapper::ReadData" ) ) );
-    }
-// ---------------------------------------------------------
-// CAPControlListAPIWrapper::ReadData
-// ---------------------------------------------------------
-void CAPControlListAPIWrapper::EnumerateAPN() 
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListAPIWrapper::ReadData" ) ) );
-	if( !IsActive() )
-		{
-		iRequest = EEnumerateAPN;			
-		iIndex = 0;
-		iPhone.EnumerateAPNEntries(iStatus, iSize);
-		SetActive();
-		}    
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListAPIWrapper::ReadData" ) ) );
-    }
-    
-// ---------------------------------------------------------
-// CAPControlListAPIWrapper::DeActivateACLL()
-// ---------------------------------------------------------
-//
-void CAPControlListAPIWrapper::DeActivateACL()
-    {   	
-    CLOG( ( ESelector, 0, _L( 
-    			"-> CAPControlListAPIWrapper::DeActivateACLL" ) ) );
-	if (iSecurityChecked)
-		{
-		SetACLStatus( RMobilePhone::EAPNControlListServiceDisabled );
-		}
-	else
-		{
-		SecurityCheck(EDeactivateACLSecurity);
-		}
-    
-    CLOG( ( ESelector, 0, _L( 
-    			"<- CAPControlListAPIWrapper::DeActivateACLL" ) ) );
-    }
-
-// ---------------------------------------------------------
-// CAPControlListAPIWrapper::ActivateACLL()
-// ---------------------------------------------------------
-//
-void CAPControlListAPIWrapper::ActivateACL()
-    {   	
-    CLOG( ( ESelector, 0, _L( 
-    			"-> CAPControlListAPIWrapper::ActivateACLL" ) ) );
-	if (iSecurityChecked)
-		{
-		SetACLStatus( RMobilePhone::EAPNControlListServiceEnabled );
-		}
-	else
-		{
-		SecurityCheck(EActivateACLSecurity);
-		}
-    
-    CLOG( ( ESelector, 0, _L( 
-    			"<- CAPControlListAPIWrapper::ActivateACLL" ) ) );
-    }
-
-// ---------------------------------------------------------
-// CAPControlListAPIWrapper::SetACLStatus()
-// ---------------------------------------------------------
-//
-void CAPControlListAPIWrapper::SetACLStatus( const 
-    RMobilePhone::TAPNControlListServiceStatus aAPNControlListServiceStatus )
-    {   	
-    CLOG( ( ESelector, 0, 
-    				_L( "-> CAPControlListAPIWrapper::SetACLStatus" ) ) );
-	if( !IsActive() )
-		{
-   		iPhone.SetAPNControlListServiceStatus( iStatus, 
-   		                    aAPNControlListServiceStatus );
-		if ( aAPNControlListServiceStatus == 
-		        RMobilePhone::EAPNControlListServiceEnabled )
-			{
-			iRequest = EActivateACL;			
-			}
-		else
-			{
-			iRequest = EDeactivateACL;			
-			}
-		SetActive();
-		}    
-    CLOG( ( ESelector, 0, _L( 
-    					"<- CAPControlListAPIWrapper::SetACLStatus" ) ) );
-    }
-
-
-// ---------------------------------------------------------
-// CAPControlListAPIWrapper::RemoveAPN()
-// ---------------------------------------------------------
-//
-void CAPControlListAPIWrapper::RemoveAPN()
-    {   	
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListAPIWrapper::RemoveAPNL" ) ) );
-    if( iPlugin.Container()->NumberOfItems() > 0)
-        {
-    	if (iSecurityChecked)
-    		{
-    		DoRemoveAPN();
-    		}
-    	else
-    		{
-    		SecurityCheck(ERemoveAPNSecurity);
-    		}
-        }
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListAPIWrapper::RemoveAPNL" ) ) );
-    }
-
-// ---------------------------------------------------------
-// CAPControlListAPIWrapper::DoRemoveAPN()
-// ---------------------------------------------------------
-//
-void CAPControlListAPIWrapper::DoRemoveAPN()
-    {   	
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListAPIWrapper::RemoveAPN2L" ) ) );
-	if( !IsActive() )
-		{
-		TInt index = iPlugin.Container()->CurrentItemIndex();
-		iPhone.DeleteAPNName( iStatus, index );
-		iRequest = ERemoveAPN;
-		SetActive();
-		}    
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListAPIWrapper::RemoveAPN2L" ) ) );
-    }
-
-// ---------------------------------------------------------
-// CAPControlListAPIWrapper::AddAPNL()
-// ---------------------------------------------------------
-//
-void CAPControlListAPIWrapper::AddAPNL()
-    {   	
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListAPIWrapper::AddAPNL" ) ) );
-	if (iSecurityChecked)
-		{
-		DoAddAPNL();
-		}
-	else
-		{
-		SecurityCheck(EAddAPNSecurity);
-		}
-    
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListAPIWrapper::AddAPNL" ) ) );
-    }
-
-// ---------------------------------------------------------
-// CAPControlListAPIWrapper::DoAddAPNL()
-// ---------------------------------------------------------
-//
-void CAPControlListAPIWrapper::DoAddAPNL()
-    {   	
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListAPIWrapper::DoAddAPNL" ) ) );
-	if( !IsActive() )
-		{
-		delete iAPN;
-		iAPN = NULL;
-		iAPN = HBufC::NewL( RMobilePhone::KMaxApnName );
-	    TPtr16 ptr( iAPN->Des() );		    
-	    CAknQueryDialog* dlg = 
-	                CAknQueryDialog::NewL( ptr, CAknQueryDialog::ENoTone );
-	       
-	    TBool notCanceled = EFalse;
-	    
-	    // Ask the user until either the input is valid or canceled
-	    while ( dlg->ExecuteLD( R_APN_NAME_QUERY ) )
-	        {
-	        
-	        TBool validInput = ETrue;
-	        
-            for (TInt index = 0; index < ptr.Length(); index++)
-                {
-                TChar inputchar = ptr[index];
-                // For ACL only 0-9, A-Z, a-z, '-' and '.' are valid
-                if (! ( ('0' <= inputchar && inputchar <= '9') ||
-                        ('A' <= inputchar && inputchar <= 'Z') ||
-                        ('a' <= inputchar && inputchar <= 'z') ||
-                        inputchar == '-' || inputchar == '.' ) )
-                    {
-                    validInput = EFalse;
-                    break;
-                    }
-                }
-            
-	        if ( validInput )
-		        {
-		        notCanceled =  ETrue;
-		        break;
-		        }
-		    else
-    		    {
-                HBufC* text = StringLoader::LoadLC ( 
-                    R_QTN_ACL_ERR_INVALID_INPUT );
-                CAknErrorNote* note = new ( ELeave ) CAknErrorNote(
-                     ETrue );
-                note->ExecuteLD( *text );
-
-                CleanupStack::PopAndDestroy( text );
-                
-                dlg = 
-	                CAknQueryDialog::NewL( ptr, CAknQueryDialog::ENoTone );
-	            
-    		    }
-	        }
-	        
-	    if ( notCanceled )
-		    {
-		   
-		    // lablel lengthes must be added in place of dots and at the 
-		    // beginnig
-            _LIT8(KFormat,"%c%S"); 
-		    iApn.iApn.SetMax();
-		    iApn.iApn.Zero();		    
-            if ( iAPN->Length() )
-                {
-    	    	TBufC8<RMobilePhone::KMaxApnName> buffer;
-    	    	TBufC8<RMobilePhone::KMaxApnName> buffer2;
-    	    	buffer.Des().Copy( iAPN->Des() );
-    	    	TInt index = buffer.Des().Find(_L8("."));
-    	    	
-    	    	while (index != KErrNotFound)
-        	    	{
-       	    	    buffer2.Des().Copy( buffer.Des().Left( index ) );
-                    TPtr8 tmp = buffer2.Des();
-    			    iApn.iApn.AppendFormat(KFormat, index, &tmp);
-    			    buffer.Des().Delete(0,index+1);
-    			    index = buffer.Des().Find(_L8("."));
-        	    	}
-       	        TPtr8 tmp = buffer.Des();
-    			iApn.iApn.AppendFormat(KFormat, buffer.Length(), &tmp);               
-                }
-            else
-                {
-		        _LIT8(KEmpty8,""); 
-		        iApn.iApn.Copy(KEmpty8);                    
-                }
-            
-	        CLOG( ( ESelector, 0, _L( "Size: %d" ), iApn.iApn.Size() ) );
-	    	iPhone.AppendAPNName( iStatus, iApnPKG );
-	    	
-			iRequest = EAddAPN;
-			SetActive();
-		    }		
-		}    
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListAPIWrapper::DoAddAPNL" ) ) );
-    }
-
-// ---------------------------------------------------------
-// CAPControlListAPIWrapper::Visible
-// ---------------------------------------------------------
-TBool CAPControlListAPIWrapper::Visible() const
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListAPIWrapper::Visible" ) ) );    
-    if (!iConnAllowed)
-        {
-		return EFalse; // phone is in off-line mode            
-        }
-	TUint32 aCaps;	  
-	iPhone.GetIccAccessCaps(aCaps);
-	CLOG( ( ESelector, 0, _L( "%d" ),  aCaps) );
-	if (aCaps & RMobilePhone::KCapsUSimAccessSupported)
-		{		
-		CLOG( ( ESelector, 0, _L( 
-						"<- CAPControlListAPIWrapper::Visible 2" ) ) );
-		return ETrue;
-		}
-	else
-		{			
-		CLOG( ( ESelector, 0, _L( 
-						"<- CAPControlListAPIWrapper::Visible 3" ) ) );
-		return EFalse;
-		}
-    }
-// ---------------------------------------------------------
-// CAPControlListAPIWrapper::Enabled
-// ---------------------------------------------------------
-TBool CAPControlListAPIWrapper::Enabled() const
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListAPIWrapper::Enabled" ) ) );
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListAPIWrapper::Enabled" ) ) );
-	if ( iAclStatus == RMobilePhone::EAPNControlListServiceEnabled )
-		{
-		return ETrue;		
-		}
-	else
-		{
-		return EFalse;
-		}		
-    }
-	
-// ---------------------------------------------------------
-// CAPControlListAPIWrapper::ConstructL()
-// ---------------------------------------------------------
-//
-void CAPControlListAPIWrapper::ConstructL()
-    {   	
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListAPIWrapper::ConstructL" ) ) );
-    // init RMobilePhone and RMmCustomAPI
-	_LIT (KTsyName,"phonetsy.tsy");
-	RTelServer::TPhoneInfo info;
-	RPhone::TLineInfo lineInfo;
-	User::LeaveIfError( iServer.Connect() );
-	User::LeaveIfError( iServer.LoadPhoneModule( KTsyName ) );
-	User::LeaveIfError( iServer.GetPhoneInfo( 0, info ) );
-	User::LeaveIfError( iPhone.Open(iServer, info.iName) );	  
-	User::LeaveIfError( iPhone.Initialise() );
-	User::LeaveIfError( iCustomAPI.Open(iPhone) );
-	           		
-	CRepository* aRepository = CRepository::NewL( KCRUidCoreApplicationUIs );
-    aRepository->Get( KCoreAppUIsNetworkConnectionAllowed, iConnAllowed);
-    delete aRepository;
-
-    if (!iAPN)
-		{
-		iAPN = HBufC::NewL( RMobilePhone::KMaxApnName );
-		}
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListAPIWrapper::ConstructL" ) ) );
-    }
-    
-// ----------------------------------------------------------
-// CAPControlListPlugin::NotifyIccAccessCapsChange()
-// ----------------------------------------------------------
-//
-void CAPControlListAPIWrapper::NotifyIccAccessCapsChange(
-							TRequestStatus& aReqStatus, TUint32& aCaps)
-    {
-    CLOG( ( ESelector, 0, 
-        _L( "-> CAPControlListAPIWrapper::NotifyIccAccessCapsChange" ) ) );
-    iPhone.NotifyIccAccessCapsChange( aReqStatus, aCaps );
-    CLOG( ( ESelector, 0, 
-        _L( "<- CAPControlListAPIWrapper::NotifyIccAccessCapsChange" ) ) );
-    }
-// ----------------------------------------------------------
-// CAPControlListPlugin::CancelNotify()
-// ----------------------------------------------------------
-//
-void CAPControlListAPIWrapper::CancelNotify()
-    {
-    CLOG( ( ESelector, 0, 
-        _L( "-> CAPControlListAPIWrapper::CancelNotify" ) ) );
-    iPhone.CancelAsyncRequest(EMobilePhoneNotifyIccAccessCapsChange);
-    CLOG( ( ESelector, 0, 
-        _L( "<- CAPControlListAPIWrapper::CancelNotify" ) ) );
-    }
--- a/accesspointcontrol/apcontrollistplugin/src/apcontrollistbox.cpp	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +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 ApControlListbox.
-*
-*/
-
-
-// INCLUDE FILES
-
-#include <eikclbd.h>
-#include <avkon.mbg>
-#include <aknkeys.h>
-#include <apcontrollistpluginrsc.rsg>
-#include <AknsUtils.h>
-#include <data_caging_path_literals.hrh>
-#include <StringLoader.h>
-
-#include "apcontrollistbox.h"
-#include "apcontrollistboxmodel.h"
-#include "apcontrollistpluginlogger.h"
-#include "apcontrollistplugin.h"
-#include "apcontrollistapiwrapper.h"
-
-// ================= MEMBER FUNCTIONS =======================
-
-
-// ---------------------------------------------------------
-// CApControlListbox::CApControlListbox
-// ---------------------------------------------------------
-//
-CApControlListbox::CApControlListbox() 
-    {
-    CLOG( ( ESelector, 0, 
-        _L( "<-> CApControlListbox::CApControlListbox" ) ) );
-    }
-
-
-// ---------------------------------------------------------
-// CApControlListbox::~CApControlListbox
-// ---------------------------------------------------------
-//
-CApControlListbox::~CApControlListbox()
-    {
-    CLOG( ( ESelector, 0, 
-        _L( "<-> CApControlListbox::~CApControlListbox" ) ) );
-    }
-
-
-// ---------------------------------------------------------
-// CApControlListbox::OfferKeyEventL
-// ---------------------------------------------------------
-//
-TKeyResponse CApControlListbox::OfferKeyEventL
-( const TKeyEvent& aKeyEvent, TEventCode aType )
-    {
-    CLOG( ( ESelector, 0, _L( "-> CApControlListbox::OfferKeyEventL" ) ) );
-
-    TKeyResponse retval ( EKeyWasConsumed );
-
-    if (    aKeyEvent.iCode == EKeyOK &&
-            !( aKeyEvent.iModifiers & EModifierShift )
-       )
-        {
-        // Enter pressed (not Shift-Enter). This will report an
-        // EEnterKeyPressed event sent to the observer (the view), which may
-        // delete this listbox. The code which processes keypresses by
-        // default, will continue (on the already deleted listbox), and
-        // will crash. So we grab this keypress here, and generate the
-        // same event, but after that, quit immediately.
-        ReportListBoxEventL( MEikListBoxObserver::EEventEnterKeyPressed );
-        // By now the listbox may have been deleted.
-        // Do not access it after this point.
-        }
-    else if (    aKeyEvent.iCode == EKeyBackspace )
-        {
-        static_cast<CAPControlListPlugin*>(iListBoxObserver)->APIWrapper()->
-            RemoveAPN();
-        }
-    else
-        {
-        retval = CAknSingleStyleListBox::OfferKeyEventL
-                            ( aKeyEvent, aType );
-        }
-
-    CLOG( ( ESelector, 0, _L( "<- CApControlListbox::OfferKeyEventL" ) ) );
-
-    return retval;
-    }
-
-
-
-// ---------------------------------------------------------
-// CApControlListbox::FocusChanged
-// ---------------------------------------------------------
-//
-void CApControlListbox::FocusChanged( TDrawNow aDrawNow )
-    {
-    CLOG( ( ESelector, 0, _L( "-> CApControlListbox::FocusChanged" ) ) );
-
-    // Do nothing until the listbox is fully constructed
-    // The dialogpage sets the focus before calling ConstructL
-    if ( iView )
-        {
-        CAknSingleStyleListBox::FocusChanged( aDrawNow );
-        }
-
-    CLOG( ( ESelector, 0, _L( "<- CApControlListbox::FocusChanged" ) ) );
-    }
-
-
-// ---------------------------------------------------------
-// CApControlListbox::HandleResourceChange
-// ---------------------------------------------------------
-//
-void CApControlListbox::HandleResourceChange(TInt aType)
-    {
-    CLOG( ( ESelector, 0, _L( 
-    				"-> CApControlListbox::HandleResourceChange" ) ) );
-    if ( aType == KAknsMessageSkinChange )
-        {        CAknSingleStyleListBox::HandleResourceChange( aType );
-        SizeChanged();
-        }    
-        
-    CAknSingleStyleListBox::HandleResourceChange( aType );
-    CLOG( ( ESelector, 0, _L( 
-    				"<- CApControlListbox::HandleResourceChange" ) ) );
-    }
-// ---------------------------------------------------------
-// CApControlListbox::AddToListBoxL
-// ---------------------------------------------------------
-//
-void CApControlListbox::SetListEmptyTextL()
-    {
-    CLOG( ( ESelector, 0, _L( 
-        "-> CApControlListbox::SetListEmptyTextL" ) ) );
-    HBufC* primary = 
-              iEikonEnv->AllocReadResourceLC( R_QTN_ACL_EMPTY_VIEW_PRIMARY );
-//    _LIT( KCmNewLine, "\n" );    
-//    primary->Des().Append( KCmNewLine );    
-    HBufC* secondary = 
-              iEikonEnv->AllocReadResourceLC( R_QTN_ACL_EMPTY_VIEW_SECONDARY );
-    CDesCArrayFlat* items = new (ELeave) CDesCArrayFlat(2);
-    CleanupStack::PushL(items);
-    items->AppendL(primary->Des()); 
-    items->AppendL(secondary->Des());      
-    HBufC* emptyText = 
-          StringLoader::LoadLC( R_TWO_STRING_FOR_EMPTY_VIEW , *items);              
-    View()->SetListEmptyTextL( *emptyText );    
-    CleanupStack::PopAndDestroy( emptyText );
-    CleanupStack::PopAndDestroy( items );
-    CleanupStack::PopAndDestroy( secondary );
-    CleanupStack::PopAndDestroy( primary );
-    
-    CLOG( ( ESelector, 0, _L( 
-        "<- CApControlListbox::SetListEmptyTextL" ) ) );
-    }
-
-// End of File
--- a/accesspointcontrol/apcontrollistplugin/src/apcontrollistboxmodel.cpp	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +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 ApControlListboxModel.
-*
-*/
-
-
-// INCLUDE FILES
-#include <aknlists.h>
-#include <apcontrollistpluginrsc.rsg>
-
-#include "apcontrollistboxmodel.h"
-#include "apcontrollistpluginlogger.h"
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ---------------------------------------------------------
-// CApControlListboxModel::CApControlListboxModel
-// ---------------------------------------------------------
-//
-CApControlListboxModel::CApControlListboxModel()
-:CTextListBoxModel()
-    {
-    CLOG( ( ESelector, 0, _L( 
-    	"-> CApControlListboxModel::CApControlListboxModel" ) ) );
-    CLOG( ( ESelector, 0, _L( 
-    	"<- CApControlListboxModel::CApControlListboxModel" ) ) );
-    }
-
-
-// ---------------------------------------------------------
-// CApControlListboxModel::~CApControlListboxModel
-// ---------------------------------------------------------
-//
-CApControlListboxModel::~CApControlListboxModel()
-    {
-    CLOG( ( ESelector, 0, _L( 
-    	"-> CApControlListboxModel::~CApControlListboxModel" ) ) );
-    CLOG( ( ESelector, 0, _L( 
-    	"<- CApControlListboxModel::~CApControlListboxModel" ) ) );
-    }
-
-
-
-// ---------------------------------------------------------
-// CApControlListboxModel::MdcaCount
-// ---------------------------------------------------------
-//
-TInt CApControlListboxModel::MdcaCount() const
-    {
-    CLOG( ( ESelector, 0, _L( "-> CApControlListboxModel::MdcaCount" ) ) );
-    CLOG( ( ESelector, 0, _L( "<- CApControlListboxModel::MdcaCount" ) ) );
-    return NumberOfItems();
-    }
-
-
-// ---------------------------------------------------------
-// CApControlListboxModel::MdcaPoint
-// ---------------------------------------------------------
-//
-
-TPtrC CApControlListboxModel::MdcaPoint( TInt aIndex ) const
-    {
-    CLOG( ( ESelector, 0, _L( "-> CApControlListboxModel::MdcaPoint" ) ) );
-    CLOG( ( ESelector, 0, _L( "<- CApControlListboxModel::MdcaPoint" ) ) );
-    return ItemText(aIndex);
-    }
-
-
-
-
-// End of File
--- a/accesspointcontrol/apcontrollistplugin/src/apcontrollistcapschange.cpp	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +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:  Class for asyncron calls.
-*
-*/
-
-
-// INCLUDE FILES
-#include <rmmcustomapi.h>
-
-#include "apcontrollistcapschange.h"
-#include "apcontrollistplugin.h"
-#include "apcontrollistapiwrapper.h"
-#include "apcontrollistpluginlogger.h"
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// ----------------------------------------------------------------------------- 
-// CAPControlListCapsChange::CAPControlListCapsChange
-// Description: CAPControlListCapsChange constructer 
-// ----------------------------------------------------------------------------- 
-//
-CAPControlListCapsChange::CAPControlListCapsChange(
-					CAPControlListPlugin& aPlugin, TInt aPriority ) : 
-													CActive( aPriority ), 
-													iPlugin(aPlugin) 
-	{
-	CActiveScheduler::Add( this ); 
-	}
-
-//
-//----------------------------------------------------------------------------- 
-// CAPControlListCapsChange:: CAPControlListCapsChange
-// Description: CAPControlListCapsChange Destructer
-// ----------------------------------------------------------------------------- 
-// 
-CAPControlListCapsChange::~CAPControlListCapsChange()
-	{
-	Cancel();
-	}
-
-
-
-//
-//----------------------------------------------------------------------------- 
-// CAPControlListCapsChange::DoCancel
-// Description: This calls CActive's Cancel 
-//----------------------------------------------------------------------------- 
-//
-void CAPControlListCapsChange::DoCancel()
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListCapsChange::DoCancel" ) ) );
-    iPlugin.APIWrapper()->CancelNotify();   
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListCapsChange::DoCancel" ) ) );
-    }
-
-//
-//----------------------------------------------------------------------------- 
-// CAPControlListCapsChange::RunL 
-// Description: CActive::RunL implementation which will either stop the
-// Scheduler or increment the count
-//----------------------------------------------------------------------------- 
-//
-void CAPControlListCapsChange::RunL()
-	{
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListCapsChange::RunL" ) ) );
-    CLOG( ( ESelector, 0, _L( "iStatus.Int(): %d"), iStatus.Int() ) );
-    CLOG( ( ESelector, 0, _L( "iCaps: %d"), iCaps ) );
-	if ( !(iCaps & RMobilePhone::KCapsUSimAccessSupported) )
-		{
-		iPlugin.ExitOnUSIMRemovalL();
-		}
-	else
-		{
-    	iPlugin.APIWrapper()->NotifyIccAccessCapsChange( iStatus, iCaps );
-		SetActive();			
-		}
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListCapsChange::RunL" ) ) );
-	}
-	
-
-
-// ---------------------------------------------------------
-// CAPControlListCapsChange::NotifyCapsChange()
-// ---------------------------------------------------------
-//
-void CAPControlListCapsChange::NotifyCapsChange()
-    {   	
-    CLOG( ( ESelector, 0, _L( 
-    	"-> CAPControlListCapsChange::NotifyCapsChange" ) ) );
-	if( !IsActive() )
-		{
-    	iPlugin.APIWrapper()->NotifyIccAccessCapsChange( iStatus, iCaps );
-		SetActive();	
-		}
-    CLOG( ( ESelector, 0, _L( 
-    	"<- CAPControlListCapsChange::NotifyCapsChange" ) ) );
-    }
-
--- a/accesspointcontrol/apcontrollistplugin/src/apcontrollistplugin.cpp	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,506 +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:  APControlListPlugin class.
-*
-*/
-
-
-// INCLUDE FILES
-
-// System includes
-#include <hlplch.h>
-
-#include <aknlists.h>        //for CListBox
-#include <f32file.h>
-#include <aknnotewrappers.h> //for CAknInformationNote
-#include <AknQueryDialog.h>
-#include <StringLoader.h>
-#include <apcontrollistpluginrsc.rsg>
-#include <data_caging_path_literals.hrh>
-#include <apcontrollistplugin.mbg>
-#include <featmgr.h>
-
-// User includes
-#include "apcontrollistplugin.hrh"
-#include "apcontrollistplugin.h"
-#include "apcontrollistplugincontainer.h"
-#include "apcontrollistpluginlogger.h"
-#include "apcontrollistapiwrapper.h"
-#include "apcontrollistcapschange.h"
-
-// CONSTANTS
-// Resource file location constant
-_LIT( KResourceFileName, "APControlListPluginRsc.rsc" );
-
-// ROM folder
-_LIT( KDriveZ, "z:" );
-
-// Name of the MBM file containing icons
-_LIT( KFileIcons, "apcontrollistplugin.mbm");
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ---------------------------------------------------------
-// CAPControlListPlugin::NewL
-// First phase constructor
-// ---------------------------------------------------------
-CAPControlListPlugin* CAPControlListPlugin::NewL( TAny* /*aInitParams*/ )
-    {
-	CLOG_CREATE()
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPlugin::NewL" ) ) );
-    CAPControlListPlugin* self = new ( ELeave ) CAPControlListPlugin();
-    CleanupStack::PushL( self );
-    
-    self->ConstructL( );
-                      
-    CleanupStack::Pop( self );
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPlugin::NewL" ) ) );
-    return self;     
-    }
-
-// ---------------------------------------------------------
-// CAPControlListPlugin::NewL
-// Destructor
-// ---------------------------------------------------------
-CAPControlListPlugin::~CAPControlListPlugin()
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPlugin::~CAPControlListPlugin" ) ) );
-    if( iContainer )
-    {
-        AppUi()->RemoveFromViewStack( *this, iContainer );
-        delete iContainer;
-    }
-    if (iAPIWrapper)
-    {
-    	delete iAPIWrapper;
-    }
-    if (iChangeNotifier)
-    {
-    	delete iChangeNotifier;
-    }
-    iResources.Close();
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPlugin::~CAPControlListPlugin" ) ) );
-    }
-
-// ---------------------------------------------------------
-// CAPControlListPlugin::Id
-// ---------------------------------------------------------
-TUid CAPControlListPlugin::Id() const
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPlugin::Id" ) ) );
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPlugin::Id" ) ) );
-    return KAPControlListPluginUid;
-    }
-    
-// ---------------------------------------------------------
-// CAPControlListPlugin::HandleCommandL( TInt aCommand )
-// ---------------------------------------------------------
-//
-void CAPControlListPlugin::HandleCommandL( TInt aCommand )
-    {   
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPlugin::HandleCommandL" ) ) );
-    switch ( aCommand )
-        {
-        case EAknSoftkeyBack :
-            {
-            // Activate the view ( from GS ) that we
-            // are supposed to return to
-            AppUi()->ActivateLocalViewL( iPrevViewId.iViewUid );
-            break;
-            }
-        case EAPControlListCmdActivate :
-            {
-            iAPIWrapper->ActivateACL();
-            break;
-            }
-        case EAPControlListCmdDeactivate :
-            {
-            iAPIWrapper->DeActivateACL();
-            break;
-            }
-        case EAPControlListCmdAdd :
-            {
-            iAPIWrapper->AddAPNL();
-            break;
-            }
-        case EAPControlListCmdRemove :
-            {
-            iAPIWrapper->RemoveAPN();
-            break;
-            }
-        case EAknCmdHelp : 
-            {
-            HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), 
-                                                 AppUi()->AppHelpContextL() );
-            break;
-            }
-        case EEikCmdExit :
-        default :
-            {            
-            AppUi()->HandleCommandL( aCommand );
-            break;
-            }
-        }
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPlugin::HandleCommandL" ) ) );
-    }
-    
-// ---------------------------------------------------------
-// CAPControlListPlugin::ExitOnUSIMRemovalL
-// ---------------------------------------------------------
-void CAPControlListPlugin::ExitOnUSIMRemovalL() 
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPlugin::ExitOnUSIMRemovalL" ) ) );
-    iVisible = EFalse;
-	AppUi()->ActivateLocalViewL( iPrevViewId.iViewUid );
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPlugin::ExitOnUSIMRemovalL" ) ) );
-    }
-    
-// ---------------------------------------------------------
-// CAPControlListPlugin::DoActivateL
-// ---------------------------------------------------------
-void CAPControlListPlugin::DoActivateL( const TVwsViewId& aPrevViewId, 
-                                      TUid /*aCustomMessageId*/, 
-                                      const TDesC8& /*aCustomMessage*/ )
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPlugin::DoActivateL" ) ) );
-    if ( iPrevViewId.iViewUid.iUid == 0 )
-        {
-        //must be prepared to application switch, so it stores
-        //only the parent view (General Settings Main View)
-        iPrevViewId = aPrevViewId;
-        }
-
-    if ( !iContainer )
-        {
-        iContainer = new( ELeave ) CAPControlListPluginContainer;
-        iContainer->SetMopParent( this );
-        
-        TRAPD( error, iContainer->ConstructL( ClientRect(), this ) );
-        if ( error )
-            {
-            delete iContainer;
-            iContainer = NULL;
-            User::Leave( error );
-            }
-        
-	    if (!iAPIWrapper)  
-		    {
-	    	iAPIWrapper = new( ELeave ) CAPControlListAPIWrapper(*this);
-	    	iAPIWrapper->ConstructL();
-	    	}
-	    if (!iChangeNotifier)  
-		    {
-	    	iChangeNotifier = new( ELeave ) CAPControlListCapsChange(*this);
-            iChangeNotifier->NotifyCapsChange();
-	    	}
-	    				
-		    ShowInfoNoteL(R_QTN_ACL_WAIT_READING_SIM);
-    	  iAPIWrapper->ReadData();  
-        iContainer->HandleResourceChange(KEikDynamicLayoutVariantSwitch);
-    	  		
-	    
-        AppUi()->AddToViewStackL( *this, iContainer );
-        }
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPlugin::DoActivateL" ) ) );
-    }
-
-// ---------------------------------------------------------
-// CAPControlListPlugin::PluginUid
-// ---------------------------------------------------------
-TUid CAPControlListPlugin::PluginUid() const
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPlugin::PluginUid" ) ) );
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPlugin::PluginUid" ) ) );
-    return KAPControlListPluginUid;
-    }
-
-// ---------------------------------------------------------
-// CAPControlListPlugin::GetCaption
-// ---------------------------------------------------------
-void CAPControlListPlugin::GetCaptionL( TDes& aCaption ) const
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPlugin::GetCaptionL" ) ) );
-    StringLoader::Load( aCaption, R_QTN_ACL_MENU_ITEM );
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPlugin::GetCaptionL" ) ) );
-    }
-
-// ---------------------------------------------------------
-// CAPControlListPlugin::HasBitmap
-// ---------------------------------------------------------
-TBool CAPControlListPlugin::HasBitmap() const
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPlugin::HasBitmap" ) ) );
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPlugin::HasBitmap" ) ) );
-    return EFalse;
-    }
-
-// ---------------------------------------------------------
-// CAPControlListPlugin::GetBitmapL
-// ---------------------------------------------------------
-void CAPControlListPlugin::GetBitmapL( CFbsBitmap* /*aBitmap*/, 
-                                     CFbsBitmap* /*aMask*/ ) const
-    {
-    //no bitmap
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPlugin::GetBitmapL" ) ) );
-    User::Leave( KErrNotFound );
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPlugin::GetBitmapL" ) ) );
-    }
-    
-// ---------------------------------------------------------
-// CAPControlListPlugin::PluginProviderCategory
-// ---------------------------------------------------------
-TInt CAPControlListPlugin::PluginProviderCategory() const
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPlugin::PluginProviderCategory" ) ) );
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPlugin::PluginProviderCategory" ) ) );
-    return EGSPluginProviderOEM;
-    }
-
-// ---------------------------------------------------------
-// CApSettingsPlugin::CreateIconL
-// ---------------------------------------------------------    
-CGulIcon* CAPControlListPlugin::CreateIconL( const TUid aIconType )
-    {
-    TFileName iconsFileName;
-
-    iconsFileName.Append( KDriveZ );
-    iconsFileName.Append( KDC_APP_BITMAP_DIR );
-    iconsFileName.Append( KFileIcons );
-    
-	CGulIcon* icon;
-       
-    if( aIconType == KGSIconTypeLbxItem )
-        {
-        icon = AknsUtils::CreateGulIconL(
-        AknsUtils::SkinInstance(), 
-        KAknsIIDQgnPropSetConnAccp, 
-        iconsFileName,
-        EMbmApcontrollistpluginQgn_prop_set_conn_acl,
-        EMbmApcontrollistpluginQgn_prop_set_conn_acl_mask );
-        }
-     else
-        {
-        icon = CGSPluginInterface::CreateIconL( aIconType );
-        }
-	
-	return icon;
-    }    
-    
-// ---------------------------------------------------------
-// CAPControlListPlugin::Visible
-// ---------------------------------------------------------
-TBool CAPControlListPlugin::Visible() const
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPlugin::Visible" ) ) );
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPlugin::Visible" ) ) );
-    return iVisible;
-    }
-    
-// ---------------------------------------------------------
-// CAPControlListPlugin::CAPControlListPlugin
-// ---------------------------------------------------------
-CAPControlListPlugin::CAPControlListPlugin():
-    iPrevViewId(),
-    iResources( *CCoeEnv::Static() ),
-    iVisible(EFalse)
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPlugin::CAPControlListPlugin" ) ) );
-    // no implementation required
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPlugin::CAPControlListPlugin" ) ) );
-    }
-
-// ---------------------------------------------------------
-// CAPControlListPlugin::ConstructL
-// ---------------------------------------------------------
-TAny CAPControlListPlugin::ConstructL()
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPlugin::ConstructL" ) ) );
-   
-    TFileName fileName;
-    TDriveUnit drive( EDriveZ );
-    
-    fileName.Append( drive.Name() );
-    fileName.Append( KDC_RESOURCE_FILES_DIR );
-    fileName.Append( KResourceFileName );    
-    iResources.OpenL( fileName );
-
-    BaseConstructL( R_APCLPLUGIN_MAIN_VIEW );
-     
-	// get Visible   
-    iAPIWrapper = new( ELeave ) CAPControlListAPIWrapper(*this);
-    iAPIWrapper->ConstructL();
-    iVisible = iAPIWrapper->Visible();
-    iAPIWrapper->Cancel();
-    delete iAPIWrapper;
-    iAPIWrapper = NULL;
-        
-    FeatureManager::InitializeLibL();
-    iHelp = FeatureManager::FeatureSupported( KFeatureIdHelp ); 
-    FeatureManager::UnInitializeLib();
-    
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPlugin::ConstructL" ) ) );
-    }
-    
-    
-// ---------------------------------------------------------
-// CAPControlListPlugin::DynInitMenuPaneL
-// ---------------------------------------------------------
-void CAPControlListPlugin::DynInitMenuPaneL( TInt aResourceId,
-                                         CEikMenuPane* aMenuPane )
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPlugin::DynInitMenuPaneL" ) ) );
-    CAknView::DynInitMenuPaneL( aResourceId, aMenuPane );
-    if ( aResourceId == R_APCLPLUGIN_MAIN_MENU )
-    {    
-		if ( iAPIWrapper->Enabled() )
-		{
-    		aMenuPane->DeleteMenuItem( EAPControlListCmdActivate );
-		}
-		else
-		{
-    		aMenuPane->DeleteMenuItem( EAPControlListCmdDeactivate );
-		}
-		if ( !iContainer->NumberOfItems() )
-		{
-    		aMenuPane->DeleteMenuItem( EAPControlListCmdRemove );
-		}
-		if (!iHelp)
-		{
-    		aMenuPane->DeleteMenuItem( EAknCmdHelp );		    
-		}
-    }
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPlugin::DynInitMenuPaneL" ) ) );
-    }
-        
-// ---------------------------------------------------------
-// CAPControlListPlugin::DoDeactivate
-// ---------------------------------------------------------
-void CAPControlListPlugin::DoDeactivate()
-    {        
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPlugin::DoDeactivate" ) ) );
-    if ( iContainer )
-        {
-        AppUi()->RemoveFromViewStack( *this, iContainer );
-        }
-
-    delete iContainer;
-    iContainer = NULL; 
-    if (iChangeNotifier)
-    {
-    	delete iChangeNotifier;
-		iChangeNotifier = NULL; 
-    }
-    if (iAPIWrapper)  
-	    {
-	    delete iAPIWrapper;
-	    iAPIWrapper = NULL;    	
-	    }
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPlugin::DoDeactivate" ) ) );
-    }
-    
-// ---------------------------------------------------------
-// CAPControlListPlugin::UiComplete( TInt aUirEvent )
-// ---------------------------------------------------------
-//
-void CAPControlListPlugin::UiComplete( TInt /*aUirEvent*/ )
-    {    
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPlugin::UiComplete" ) ) );
-    // Activate this view as we are coming back
-    // from some other view in the UI
-    TRAP_IGNORE( 
-        AppUi()->ActivateLocalViewL( KAPControlListPluginUid ) )
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPlugin::UiComplete" ) ) );
-    }
-    
-// ---------------------------------------------------------
-//  CAPControlListPlugin::HandleListBoxEventL
-// ---------------------------------------------------------
-void CAPControlListPlugin::HandleListBoxEventL( CEikListBox* /*aListBox*/,
-                                              TListBoxEvent aEventType )
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPlugin::HandleListBoxEventL" ) ) );
-    switch ( aEventType )
-        {
-        case EEventEnterKeyPressed :
-        case EEventItemClicked :
-            {
-            break;
-            }
-        default :
-           break;
-        }
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPlugin::HandleListBoxEventL" ) ) );
-    }
-    
-// ----------------------------------------------------------
-// CAPControlListPlugin::ShowInfoNoteL( TInt aResourceId )
-// ----------------------------------------------------------
-//
-void CAPControlListPlugin::ShowInfoNoteL( TInt aResourceId )
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPlugin::ShowInfoNoteL" ) ) );
-    HBufC* text = iCoeEnv->AllocReadResourceLC( aResourceId );
-    CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue );
-    note->ExecuteLD( *text );
-    CleanupStack::PopAndDestroy( text );
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPlugin::ShowInfoNoteL" ) ) );
-    }
-    
-// ----------------------------------------------------------
-// CAPControlListPlugin::ShowConfirmNoteL( TInt aResourceId )
-// ----------------------------------------------------------
-//
-
-void CAPControlListPlugin::ShowConfirmNoteL( TInt aResourceId )
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPlugin::ShowConfirmNoteL" ) ) );
-    HBufC* text = iCoeEnv->AllocReadResourceLC( aResourceId );
-    CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote( ETrue );
-    note->ExecuteLD( *text );
-    CleanupStack::PopAndDestroy( text );
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPlugin::ShowConfirmNoteL" ) ) );
-    }
-    
-// ----------------------------------------------------------
-// CAPControlListPlugin::ShowConfirmNoteL( TInt aResourceId )
-// ----------------------------------------------------------
-//
-void CAPControlListPlugin::ShowConfirmNoteAPNL( TInt aResourceId, TPtrC& aAPN )
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPlugin::ShowConfirmNoteL" ) ) );
-    HBufC* text = StringLoader::LoadLC ( aResourceId, aAPN);
-    CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote( ETrue );
-    note->ExecuteLD( *text );
-    CleanupStack::PopAndDestroy( text );
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPlugin::ShowConfirmNoteL" ) ) );
-    }
-    
-// ----------------------------------------------------------
-// CAPControlListPlugin::Container()
-// ----------------------------------------------------------
-//
-CAPControlListPluginContainer* CAPControlListPlugin::Container()
-    {
-    return iContainer;
-    }
-    
-// ----------------------------------------------------------
-// CAPControlListPlugin::APIWrapper()
-// ----------------------------------------------------------
-//
-CAPControlListAPIWrapper* CAPControlListPlugin::APIWrapper()
-    {
-    	return iAPIWrapper;
-    }
-//End of file
--- a/accesspointcontrol/apcontrollistplugin/src/apcontrollistplugincontainer.cpp	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,344 +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:  APControl list Plugin container
-*
-*/
-
-
-// INCLUDE FILES
-#include <hlplch.h>          //for help
-#include <csxhelp/cp.hlp.hrh>
-
-
-#include <akntitle.h>        //for CAknTitlePane
-#include <barsread.h>        //for TResourceReader
-#include <aknlists.h>        //for CListBox
-#include <aknnavi.h>         //for CNaviPane
-#include <aknnavide.h>       //for CAknNavigationDecorator
-#include <apcontrollistpluginrsc.rsg>
-#include <etelmm.h>
-
-#include "apcontrollistplugincontainer.h"
-#include "apcontrollistplugin.h"
-#include "apcontrollistplugin.hrh"
-#include "apcontrollistbox.h"
-#include "apcontrollistboxmodel.h"
-#include "apcontrollistpluginlogger.h"
-
-// CONSTANTS
-_LIT( KEmpty, "");
-
-// ================= MEMBER FUNCTIONS =======================
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// CAPControlListPluginContainer::ConstructL
-// ---------------------------------------------------------
-//
-void CAPControlListPluginContainer::ConstructL( const TRect& aRect, 
-                                              MEikListBoxObserver* aListObserver )
-    {       
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPluginContainer::ConstructL" ) ) );
-    if ( !iListBox )
-        {
-
-        TResourceReader rr;
-
-        //creates resource reader. reader is pushed to cleaup stack
-        ControlEnv()->CreateResourceReaderLC( rr, R_APCONTROL_LISTBOX );
-
-        CreateWindowL();
-
-        iListBox = new( ELeave ) CApControlListbox;
-        iListBox->SetContainerWindowL( *this );
-
-        iListBox->CreateScrollBarFrameL( ETrue );
-        iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( 
-                                        CEikScrollBarFrame::EOff, 
-                                        CEikScrollBarFrame::EAuto );
-
-        iListBox->ConstructFromResourceL( rr );
-	    
-	    //Put in empty text thing
-	    iListBox->SetListEmptyTextL();
-        iListBox->SetListBoxObserver( aListObserver );
-
-    	iModel = new( ELeave )CApControlListboxModel;
-    	iModel->ConstructL();
-    	iListBox->Model()->SetItemTextArray( iModel );//give ownership of
-    	// iModel to iListBox
-        
-        CleanupStack::PopAndDestroy(); //resource reader
-        
-        SetRect( aRect );
-                                                           
-        HandleResourceChange( KEikDynamicLayoutVariantSwitch );
-        }      
-        
-
-    TitlePaneTextsL( R_APCLPLUGIN_TITLE );
-    ActivateL();
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPluginContainer::ConstructL" ) ) );
-    }
-    
-// ---------------------------------------------------------
-// CAPControlListPluginContainer::AddToListBoxL
-// ---------------------------------------------------------
-//
-void CAPControlListPluginContainer::AddToListBoxL(TPtrC& newItem)
-    {
-    CLOG( ( ESelector, 0, _L( 
-        "-> CAPControlListPluginContainer::AddToListBoxL" ) ) );
-	MDesCArray* textArray = iModel->ItemTextArray();
-	CDesCArray* listBoxItems = static_cast<CDesCArray*>(textArray);
-
-	TBuf<RMobilePhone::KMaxApnName> item;
-	// RMobilePhone::KMaxApnName - label length + TAB = 
-	// RMobilePhone::KMaxApnName 
-	item.Format(_L("\t%S"), &newItem); 
-	listBoxItems->AppendL(item);
-
-	iListBox->HandleItemAdditionL(); // Update listbox
-	iListBox->SetCurrentItemIndexAndDraw(
-	    listBoxItems->Count() - 1); // select new item
-    CLOG( ( ESelector, 0, _L( 
-        "<- CAPControlListPluginContainer::AddToListBoxL" ) ) );
-    }
-// ---------------------------------------------------------
-// CAPControlListPluginContainer::CurrentItemIndex
-// ---------------------------------------------------------
-//
-TInt CAPControlListPluginContainer::CurrentItemIndex()
-    {
-    CLOG( ( ESelector, 0, _L( 
-        "-> CAPControlListPluginContainer::CurrentItemIndex" ) ) );
-    CLOG( ( ESelector, 0, _L( 
-        "<- CAPControlListPluginContainer::CurrentItemIndex" ) ) );
-	return iListBox->CurrentItemIndex(); 
-    }
-    
-// ---------------------------------------------------------
-// CAPControlListPluginContainer::SetCurrentItemIndex
-// ---------------------------------------------------------
-//
-void CAPControlListPluginContainer::SetCurrentItemIndex(TInt index)
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPluginContainer::SetCurrentItemIndex" ) ) );
-	iListBox->SetCurrentItemIndexAndDraw(index); 
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPluginContainer::SetCurrentItemIndex" ) ) );
-    }
-    
-// ---------------------------------------------------------
-// CAPControlListPluginContainer::RemoveFromListBoxL
-// ---------------------------------------------------------
-//
-void CAPControlListPluginContainer::RemoveFromListBoxL()
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPluginContainer::RemoveFromListBoxL" ) ) );
-	TInt currentItem = iListBox->CurrentItemIndex();
-
-	MDesCArray* textArray = iModel->ItemTextArray();
-	CDesCArray* listBoxItems = static_cast<CDesCArray*>(textArray);
-	listBoxItems->Delete(currentItem, 1); // 1 = how many items to delete
-	AknListBoxUtils::HandleItemRemovalAndPositionHighlightL(iListBox, currentItem, ETrue);
-	iListBox->DrawNow(); // Update listbox    
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPluginContainer::RemoveFromListBoxL" ) ) );
-	}
-
-// ---------------------------------------------------------
-// CAPControlListPluginContainer::~CAPControlListPluginContainer
-// ---------------------------------------------------------
-//
-CAPControlListPluginContainer::~CAPControlListPluginContainer()
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPluginContainer::~CAPControlListPluginContainer" ) ) );
-    delete iListBox;
-    if (iNaviPane)
-        {
-        iNaviPane->Pop(iNaviDecorator);        
-        }
-    delete iNaviDecorator;    
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPluginContainer::~CAPControlListPluginContainer" ) ) );
-    }
-
-// ---------------------------------------------------------
-// CAPControlListPluginContainer::CountComponentControls
-// ---------------------------------------------------------
-//
-TInt CAPControlListPluginContainer::CountComponentControls() const
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPluginContainer::CountComponentControls" ) ) );
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPluginContainer::CountComponentControls" ) ) );
-    return 1;
-    }
-
-// ---------------------------------------------------------
-// CAPControlListPluginContainer::ComponentControl
-// ---------------------------------------------------------
-//
-CCoeControl* CAPControlListPluginContainer::ComponentControl( TInt aIndex ) const
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPluginContainer::ComponentControl" ) ) );
-    switch( aIndex )
-        {
-        case 0 :
-            {
-    		CLOG( ( ESelector, 0, _L( "<- CAPControlListPluginContainer::ComponentControl 1" ) ) );
-            return iListBox;
-            }
-        default:
-            {
-    		CLOG( ( ESelector, 0, _L( "<- CAPControlListPluginContainer::ComponentControl 2" ) ) );
-            return 0;
-            } 
-        }
-    }
-
-// ---------------------------------------------------------
-// CAPControlListPluginContainer::OfferKeyEventL
-// ---------------------------------------------------------
-//
-TKeyResponse CAPControlListPluginContainer::OfferKeyEventL( 
-                                            const TKeyEvent& aKeyEvent, 
-                                            TEventCode aType )
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPluginContainer::OfferKeyEventL" ) ) );
-    TKeyResponse response = EKeyWasNotConsumed;
-    if ( aType == EEventKey )
-        {
-        response = iListBox->OfferKeyEventL( aKeyEvent, aType );
-        }
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPluginContainer::OfferKeyEventL" ) ) );
-    return response;
-    }
-
-// ---------------------------------------------------------
-// CAPControlListPluginContainer::SizeChanged
-// ---------------------------------------------------------
-//
-void CAPControlListPluginContainer::SizeChanged()
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPluginContainer::SizeChanged" ) ) );
-    iListBox->SetRect( Rect() );
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPluginContainer::SizeChanged" ) ) );
-    }
-
-// ---------------------------------------------------------
-// CAPControlListPluginContainer::GetHelpContext()
-// ---------------------------------------------------------
-//
-void CAPControlListPluginContainer::GetHelpContext( TCoeHelpContext& aContext) const
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPluginContainer::GetHelpContext" ) ) );
-    aContext.iMajor = KHelpUidAPControlList;
-    aContext.iContext = KACL_HLP_MAIN;
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPluginContainer::GetHelpContext" ) ) );
-    }
-
-// ---------------------------------------------------------
-// CAPControlListPluginContainer::TitlePaneTextsL
-// ---------------------------------------------------------
-//
-void CAPControlListPluginContainer::TitlePaneTextsL( TInt aResourceId )
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPluginContainer::TitlePaneTextsL" ) ) );
-    CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
-    CAknTitlePane* titlePane =
-        ( CAknTitlePane* )statusPane->ControlL(
-                            TUid::Uid( EEikStatusPaneUidTitle ) );
-
-    //creates and sets title. title is pushed to cleanup stack
-    HBufC* title = iEikonEnv->AllocReadResourceLC( aResourceId );
-    titlePane->SetTextL( *title );
-
-    iNaviPane = STATIC_CAST( CAknNavigationControlContainer*, 
-                 statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
-    
-    iNaviDecorator = iNaviPane->CreateNavigationLabelL( KEmpty );
-    iNaviPane->PushL( *iNaviDecorator );
-
-    CleanupStack::PopAndDestroy(title);
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPluginContainer::TitlePaneTextsL" ) ) );
-    }
-
-
-// ---------------------------------------------------------
-// CAPControlListPluginContainer::HandleResourceChange
-// ---------------------------------------------------------
-//
-void CAPControlListPluginContainer::HandleResourceChange( TInt aType )
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPluginContainer::HandleResourceChange" ) ) );
-    CCoeControl::HandleResourceChange( aType );
-    if( aType == KEikDynamicLayoutVariantSwitch )
-        {
-        TRect mainPaneRect;
-        AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, 
-                                           mainPaneRect );
-        SetRect( mainPaneRect );
-        DrawNow();
-        }
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPluginContainer::HandleResourceChange" ) ) );
-    }
-    
-// ---------------------------------------------------------
-// CAPControlListPluginContainer::FocusChanged
-// ---------------------------------------------------------
-//
-void CAPControlListPluginContainer::FocusChanged( TDrawNow aDrawNow )
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPluginContainer::FocusChanged" ) ) );
-    CCoeControl::FocusChanged( aDrawNow );
-    if( iListBox )
-        {
-        iListBox->SetFocus( IsFocused() );
-        }        
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPluginContainer::FocusChanged" ) ) );
-    }
-           
-// ---------------------------------------------------------
-// CAPControlListPluginContainer::CurrentItemNameL
-// ---------------------------------------------------------
-//
-TInt CAPControlListPluginContainer::NumberOfItems()  const
-    {
-    CLOG( ( ESelector, 0, _L( "-> CAPControlListPluginContainer::NumberOfItems" ) ) );
-    CLOG( ( ESelector, 0, _L( "<- CAPControlListPluginContainer::NumberOfItems" ) ) );
-    return iListBox->Model()->ItemTextArray()->MdcaCount();
-    }
-    
-// ---------------------------------------------------------
-// CAPControlListPluginContainer::WriteToNaviPaneL
-// ---------------------------------------------------------
-//
-void CAPControlListPluginContainer::WriteToNaviPaneL( TInt aResourceId )
-    {
-    CLOG( ( ESelector, 0, 
-        _L( "-> CAPControlListPluginContainer::WriteToNaviPaneL" ) ) );
-    HBufC* text = iCoeEnv->AllocReadResourceLC( aResourceId );
-    if ( iNaviDecorator )
-        {
-        iNaviPane->Pop(iNaviDecorator);
-        delete iNaviDecorator;
-        iNaviDecorator = NULL;// CodeScanner needs this line
-        }
-    iNaviDecorator = iNaviPane->CreateNavigationLabelL( *text );
-    iNaviPane->PushL( *iNaviDecorator );
-    
-    CleanupStack::PopAndDestroy( text );
-    CLOG( ( ESelector, 0, 
-        _L( "<- CAPControlListPluginContainer::WriteToNaviPaneL" ) ) );
-    }
-    
-// End of File  
--- a/accesspointcontrol/apcontrollistplugin/src/apcontrollistpluginimplementationtable.cpp	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +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: 
-*        ECOM proxy table for this plugin
-*
-*/
-
-
-// System includes
-#include <e32std.h>
-#include <ecom/implementationproxy.h>
-
-// User includes
-#include "apcontrollistplugin.h"
-
-// Constants
-const TImplementationProxy KAPControlListPluginImplementationTable[] = 
-    {
-    IMPLEMENTATION_PROXY_ENTRY( 0x10281BB5,    CAPControlListPlugin::NewL )
-    };
-
-
-// ---------------------------------------------------------------------------
-// ImplementationGroupProxy
-// Gate/factory function
-//
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
-    {
-    aTableCount = sizeof( KAPControlListPluginImplementationTable ) 
-        / sizeof( TImplementationProxy );
-    return KAPControlListPluginImplementationTable;
-    }
--- a/accesspointcontrol/apcontrollistplugin/src/apcontrollistpluginlogger.cpp	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +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 class APControlListPluginLogger.   
-*
-*/
-
-
-// INCLUDE FILES
-
-#ifdef _DEBUG
-
-    #include "apcontrollistpluginlogger.h"
-    #include <flogger.h>
-	#include <eikenv.h>
-
-    // ================= CONSTANTS =======================
-
-    /// apcontrollistplugin logging directory.
-    _LIT( KapcontrollistpluginLogDir, "apcontrollistplugin" );
-    /// apcontrollistplugin log file name.
-    _LIT( KapcontrollistpluginLogFile, "apcontrollistplugin.txt" );
-
-
-    // ================= MEMBER FUNCTIONS =======================
-
-    // ---------------------------------------------------------
-    // APControlListPluginLogger::Write()
-    // ---------------------------------------------------------
-    //
-    void APControlListPluginLogger::Write
-    ( TInt32 aMask, TInt aLevel, TRefByValue<const TDesC16> aFmt, ... )
-        {
-        if( (aMask & APCONTROL_LIST_LOG_MASK) && (aLevel <= APCONTROL_LIST_LOG_LEVEL) )
-            {
-            VA_LIST list;
-            VA_START( list, aFmt );
-            RFileLogger::WriteFormat
-                (
-                KapcontrollistpluginLogDir,
-                KapcontrollistpluginLogFile,
-                EFileLoggingModeAppend,
-                aFmt,
-                list
-                );
-            VA_END( list );
-            }
-        }
-
-
-    // ---------------------------------------------------------
-    // APControlListPluginLogger::Write()
-    // ---------------------------------------------------------
-    //
-    void APControlListPluginLogger::Write
-    ( TInt32 aMask, TInt aLevel, TRefByValue<const TDesC16> aFmt, 
-      VA_LIST& aList )
-        {
-        if( (aMask & APCONTROL_LIST_LOG_MASK) && (aLevel <= APCONTROL_LIST_LOG_LEVEL) )
-            {
-            RFileLogger::WriteFormat
-                (
-                KapcontrollistpluginLogDir,
-                KapcontrollistpluginLogFile,
-                EFileLoggingModeAppend,
-                aFmt,
-                aList
-                );
-            }
-        }
-
-
-    // ---------------------------------------------------------
-    // APControlListPluginLogger::Write()
-    // ---------------------------------------------------------
-    //
-    void APControlListPluginLogger::Write
-    ( TInt32 aMask, TInt aLevel, TRefByValue<const TDesC8> aFmt, ... )
-        {
-        if( (aMask & APCONTROL_LIST_LOG_MASK) && (aLevel <= APCONTROL_LIST_LOG_LEVEL) )
-            {
-            VA_LIST list;
-            VA_START( list, aFmt );
-            RFileLogger::WriteFormat
-                (
-                KapcontrollistpluginLogDir,
-                KapcontrollistpluginLogFile,
-                EFileLoggingModeAppend,
-                aFmt,
-                list
-                );
-            VA_END( list );
-            }
-        }
-
-
-    // ---------------------------------------------------------
-    // APControlListPluginLogger::Write()
-    // ---------------------------------------------------------
-    //
-    void APControlListPluginLogger::Write
-    ( TInt32 aMask, TInt aLevel, TRefByValue<const TDesC8> aFmt, 
-      VA_LIST& aList )
-        {
-        if( (aMask & APCONTROL_LIST_LOG_MASK) && (aLevel <= APCONTROL_LIST_LOG_LEVEL) )
-            {
-            RFileLogger::WriteFormat
-                (
-                KapcontrollistpluginLogDir,
-                KapcontrollistpluginLogFile,
-                EFileLoggingModeAppend,
-                aFmt,
-                aList
-                );
-            }
-        }
-
-
-    // ---------------------------------------------------------
-    // APControlListPluginLogger::HexDump()
-    // ---------------------------------------------------------
-    //
-    void APControlListPluginLogger::HexDump
-            (
-            TInt32 aMask,
-            TInt aLevel, 
-            const TText* aHeader,
-            const TText* aMargin,
-            const TUint8* aPtr,
-            TInt aLen
-            )
-        {
-        if( (aMask & APCONTROL_LIST_LOG_MASK) && (aLevel <= APCONTROL_LIST_LOG_LEVEL) )
-            {
-            RFileLogger::HexDump
-                (
-                KapcontrollistpluginLogDir,
-                KapcontrollistpluginLogFile,
-                EFileLoggingModeAppend,
-                aHeader,
-                aMargin,
-                aPtr,
-                aLen
-                );
-            }
-        }
-                
-    // ---------------------------------------------------------
-    // APControlListPluginLogger::FCreate()
-    // ---------------------------------------------------------
-    //
-	void APControlListPluginLogger::FCreate()
-	    {
-	    TFileName path(_L("c:\\logs\\"));
-	    path.Append(KapcontrollistpluginLogDir);
-	    path.Append(_L("\\"));
-	    RFs& fs = CEikonEnv::Static()->FsSession();
-	    fs.MkDirAll(path);
-	    }
-#endif // _DEBUG
-
--- a/apengine/apsettingshandlerui/src/ApNetSelPopupList.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/apengine/apsettingshandlerui/src/ApNetSelPopupList.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -20,7 +20,6 @@
 // INCLUDE FILES
 
 #include <ApNetworkItem.h>
-#include <csxhelp/cp.hlp.hrh>
 #include <featmgr.h>
 
 #include "ApSettingsHandlerUI.hrh"
@@ -183,8 +182,6 @@
     APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::GetHelpContext")
     
     aContext.iMajor = iHandler->iHelpMajor;
-    // help no longer available for user, use dummy ID
-    aContext.iContext = KSET_HLP_AP_SETTING_GPRS;
     
     APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::GetHelpContext")
     }
--- a/apengine/apsettingshandlerui/src/ApSelPopupList.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/apengine/apsettingshandlerui/src/ApSelPopupList.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -24,9 +24,6 @@
 #include <ApSetUI.rsg>
 #include <featmgr.h>
 
-#include <csxhelp/cp.hlp.hrh>
-
-
 #include "ApSelectorListBoxModel.h"
 #include "ApSettingsModel.h"
 #include "ApSettingsHandlerUI.hrh"
@@ -316,8 +313,6 @@
     APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::GetHelpContext")
     
     aContext.iMajor = iHandler->iHelpMajor;
-    // help no longer available for user, use dummy ID
-    aContext.iContext = KSET_HLP_AP_SETTING_GPRS;
     
     APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::GetHelpContext")
     }
--- a/apengine/apsettingshandlerui/src/ApSelectorDialog.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/apengine/apsettingshandlerui/src/ApSelectorDialog.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -29,8 +29,6 @@
 
 #include <featmgr.h>
 
-#include <csxhelp/cp.hlp.hrh>
-
 #include "ApSelectorDialog.h"
 #include "ApSelectorListBoxModel.h"
 #include "ApSelectorListbox.h"
@@ -435,14 +433,12 @@
     APSETUILOGGER_ENTERFN( EDialog,"SelDIalog::GetHelpContext<->")
     
     aContext.iMajor = iHandler->iHelpMajor;
-    // help no longer available for user, use dummy ID
-    aContext.iContext = KSET_HLP_AP_SETTING_GPRS;
     }
 
 
 
 // ---------------------------------------------------------
-// CApSelectorDialog::HandleApDbEventL
+// CApSelectorDialog::HandleApDbEventLw
 // called by the active access point framework
 // ---------------------------------------------------------
 //
--- a/apengine/apsettingshandlerui/src/ApSettingsDlg.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/apengine/apsettingshandlerui/src/ApSettingsDlg.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -43,8 +43,6 @@
 #include "ApSettingsModel.h"
 #include <ApSetUI.rsg>
 
-#include <csxhelp/cp.hlp.hrh>
-
 #include "ApSettingsHandlerUI.hrh"
 #include "ApsettingshandleruiImpl.h"
 #include "ApSettingsHandlerConsts.h"
@@ -775,90 +773,6 @@
     APSETUILOGGER_ENTERFN( ESettings,"Settings::GetHelpContext")
     
     aContext.iMajor = iHandler->iHelpMajor;
-    switch ( iBearerType )
-        {
-        case EApBearerTypeCSD:
-        case EApBearerTypeHSCSD:
-            {
-            switch ( iLevel )
-                {
-                case 2:
-                    {
-                    if ( iL2Ipv4 )
-                        {
-                        aContext.iContext = KSET_HLP_AP_DATA_AS_IPV4;
-                        }
-                    else
-                        {
-                        aContext.iContext = KSET_HLP_AP_DATA_AS_IPV6;
-                        }
-                    break;
-                    }
-                case 1:
-                    {
-                    aContext.iContext = KSET_HLP_AP_SETTING_DATA_AS;
-                    break;
-                    }
-                case 0:
-                default:
-                    {
-                    aContext.iContext = KSET_HLP_AP_SETTING_DATA;
-                    break;
-                    }
-                }
-            break;
-            }
-        case EApBearerTypeGPRS:
-            {
-            if ( iLevel )
-                {
-                aContext.iContext = KSET_HLP_AP_SETTING_GPRS_AS;
-                }
-            else
-                {
-                aContext.iContext = KSET_HLP_AP_SETTING_GPRS;
-                }
-            break;
-            }
-        case EApBearerTypeWLAN: 
-            {
-            switch ( iLevel )
-                {
-                case 2:
-                    {
-                    if ( iL2Ipv4 )
-                        {
-                        aContext.iContext = KSET_HLP_AP_WLAN_AS_IPV4;
-                        }
-                    else
-                        {
-                        aContext.iContext = KSET_HLP_AP_WLAN_AS_IPV6;
-                        }
-                    break;
-                    }
-                case 1:
-                    {
-                    aContext.iContext = KSET_HLP_AP_SETTING_WLAN_AS;
-                    break;
-                    }
-                case 0:
-                    {
-                    aContext.iContext = KSET_HLP_AP_SETTING_WLAN;
-                    break;
-                    }
-                default:
-                    {
-                    break;
-                    }
-                }
-            break;
-            }
-        default:
-            {
-            __ASSERT_DEBUG( EFalse, Panic( EInvalidBearerType ) );
-            break;
-            }
-        }
     
     APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetHelpContext")
     }
--- a/bearermanagement/mpm/inc/mpmserver.h	Tue May 18 13:52:48 2010 +0100
+++ b/bearermanagement/mpm/inc/mpmserver.h	Wed Jun 23 17:49:20 2010 +0100
@@ -58,6 +58,10 @@
 
 //Total number of ranges
 const TUint KMPMPolicyRangeCount = 2;
+
+// roaming to connected wlan wait interval
+// in micro seconds (10 sec)
+const TInt KRoamingToWlanUpdateInterval = 10000000; 
  
 //Definition of the ranges of IPC numbers
 const TInt KMPMPolicyRanges[KMPMPolicyRangeCount] = 
@@ -699,6 +703,14 @@
         void StartForcedRoamingToWlanL( const TConnMonIapInfo& aIapInfo );
         
         /**
+        * Starts forced roaming sequence to connected wlan
+        *
+        * @param aIapInfo Info about available IAPs
+        * @since 5.2
+        */
+        static TInt StartForcedRoamingToConnectedWlanL( TAny* aUpdater );
+        
+        /**
         * Starts forced roaming sequence from WLAN if necessary
         *
         * @param aIapInfo Info about available IAPs
@@ -961,6 +973,12 @@
         
         // Is WLAN usage already accepted in this offline session.
         TOfflineWlanQueryResponse iOfflineWlanQueryResponse;
+        
+        // Timer to start roaming to connected WLAN network 
+        CPeriodic* iRoamingToWlanPeriodic;
+
+        // TConnMonIapInfo Info about available IAPs
+        TConnMonIapInfo iConnMonIapInfo;
     };
 
 #include "mpmserver.inl"
--- a/bearermanagement/mpm/src/mpmserver.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/bearermanagement/mpm/src/mpmserver.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -230,6 +230,11 @@
 //
 CMPMServer::~CMPMServer()
     {
+	if ( iRoamingToWlanPeriodic )
+        {
+        iRoamingToWlanPeriodic->Cancel();
+		delete iRoamingToWlanPeriodic;
+        }
     if ( iDisconnectQueue )
         {
         iDisconnectQueue->ResetAndDestroy();
@@ -881,7 +886,32 @@
     TCmUsageOfWlan usageOfWlan = CommsDatAccess()->ForcedRoamingL();
     if ( usageOfWlan == ECmUsageOfWlanKnown || usageOfWlan == ECmUsageOfWlanKnownAndNew )
         {
-        StartForcedRoamingToWlanL( iapInfo );
+        if ( IsWlanConnectionStartedL( CommsDatAccess() ) )
+            {
+            iConnMonIapInfo = aIapInfo;
+                
+            if ( iRoamingToWlanPeriodic )
+                {
+                iRoamingToWlanPeriodic->Cancel();
+                }
+            else
+                {
+                iRoamingToWlanPeriodic = CPeriodic::NewL( 
+                                                   CActive::EPriorityStandard );
+                }
+            // start periodic object that calls StartForcedRoamingToWlanL after 10s. 
+            // this handles the case when new wlan connection is 
+            // started from e.g. wlan sniffer but IAP is not yet in Internet SNAP 
+            iRoamingToWlanPeriodic->Start( 
+                   TTimeIntervalMicroSeconds32( KRoamingToWlanUpdateInterval ), 
+                   TTimeIntervalMicroSeconds32( KRoamingToWlanUpdateInterval ), 
+                   TCallBack( StartForcedRoamingToConnectedWlanL, this ) );
+            }
+        else
+            {
+            StartForcedRoamingToWlanL( iapInfo );
+            }
+
         StartForcedRoamingFromWlanL( iapInfo );
         }
     
@@ -1446,12 +1476,11 @@
 void CMPMServer::StartForcedRoamingToWlanL( const TConnMonIapInfo& aIapInfo )
     {
     MPMLOGSTRING( "CMPMServer::StartForcedRoamingToWlan" )
-
-    // First check that there is no active wlan connection
-    if ( IsWlanConnectionStartedL( CommsDatAccess() ) )
+    
+    // cancel the periodic object
+    if ( iRoamingToWlanPeriodic != NULL )
         {
-        // Wlan already active can't roam to it
-        return;
+        iRoamingToWlanPeriodic->Cancel();
         }
 
     // Copy all available wlan iap ids to own array
@@ -1511,6 +1540,20 @@
     CleanupStack::PopAndDestroy( &wlanIapIds );
     }
 
+
+// ---------------------------------------------------------------------------
+// CMPMServer::StartForcedRoamingToConnectedWlanL
+// ---------------------------------------------------------------------------
+//    
+TInt CMPMServer::StartForcedRoamingToConnectedWlanL( TAny* aUpdater )
+    {
+    MPMLOGSTRING( "CMPMServer::StartForcedRoamingToConnectedWlanL" );
+    static_cast<CMPMServer*>( aUpdater )->StartForcedRoamingToWlanL( 
+            static_cast<CMPMServer*>( aUpdater )->iConnMonIapInfo );
+    return 0;
+    }
+
+
 // -----------------------------------------------------------------------------
 // CMPMServer::StartForcedRoamingFromWlanL
 // -----------------------------------------------------------------------------
--- a/cmmanager/cmmgr/cmmapi/group/cmmapi.mmp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmapi/group/cmmapi.mmp	Wed Jun 23 17:49:20 2010 +0100
@@ -17,7 +17,6 @@
 */
 
 
-#include <data_caging_paths.hrh>
 #include <platform_paths.hrh>
 
 TARGET          cmmanager.dll
@@ -26,10 +25,10 @@
 CAPABILITY      CAP_GENERAL_DLL
 VENDORID VID_DEFAULT
 
-SOURCEPATH      ../../cmmcommon/Src
+SOURCEPATH      ../../cmmcommon/src
 SOURCE          cmmclistatic.cpp
 
-SOURCEPATH      ../Src
+SOURCEPATH      ../src
 SOURCE          cmmanager.cpp
 SOURCE          cmmanagerapi.cpp
 SOURCE          cmdestination.cpp
@@ -56,12 +55,10 @@
 
 LIBRARY         euser.lib
 
-DEBUGLIBRARY    flogger.lib
-
 #if defined(ARMCC)
 DEFFILE ../EABI/CmManager_prot_setup.def
 #elif defined( WINSCW )
-DEFFILE ../BWinsCw/CmManager_prot_setup.def
+DEFFILE ../BWinsCw/CmManager_prot_setup.DEF
 #elif defined( WINS )
 DEFFILE ../BWins/CmManager_prot_setup.def
 #else
--- a/cmmanager/cmmgr/cmmapi/inc/cmdestinationapi.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmapi/inc/cmdestinationapi.h	Wed Jun 23 17:49:20 2010 +0100
@@ -85,6 +85,8 @@
     TInt IsConnected( TBool& aResult );
     TInt IsHidden( TBool& aResult );
     TInt IsEqual( const TInt aHandle, TBool& aResult );
+    TInt GetIcon( HBufC* aBuffer );
+    TInt SetIcon( const TDesC& aValue );
 
 private:
     // True when a subsession is established to the server.
--- a/cmmanager/cmmgr/cmmapi/inc/cmdestinationwrapper.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmapi/inc/cmdestinationwrapper.h	Wed Jun 23 17:49:20 2010 +0100
@@ -90,6 +90,8 @@
     TInt IsConnected( TBool& aResult );
     TInt IsHidden( TBool& aResult );
     TInt IsEqual( const TInt aHandle, TBool& aResult );
+    TInt GetIcon( HBufC* aBuffer );
+    TInt SetIcon( const TDesC& aValue);
 
     TBool SessionConnected();
     void CloseSession();
--- a/cmmanager/cmmgr/cmmapi/inc/cmmanagerapi.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmapi/inc/cmmanagerapi.h	Wed Jun 23 17:49:20 2010 +0100
@@ -132,6 +132,7 @@
             const TInt aConnMethodHandle );
     TInt RemoveAllReferences(
             const TInt aConnMethodHandle );
+    TInt GetUncategorizedIcon( HBufC* aBuffer );
 
 private:
     // Array of destination handles opened through this session.
--- a/cmmanager/cmmgr/cmmapi/src/cmconnectionmethod.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmapi/src/cmconnectionmethod.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -178,7 +178,6 @@
     else
         {
         CleanupStack::PopAndDestroy( buffer );
-        buffer = NULL;
         buffer = KNullDesC().AllocL();
         }
 
@@ -211,7 +210,6 @@
     else
         {
         CleanupStack::PopAndDestroy( buffer8 );
-        buffer8 = NULL;
         buffer8 = KNullDesC8().AllocL();
         }
 
@@ -495,21 +493,44 @@
     {
     OstTraceFunctionEntry0( RCMCONNECTIONMETHOD_GETICONL_ENTRY );
 
-    User::Leave( KErrNotSupported );
+    if ( !iCmConnectionMethodWrapper || !iCmConnectionMethodWrapper->SessionConnected() )
+        {
+        User::Leave( KErrBadHandle );
+        }
+
+    HBufC* buffer = HBufC::NewLC( KCmmStringLengthMax );
+    TInt err = iCmConnectionMethodWrapper->GetStringAttribute( CMManager::ECmBearerIcon, buffer );
+    User::LeaveIfError( err );
+
+    if ( buffer->Length() > 0 )
+        {
+        CleanupStack::Pop( buffer );
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy( buffer );
+        buffer = KNullDesC().AllocL();
+        }
 
     OstTraceFunctionExit0( RCMCONNECTIONMETHOD_GETICONL_EXIT );
-    return NULL;
+    return buffer;
     }
 
 //-----------------------------------------------------------------------------
 //  RCmConnectionMethod::SetIconL()
 //-----------------------------------------------------------------------------
 //
-EXPORT_C void RCmConnectionMethod::SetIconL( const TDesC& /*aIcon*/ )
+EXPORT_C void RCmConnectionMethod::SetIconL( const TDesC& aIcon )
     {
     OstTraceFunctionEntry0( RCMCONNECTIONMETHOD_SETICONL_ENTRY );
 
-    User::Leave( KErrNotSupported );
+    if ( !iCmConnectionMethodWrapper || !iCmConnectionMethodWrapper->SessionConnected() )
+        {
+        User::Leave( KErrBadHandle );
+        }
+
+    TInt err = iCmConnectionMethodWrapper->SetStringAttribute( CMManager::ECmBearerIcon, aIcon );
+    User::LeaveIfError( err );
 
     OstTraceFunctionExit0( RCMCONNECTIONMETHOD_SETICONL_EXIT );
     }
--- a/cmmanager/cmmgr/cmmapi/src/cmdestination.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmapi/src/cmdestination.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -796,21 +796,44 @@
     {
     OstTraceFunctionEntry0( RCMDESTINATION_GETICONL_ENTRY );
 
-    User::Leave( KErrNotSupported );
+    if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() )
+        {
+        User::Leave( KErrBadHandle );
+        }
+
+    HBufC* buffer = HBufC::NewLC( KCmmStringLengthMax );
+    TInt err = iCmDestinationWrapper->GetIcon( buffer );
+    User::LeaveIfError( err );
+
+    if ( buffer->Length() > 0 )
+        {
+        CleanupStack::Pop( buffer );
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy( buffer );
+        buffer = KNullDesC().AllocL();
+        }
 
     OstTraceFunctionExit0( RCMDESTINATION_GETICONL_EXIT );
-    return NULL;
+    return buffer;
     }
 
 //-----------------------------------------------------------------------------
 //  RCmDestination::SetIconL()
 //-----------------------------------------------------------------------------
 //
-EXPORT_C void RCmDestination::SetIconL( const TDesC& /*aIcon*/ )
+EXPORT_C void RCmDestination::SetIconL( const TDesC& aIcon )
     {
     OstTraceFunctionEntry0( RCMDESTINATION_SETICONL_ENTRY );
 
-    User::Leave( KErrNotSupported );
+    if ( !iCmDestinationWrapper || !iCmDestinationWrapper->SessionConnected() )
+        {
+        User::Leave( KErrBadHandle );
+        }
+
+    TInt err = iCmDestinationWrapper->SetIcon( aIcon );
+    User::LeaveIfError( err );
 
     OstTraceFunctionExit0( RCMDESTINATION_SETICONL_EXIT );
     }
--- a/cmmanager/cmmgr/cmmapi/src/cmdestinationapi.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmapi/src/cmdestinationapi.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -413,4 +413,27 @@
     return err;
     }
 
+TInt RCmDestinationApi::GetIcon( HBufC* aBuffer )
+    {
+    OstTraceFunctionEntry0( RCMDESTINATIONAPI_GETICON_ENTRY );
+
+    TPtr descriptor( aBuffer->Des() );
+    TIpcArgs args( &descriptor );
+    TInt err = SendReceive( EDestGetIcon, args );
+
+    OstTraceFunctionExit0( RCMDESTINATIONAPI_GETICON_EXIT );
+    return err;
+    }
+
+TInt RCmDestinationApi::SetIcon( const TDesC& aValue )
+    {
+    OstTraceFunctionEntry0( RCMDESTINATIONAPI_SETICON_ENTRY );
+
+    TIpcArgs args( &aValue );
+    TInt err = SendReceive( EDestSetIcon, args );
+
+    OstTraceFunctionExit0( RCMDESTINATIONAPI_SETICON_EXIT );
+    return err;
+    }
+
 // End of file
--- a/cmmanager/cmmgr/cmmapi/src/cmdestinationwrapper.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmapi/src/cmdestinationwrapper.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -386,6 +386,26 @@
     return err;
     }
 
+TInt CCmDestinationWrapper::GetIcon( HBufC* aBuffer )
+    {
+    OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_GETICON_ENTRY );
+
+    TInt err = iCmDestinationApi.GetIcon( aBuffer );
+
+    OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_GETICON_EXIT );
+    return err;
+    }
+
+TInt CCmDestinationWrapper::SetIcon( const TDesC& aValue)
+    {
+    OstTraceFunctionEntry0( CCMDESTINATIONWRAPPER_SETICON_ENTRY );
+
+    TInt err = iCmDestinationApi.SetIcon( aValue );
+
+    OstTraceFunctionExit0( CCMDESTINATIONWRAPPER_SETICON_EXIT );
+    return err;
+    }
+
 TBool CCmDestinationWrapper::SessionConnected()
     {
     return iCmDestinationApi.SessionConnected();
--- a/cmmanager/cmmgr/cmmapi/src/cmmanager.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmapi/src/cmmanager.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -210,7 +210,6 @@
     else
         {
         CleanupStack::PopAndDestroy( buffer );
-        buffer = NULL;
         buffer = KNullDesC().AllocL();
         }
 
@@ -244,7 +243,6 @@
     else
         {
         CleanupStack::PopAndDestroy( buffer8 );
-        buffer8 = NULL;
         buffer8 = KNullDesC8().AllocL();
         }
 
@@ -324,7 +322,6 @@
     else
         {
         CleanupStack::PopAndDestroy( buffer );
-        buffer = NULL;
         buffer = KNullDesC().AllocL();
         }
 
@@ -358,7 +355,6 @@
     else
         {
         CleanupStack::PopAndDestroy( buffer8 );
-        buffer8 = NULL;
         buffer8 = KNullDesC8().AllocL();
         }
 
@@ -909,10 +905,27 @@
     {
     OstTraceFunctionEntry0( RCMMANAGER_GETUNCATEGORIZEDICONL_ENTRY );
 
-    User::Leave( KErrNotSupported );
+    if ( !iCmManagerApi )
+        {
+        User::Leave( KErrBadHandle );
+        }
+
+    HBufC* buffer = HBufC::NewLC( KCmmStringLengthMax );
+    TInt err = iCmManagerApi->GetUncategorizedIcon( buffer );
+    User::LeaveIfError( err );
+
+    if ( buffer->Length() > 0 )
+        {
+        CleanupStack::Pop( buffer );
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy( buffer );
+        buffer = KNullDesC().AllocL();
+        }
 
     OstTraceFunctionExit0( RCMMANAGER_GETUNCATEGORIZEDICONL_EXIT );
-    return NULL;
+    return buffer;
     }
 
 // End of file
--- a/cmmanager/cmmgr/cmmapi/src/cmmanagerapi.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmapi/src/cmmanagerapi.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -73,12 +73,8 @@
                 return err;
                 }
             err = TCmManagerLauncher::LaunchServer(
-                    KCmmServer,
                     KCmmServerFile,
-                    KCmmUid3,
-                    KCmmServerInitHeapSize,
-                    KCmmServerMaxHeapSize,
-                    KCmmServerStackSize );
+                    KCmmUid3 );
 
             if ( err != KErrNone && err != KErrAlreadyExists )
                 {
@@ -954,4 +950,20 @@
     return err;
     }
 
+//-----------------------------------------------------------------------------
+// RCmManagerApi::GetUncategorizedIcon()
+//-----------------------------------------------------------------------------
+//
+TInt RCmManagerApi::GetUncategorizedIcon( HBufC* aBuffer )
+    {
+    OstTraceFunctionEntry0( RCMMANAGERAPI_GETUNCATEGORIZEDICON_ENTRY );
+
+    TPtr descriptor( aBuffer->Des() );
+    TIpcArgs args( &descriptor );
+    TInt err = SendReceive( ECmmGetUncategorizedIcon, args );
+
+    OstTraceFunctionExit0( RCMMANAGERAPI_GETUNCATEGORIZEDICON_EXIT );
+    return err;
+    }
+
 // End of file
--- a/cmmanager/cmmgr/cmmcommon/inc/cmmclistatic.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmcommon/inc/cmmclistatic.h	Wed Jun 23 17:49:20 2010 +0100
@@ -22,9 +22,6 @@
 
 #include <e32std.h>
 
-const TUint KCmmDefaultMinHeapSize =  0x1000;  //  4K
-const TUint KCmmDefaultMaxHeapSize = 0x10000;  // 64K
-
 const TInt KCmmDefaultMessageSlots = 2;
 
 _LIT( KCmManagerStartupMutex, "CmManagerStartupMutex" );
@@ -37,12 +34,8 @@
     {
 public:
     static TInt LaunchServer(
-            const TDesC& aServerName,
             const TDesC& aServerFileName,
-            const TUid& aServerUid3,
-            const TUint aWinsMinHeapSize = KCmmDefaultMinHeapSize,
-            const TUint aWinsMaxHeapSize = KCmmDefaultMaxHeapSize,
-            const TUint aWinsStackSize = KDefaultStackSize );
+            const TUid& aServerUid3 );
 
 private:
     static TBool ServerStartupLock( RMutex& mutex, TInt& err );
--- a/cmmanager/cmmgr/cmmcommon/inc/cmmserverdefs.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmcommon/inc/cmmserverdefs.h	Wed Jun 23 17:49:20 2010 +0100
@@ -35,23 +35,11 @@
  */
 _LIT( KCmmServerFile, "cmmserver" );
 
-const TInt KCmmServerStackSize    = 0x5000; //TODO, check if really used (in common code).
-const TInt KCmmServerInitHeapSize = 0x1000; //TODO, check if really used (in common code).
-const TInt KCmmServerMaxHeapSize  = 0x1000000; //TODO, check if really used (in common code).
-
 const TInt KBitsInOneByte = 8;
 const TInt KBitsInTwoBytes = 16;
 const TInt KBitsInThreeBytes = 24;
 
 /**
- * The server version. A version must be specified when creating a session with
- * the server.
- */
-const TUint KCmmServerMajorVersionNumber = 0; //TODO, check if really used (in common code).
-const TUint KCmmServerMinorVersionNumber = 1; //TODO, check if really used (in common code).
-const TUint KCmmServerBuildVersionNumber = 1; //TODO, check if really used (in common code).
-
-/**
  * Amount of time in microseconds that the server will wait before shutting
  * down, after last client has gone.
  */
@@ -73,7 +61,7 @@
 const TUint32 KCmmDestIdIntervalMin = 0x1000;
 const TUint32 KCmmDestIdIntervalMax = 0x1100;
 
-const TInt KCmmStringLengthMax = 1024; //TODO, need to find out correct value here
+const TInt KCmmStringLengthMax = 1024; //TODO, need to find out correct value here. 1024 is correct, but can that be received from commsdat?
 
 const TUint32 KTemporaryIdCounterStart = 32768;
 
@@ -117,19 +105,20 @@
     ECmmReadDefaultConnection                = 8,
     ECmmReadGeneralConnectionSettings        = 9,
     ECmmGetSupportedBearers                  = 10,
+    ECmmGetUncategorizedIcon                 = 11,
 
-    ECmmGetConnMethodInfoInt                 = 11,
-    ECmmGetConnMethodInfoBool                = 12,
-    ECmmGetConnMethodInfoString              = 13,
-    ECmmGetConnMethodInfoString8             = 14,
+    ECmmGetConnMethodInfoInt                 = 12,
+    ECmmGetConnMethodInfoBool                = 13,
+    ECmmGetConnMethodInfoString              = 14,
+    ECmmGetConnMethodInfoString8             = 15,
 
-    ECmmUpdateBearerPriorityArray            = 15,
-    ECmmWriteDefaultConnection               = 16,
-    ECmmWriteGeneralConnectionSettings       = 17,
-    ECmmCopyConnMethod                       = 18,
-    ECmmMoveConnMethod                       = 19,
-    ECmmRemoveConnMethod                     = 20,
-    ECmmRemoveAllReferences                  = 21, // Connection method becomes uncategorized.
+    ECmmUpdateBearerPriorityArray            = 16,
+    ECmmWriteDefaultConnection               = 17,
+    ECmmWriteGeneralConnectionSettings       = 18,
+    ECmmCopyConnMethod                       = 19,
+    ECmmMoveConnMethod                       = 20,
+    ECmmRemoveConnMethod                     = 21,
+    ECmmRemoveAllReferences                  = 22, // Connection method becomes uncategorized.
 
     // RCmDestination starts from 100
     EDestGetDestination                      = 100,
@@ -145,21 +134,23 @@
     EDestIsHidden                            = 110,
     EDestIsEqual                             = 111,
     EDestGetEmbeddedDestination              = 112,
+    EDestGetIcon                             = 113,
 
-    EDestCreateDestinationWithName           = 113,
-    EDestCreateDestinationWithNameAndId      = 114,
-    EDestIsConnected                         = 115,
-    EDestAddConnMethod                       = 116,
-    EDestAddEmbeddedDestination              = 117,
-    EDestDeleteConnMethod                    = 118,
-    EDestRemoveConnMethod                    = 119,
-    EDestModifyPriority                      = 120,
-    EDestSetName                             = 121,
-    EDestSetMetadata                         = 122,
-    EDestSetProtection                       = 123,
-    EDestSetHidden                           = 124,
-    EDestUpdate                              = 125,
-    EDestDelete                              = 126,
+    EDestCreateDestinationWithName           = 114,
+    EDestCreateDestinationWithNameAndId      = 115,
+    EDestIsConnected                         = 116,
+    EDestAddConnMethod                       = 117,
+    EDestAddEmbeddedDestination              = 118,
+    EDestDeleteConnMethod                    = 119,
+    EDestRemoveConnMethod                    = 120,
+    EDestModifyPriority                      = 121,
+    EDestSetName                             = 122,
+    EDestSetMetadata                         = 123,
+    EDestSetProtection                       = 124,
+    EDestSetHidden                           = 125,
+    EDestUpdate                              = 126,
+    EDestDelete                              = 127,
+    EDestSetIcon                             = 128,
 
     //RCmConnectionMethod starts from 200
     ECMGetConnMethodWithId                   = 200,
--- a/cmmanager/cmmgr/cmmcommon/src/cmmclistatic.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmcommon/src/cmmclistatic.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -28,12 +28,8 @@
  * otherwise one of the system wide error codes.
  */
 TInt TCmManagerLauncher::LaunchServer(
-        const TDesC& aServerName,
         const TDesC& aServerFileName,
-        const TUid& aServerUid3,
-        const TUint aWinsMinHeapSize,
-        const TUint aWinsMaxHeapSize,
-        const TUint aWinsStackSize )
+        const TUid& aServerUid3 )
     {
     RMutex mutex;
     TInt err( KErrNone );
@@ -55,10 +51,6 @@
 
     RProcess server;
     err = server.Create( aServerFileName, KNullDesC, serverUid );
-    (void)aServerName;
-    (void)aWinsMinHeapSize;
-    (void)aWinsMaxHeapSize;
-    (void)aWinsStackSize;
 
     if ( err != KErrNone )
         {
--- a/cmmanager/cmmgr/cmmpluginbase/group/cmmpluginbase.mmp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmpluginbase/group/cmmpluginbase.mmp	Wed Jun 23 17:49:20 2010 +0100
@@ -16,7 +16,6 @@
 *
 */
 
-#include <data_caging_paths.hrh>
 #include <platform_paths.hrh>
 
 TARGET          cmmpluginbase.dll
--- a/cmmanager/cmmgr/cmmpluginbase/inc/ccmpluginbaseengtextresolver.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmpluginbase/inc/ccmpluginbaseengtextresolver.h	Wed Jun 23 17:49:20 2010 +0100
@@ -22,7 +22,7 @@
 /**
  *  Utility class for resolving localised text.
  */
-class CCmPluginBaseEngTextResolver
+NONSHARABLE_CLASS( CCmPluginBaseEngTextResolver ) : public CBase
     {
 public:    
     /**
--- a/cmmanager/cmmgr/cmmpluginbase/src/ccmpluginbaseeng.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmpluginbase/src/ccmpluginbaseeng.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -20,7 +20,7 @@
 #include <datamobilitycommsdattypes.h>
 #include <cmpluginbaseeng.h>
 #include <cmpsettingsconsts.h>
-#include <FeatMgr.h>
+#include <featmgr.h>
 
 #include "ccmpluginbaseengtextresolver.h"
 
@@ -94,8 +94,6 @@
 //
 void CCmClientPluginInstance::ConstructL()
     {
-    OstTraceFunctionEntry0( CCMCLIENTPLUGININSTANCE_CONSTRUCTL_ENTRY );
-    OstTraceFunctionExit0( CCMCLIENTPLUGININSTANCE_CONSTRUCTL_EXIT );
     }
 
 
@@ -331,31 +329,31 @@
         User::Leave( KErrAlreadyExists );
         }
 
-    // optional record is disabled in default
+    // Optional record, disabled by default.
     iLocationEnabled = EFalse;
 
-    // create mandatory records
-    iIapRecord = static_cast<CCDIAPRecord *>
-                          (CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
-    iNetworkRecord = static_cast<CCDNetworkRecord *>
-                          (CCDRecordBase::RecordFactoryL(KCDTIdNetworkRecord));
-    iProxyRecord = static_cast<CCDProxiesRecord *>
-                  (CCDRecordBase::RecordFactoryL(KCDTIdProxiesRecord));
+    // Create mandatory records.
+    iIapRecord = static_cast<CCDIAPRecord*>(
+            CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
+    iNetworkRecord = static_cast<CCDNetworkRecord*>(
+            CCDRecordBase::RecordFactoryL( KCDTIdNetworkRecord ) );
+    iProxyRecord = static_cast<CCDProxiesRecord*>(
+            CCDRecordBase::RecordFactoryL( KCDTIdProxiesRecord ) );
     NewWapRecordL();
     iWapIPBearerRecord->iWAPGatewayAddress.SetL( KDefWapGatewayIpAddress );
 
     iMetaDataRecord = NewMetadataRecordL( ETrue );
 
-    // call plugin to create its own records
+    // Call plugin to create its own records.
     CreateServiceRecordL();
 
-    // Update iaprecord servicetype name
+    // Update iaprecord servicetype name.
     HBufC* servicetypeName( NULL );
     ServiceRecordNameLC( servicetypeName );
     iIapRecord->iServiceType.SetL( *servicetypeName );
     CleanupStack::PopAndDestroy( servicetypeName );
 
-    // Update iaprecord bearertype name
+    // Update iaprecord bearertype name.
     HBufC* bearerTypeName( NULL );
     BearerRecordNameLC( bearerTypeName );
     iIapRecord->iBearerType.SetL( *bearerTypeName );
@@ -365,7 +363,7 @@
 
     EnableProxyL( EFalse );
 
-    _LIT(KDefaultConnNameTextId, "txt_occ_setlabel_connection_name_val_connection");
+    _LIT( KDefaultConnNameTextId, "txt_occ_setlabel_connection_name_val_connection" );
     HBufC* resolvedText( NULL );
     resolvedText = CCmPluginBaseEngTextResolver::ResolveTextL( KDefaultConnNameTextId );
     if ( resolvedText != NULL )
@@ -400,23 +398,19 @@
 // ---------------------------------------------------------------------------
 //
 EXPORT_C CCmPluginBaseEng* CCmPluginBaseEng::CreateCopyL(
-    CCmClientPluginInstance* /*aClientPluginInstance*/ )
+        CCmClientPluginInstance* /*aClientPluginInstance*/ )
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_CREATECOPYL_ENTRY );
 
     TCmPluginInitParam params( iSession );
-
     CCmPluginBaseEng* copyInst = CreateInstanceL( params );
     CleanupStack::PushL( copyInst );
 
     PrepareToCopyDataL( copyInst );
-
     CopyDataL( copyInst );
-
     CleanupStack::Pop( copyInst );
 
     OstTraceFunctionExit0( CCMPLUGINBASEENG_CREATECOPYL_EXIT );
-
     return copyInst;
     }
 
@@ -427,7 +421,7 @@
 EXPORT_C void CCmPluginBaseEng::GetGenericTableIdsToBeObserved(
         RArray<TUint32>& aTableIdArray ) const
     {
-    // Service and bearer records should be added by plugins
+    // Service and bearer records should be added by plugins.
 
     aTableIdArray.Append( KCDTIdIAPRecord );
     aTableIdArray.Append( KCDTIdWAPAccessPointRecord );
@@ -460,17 +454,17 @@
 
     CopyRecordDataL( KIapRecordIndex, aCopyInstance );
 
-    // Ensure that iap's name is set by the rules(Naming Method)
-    SetNameL( iIapRecord->iRecordName.GetL(),
-              aCopyInstance->iIapRecord,
-              aCopyInstance->iNamingMethod );
+    // Ensure that IAP's name is set by the rules (Naming Method).
+    SetNameL(
+            iIapRecord->iRecordName.GetL(),
+            aCopyInstance->iIapRecord,
+            aCopyInstance->iNamingMethod );
 
     CopyRecordDataL( KServiceRecordIndex, aCopyInstance );
     CopyRecordDataL( KNetworkRecordIndex, aCopyInstance );
     CopyRecordDataL( KWAPAPRecordIndex, aCopyInstance );
     CopyRecordDataL( KWAPBearerRecordIndex, aCopyInstance );
     CopyRecordDataL( KMetaDataRecordIndex, aCopyInstance );
-    CopyRecordDataL( KLocationRecordIndex, aCopyInstance );
     CopyRecordDataL( KProxyRecordIndex, aCopyInstance );
 
     CopyBearerRecordsL( aCopyInstance );
@@ -499,6 +493,8 @@
         case KServiceRecordIndex:
             {
             aCopyInstance->iServiceRecord = CopyServiceRecordL();
+            // The name of the service record copy is changed during update
+            // process, in PrepareToUpdateRecordsL()-method.
             }
             break;
         case KNetworkRecordIndex:
@@ -521,18 +517,12 @@
             break;
         case KMetaDataRecordIndex:
             {
-            aCopyInstance->iMetaDataRecord =
+            CCDIAPMetadataRecord* metadataRecord =
                     new( ELeave ) CCDIAPMetadataRecord( iMetadataTableId );
-            aCopyInstance->iMetaDataRecord->iIAP = IAPRecordElementId();
-            aCopyInstance->iMetaDataRecord->iMetadata.SetL( iMetaDataRecord->iMetadata );
-            aCopyInstance->iMetaDataRecord->iSeamlessness.SetL( iMetaDataRecord->iSeamlessness );
-            }
-            break;
-        case KLocationRecordIndex:
-            {
-            aCopyInstance->iWapIPBearerRecord =
-                    static_cast<CCDWAPIPBearerRecord*>
-                        ( CCDRecordBase::CreateCopyRecordL( *iWapIPBearerRecord ) );
+            CleanupStack::PushL( metadataRecord );
+            CopyRecordFieldsL( *iMetaDataRecord, *metadataRecord );
+            CleanupStack::Pop( metadataRecord );
+            aCopyInstance->iMetaDataRecord = metadataRecord;
             }
             break;
         case KProxyRecordIndex:
@@ -555,6 +545,87 @@
     }
 
 // ---------------------------------------------------------------------------
+// CCmPluginBaseEng:: CopyRecordFieldsL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::CopyRecordFieldsL(
+        CommsDat::CMDBRecordBase& aSource,
+        CommsDat::CMDBRecordBase& aDestination )
+    {
+    OstTraceFunctionEntry0( CCMPLUGINBASEENG_COPYRECORDFIELDSL_ENTRY );
+
+    const SRecordTypeInfo* recordInfo = aSource.GetRecordInfo();
+    if ( recordInfo == NULL )
+        {
+        User::Leave( KErrCorrupt );
+        }
+
+    CMDBElement* ptrSource( NULL );
+    CMDBElement* ptrDest( NULL );
+
+    while ( recordInfo != NULL && recordInfo->iTypeId != 0 )
+        {
+        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 )
+            {
+            case CommsDat::EInt:
+            case CommsDat::EBool:
+                {
+                if ( !( ptrSource->IsNull() ) )
+                    {
+                    static_cast<CMDBField<TInt>&>( *ptrDest ).SetL(
+                            static_cast<CMDBField<TInt>&>( *ptrSource ) );
+                    }
+                }
+                break;
+            case CommsDat::EUint32:
+            case CommsDat::ELink:
+                {
+                if ( !( ptrSource->IsNull() ) )
+                    {
+                    static_cast<CMDBField<TUint32>&>( *ptrDest ).SetL(
+                            static_cast<CMDBField<TUint32>&>( *ptrSource ) );
+                    }
+                }
+                break;
+            case CommsDat::EDesC8:
+                {
+                if ( !( ptrSource->IsNull() ) )
+                    {
+                    static_cast<CMDBField<TDesC8>&>( *ptrDest ).SetL(
+                            static_cast<CMDBField<TDesC8>&>( *ptrSource ) );
+                    }
+                }
+                break;
+            case CommsDat::EText:
+            case CommsDat::EMedText:
+            case CommsDat::ELongText:
+                {
+                if ( !( ptrSource->IsNull() ) )
+                    {
+                    static_cast<CMDBField<TDesC>&>( *ptrDest ).SetL(
+                            static_cast<CMDBField<TDesC>&>( *ptrSource ) );
+                    }
+                }
+                break;
+            default:
+                {
+                User::Leave( KErrCorrupt );
+                }
+                break;
+            }
+        ptrDest->SetAttributes( ptrSource->Attributes() );
+        recordInfo++;
+        }
+
+    OstTraceFunctionExit0( CCMPLUGINBASEENG_COPYRECORDFIELDSL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
 // CCmPluginBaseEng::DoLoadL
 // ---------------------------------------------------------------------------
 //
@@ -568,7 +639,6 @@
     LoadWapRecordL();
     LoadMetadataRecordL();
     LoadNetworkRecordL();
-    LoadLocationRecordL();
 
     // This is a connectionmethodinfo instance, that has no
     // service and proxy setting.
@@ -637,7 +707,7 @@
 
     // Now try to find the linked proxy record
     // create new record
-    CCDProxiesRecord* proxyRecord = static_cast<CCDProxiesRecord *>(
+    CCDProxiesRecord* proxyRecord = static_cast<CCDProxiesRecord*>(
             CCDRecordBase::RecordFactoryL( KCDTIdProxiesRecord ) );
 
     CleanupStack::PushL( proxyRecord );
@@ -653,7 +723,7 @@
     if ( proxieRS->FindL(iSession) )
         {
         TInt i( 0 );
-        while( i < proxieRS->iRecords.Count() )
+        while ( i < proxieRS->iRecords.Count() )
             // Now that we have a list of services with the proper service type
             // search for our proxy record and remove it from the array,
             // then destroy the array.
@@ -726,27 +796,6 @@
 void CCmPluginBaseEng::LoadLocationRecordL()
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_LOADLOCATIONSETTINGL_ENTRY );
-
-    CCDLocationRecord* locationRecord = static_cast<CCDLocationRecord*>
-                         (CCDRecordBase::RecordFactoryL(KCDTIdLocationRecord));
-
-    CleanupStack::PushL( locationRecord );
-
-    locationRecord->SetRecordId( iIapRecord->iLocation );
-    if ( locationRecord->FindL(iSession) )
-        {
-        iLocationEnabled = ETrue;
-
-        iLocationRecord = locationRecord;
-
-        CleanupStack::Pop( locationRecord );
-        }
-    else
-        {
-        iLocationEnabled = EFalse;
-
-        CleanupStack::PopAndDestroy( locationRecord );
-        }
     OstTraceFunctionExit0( CCMPLUGINBASEENG_LOADLOCATIONSETTINGL_EXIT );
     }
 
@@ -755,24 +804,28 @@
 // ---------------------------------------------------------------------------
 //
 void CCmPluginBaseEng::PrepareToUpdateRecordsL(
-    CCmClientPluginInstance* aClientPluginInstance )
+        CCmClientPluginInstance* aClientPluginInstance )
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_PREPARETOUPDATERECORDSL_ENTRY );
 
-    // Set the record attributes to bearer specific records
-    CCDIAPRecord* iapRecord =
-       static_cast<CCDIAPRecord*>( aClientPluginInstance->iGenRecordArray[KIapRecordIndex] );
+    //TODO, Add null checks for mandatory generic record pointers.
+    //
+
+    // Set the record attributes to bearer specific records.
+    CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord*>(
+            aClientPluginInstance->iGenRecordArray[KIapRecordIndex] );
 
     for ( TInt i = 0; i < aClientPluginInstance->iBearerSpecRecordArray.Count(); i++ )
         {
-        CCDRecordBase* record =
-                static_cast<CCDRecordBase*>( aClientPluginInstance->iBearerSpecRecordArray[i] );
+        CCDRecordBase* record = static_cast<CCDRecordBase*>(
+                aClientPluginInstance->iBearerSpecRecordArray[i] );
 
         CopyAttributes( iapRecord, record );
         }
 
-    PreparePluginToUpdateRecordsL( aClientPluginInstance->iGenRecordArray,
-                                   aClientPluginInstance->iBearerSpecRecordArray );
+    PreparePluginToUpdateRecordsL(
+            aClientPluginInstance->iGenRecordArray,
+            aClientPluginInstance->iBearerSpecRecordArray );
 
     OstTraceFunctionExit0( CCMPLUGINBASEENG_PREPARETOUPDATERECORDSL_EXIT );
     }
@@ -782,16 +835,16 @@
 // ---------------------------------------------------------------------------
 //
 void CCmPluginBaseEng::UpdateIAPRecordL(
-    CCmClientPluginInstance* aClientPluginInstance )
+        CCmClientPluginInstance* aClientPluginInstance )
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_UPDATEIAPRECORDL_ENTRY );
 
-    CCDIAPRecord* iapRecord =
-       static_cast<CCDIAPRecord*>( aClientPluginInstance->iGenRecordArray[KIapRecordIndex] );
+    CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord*>(
+            aClientPluginInstance->iGenRecordArray[KIapRecordIndex] );
 
     if ( iIapId == 0 )
         {
-        // Otherwise predefined iapid
+        // Otherwise predefined iapid.
         if ( !iIapRecord->RecordId() )
             {
             iIapRecord->SetRecordId( KCDNewRecordRequest );
@@ -814,14 +867,7 @@
 
         iIapRecord->iNetwork = iNetworkRecord->RecordId();
 
-        if ( iLocationRecord )
-            {
-            iIapRecord->iLocation = iLocationRecord->RecordId();
-            }
-        else
-            {
-            iIapRecord->iLocation = GetLocationIdL();
-            }
+        iIapRecord->iLocation = GetLocationIdL();
 
         CopyAttributes( iapRecord, iIapRecord );
         CheckIfNameModifiedL( iapRecord, iIapRecord );
@@ -840,24 +886,24 @@
         CleanupStack::PushL( iapRecord );
 
         aClientPluginInstance->iGenRecordArray.InsertL(
-                static_cast<CommsDat::CCDRecordBase*>( tempIapRecord ), KIapRecordIndex );
+                static_cast<CommsDat::CCDRecordBase*>( tempIapRecord ),
+                KIapRecordIndex );
 
         CleanupStack::PopAndDestroy( iapRecord );
         CleanupStack::Pop( tempIapRecord );
-
         }
     else
         {
         delete iIapRecord;
         iIapRecord = NULL;
 
-        iIapRecord = static_cast<CCDIAPRecord*>
-                            ( CCDRecordBase::CreateCopyRecordL( *iapRecord ) );
+        iIapRecord = static_cast<CCDIAPRecord*>(
+                CCDRecordBase::CreateCopyRecordL( *iapRecord ) );
 
         iIapRecord->SetElementId( iapRecord->ElementId() );
-
         iIapRecord->ModifyL( iSession );
         }
+
     OstTraceFunctionExit0( CCMPLUGINBASEENG_UPDATEIAPRECORDL_EXIT );
     }
 
@@ -876,6 +922,11 @@
     CCDProxiesRecord* proxyRecord = static_cast<CCDProxiesRecord*>(
             aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] );
 
+    if ( !iapRecord || !proxyRecord )
+        {
+        User::Leave( KErrCorrupt );
+        }
+
     CopyAttributes( iapRecord, proxyRecord );
     CheckIfNameModifiedL( iapRecord, proxyRecord );
 
@@ -884,17 +935,17 @@
         delete iProxyRecord;
         iProxyRecord = NULL;
 
-        iProxyRecord = static_cast<CCDProxiesRecord*>
-                            ( CCDRecordBase::CreateCopyRecordL( *proxyRecord ) );
+        iProxyRecord = static_cast<CCDProxiesRecord*>(
+                CCDRecordBase::CreateCopyRecordL( *proxyRecord ) );
         iProxyRecord->SetElementId( proxyRecord->ElementId() );
 
         if ( !iProxyRecord->RecordId() )
-            // new proxy setting -> create new record
             {
+            // New proxy setting -> create new record.
             iProxyRecord->iService = iServiceRecord->RecordId();
             iProxyRecord->iServiceType.SetL( iIapRecord->iServiceType );
 
-            // By default protocol is set to "http"
+            // By default protocol is set to "http".
             if ( TPtrC( proxyRecord->iProtocolName ).Length() == 0 )
                 {
                 iProxyRecord->iProtocolName.SetL( KDefProxyProtocolName );
@@ -907,7 +958,7 @@
             proxyRecord->iServiceType.SetL( iIapRecord->iServiceType );
             }
         else
-            // already existing record -> update only
+            // Already existing record -> update only.
             {
             iProxyRecord->ModifyL( iSession );
             }
@@ -919,6 +970,7 @@
             iProxyRecord->DeleteL( iSession );
             }
         }
+
     OstTraceFunctionExit0( CCMPLUGINBASEENG_UPDATEPROXYRECORDL_EXIT );
     }
 
@@ -931,32 +983,29 @@
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_UPDATEMETADATARECORDL_ENTRY );
 
-    CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord*>(
+    CCDIAPRecord* clientIapRecord = static_cast<CCDIAPRecord*>(
             aClientPluginInstance->iGenRecordArray[KIapRecordIndex] );
 
-    CCDIAPMetadataRecord* metadataRecord = static_cast<CCDIAPMetadataRecord*>(
+    CCDIAPMetadataRecord* clientMetadataRecord = static_cast<CCDIAPMetadataRecord*>(
             aClientPluginInstance->iGenRecordArray[KMetaDataRecordIndex] );
 
-    CopyAttributes( iapRecord, metadataRecord );
-    CheckIfNameModifiedL( iapRecord, metadataRecord );
-
+    // Adjust client side metadata record attributes and name if needed.
+    CopyAttributes( clientIapRecord, clientMetadataRecord );
+    CheckIfNameModifiedL( clientIapRecord, clientMetadataRecord );
+
+    // Make a copy of client's metadata record and save to database.
     delete iMetaDataRecord;
     iMetaDataRecord = NULL;
-
-    // Get a new blank IAP metadata record.
-    iMetaDataRecord = NewMetadataRecordL( EFalse );
-
-    iMetaDataRecord->SetElementId( metadataRecord->ElementId() );
-    iMetaDataRecord->iRecordName.SetL( metadataRecord->iRecordName );
-    iMetaDataRecord->iMetadata.SetL( metadataRecord->iMetadata );
-    iMetaDataRecord->iSeamlessness.SetL( metadataRecord->iSeamlessness );
+    iMetaDataRecord = new( ELeave ) CCDIAPMetadataRecord( iMetadataTableId );
+    CopyRecordFieldsL( *clientMetadataRecord, *iMetaDataRecord );
+    iMetaDataRecord->SetElementId( clientMetadataRecord->ElementId() );
 
     if ( !iMetaDataRecord->RecordId() )
         {
         iMetaDataRecord->iIAP = IAPRecordElementId();
         iMetaDataRecord->SetRecordId( KCDNewRecordRequest );
         iMetaDataRecord->StoreL( iSession );
-        metadataRecord->SetElementId( iMetaDataRecord->ElementId() );
+        clientMetadataRecord->SetElementId( iMetaDataRecord->ElementId() );
         }
     else
         {
@@ -975,16 +1024,17 @@
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_UPDATESERVICERECORDL_ENTRY );
 
-    CCDIAPRecord* iapRecord =
-                static_cast<CCDIAPRecord*>( aClientPluginInstance->iGenRecordArray[KIapRecordIndex] );
-
-    CCDRecordBase* serviceRecord =
-                static_cast<CCDRecordBase*>( aClientPluginInstance->iGenRecordArray[KServiceRecordIndex] );
+    CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord*>(
+            aClientPluginInstance->iGenRecordArray[KIapRecordIndex] );
+
+    CCDRecordBase* serviceRecord = static_cast<CCDRecordBase*>(
+            aClientPluginInstance->iGenRecordArray[KServiceRecordIndex] );
 
     CopyAttributes( iapRecord, serviceRecord );
 
-    UpdateServiceRecordL( aClientPluginInstance->iGenRecordArray,
-                          aClientPluginInstance->iBearerSpecRecordArray );
+    UpdateServiceRecordL(
+            aClientPluginInstance->iGenRecordArray,
+            aClientPluginInstance->iBearerSpecRecordArray );
 
     OstTraceFunctionExit0( CCMPLUGINBASEENG_UPDATESERVICERECORDL_EXIT );
     }
@@ -994,15 +1044,15 @@
 // ---------------------------------------------------------------------------
 //
 void CCmPluginBaseEng::UpdateNetworkRecordL(
-    CCmClientPluginInstance* aClientPluginInstance )
+        CCmClientPluginInstance* aClientPluginInstance )
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_UPDATENETWORKRECORDL_ENTRY );
 
-    CCDIAPRecord* iapRecord =
-                static_cast<CCDIAPRecord*>( aClientPluginInstance->iGenRecordArray[KIapRecordIndex] );
-
-    CCDNetworkRecord* networkRecord =
-                static_cast<CCDNetworkRecord*>( aClientPluginInstance->iGenRecordArray[KNetworkRecordIndex] );
+    CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord*>(
+            aClientPluginInstance->iGenRecordArray[KIapRecordIndex] );
+
+    CCDNetworkRecord* networkRecord = static_cast<CCDNetworkRecord*>(
+            aClientPluginInstance->iGenRecordArray[KNetworkRecordIndex] );
 
     CopyAttributes( iapRecord, networkRecord );
 
@@ -1011,8 +1061,8 @@
 
     CheckIfNameModifiedL( iapRecord, networkRecord );
 
-    iNetworkRecord = static_cast<CCDNetworkRecord*>
-                        ( CCDRecordBase::CreateCopyRecordL( *networkRecord ) );
+    iNetworkRecord = static_cast<CCDNetworkRecord*>(
+            CCDRecordBase::CreateCopyRecordL( *networkRecord ) );
 
     iNetworkRecord->SetElementId( networkRecord->ElementId() );
 
@@ -1026,6 +1076,7 @@
         {
         iNetworkRecord->ModifyL( iSession );
         }
+
     OstTraceFunctionExit0( CCMPLUGINBASEENG_UPDATENETWORKRECORDL_EXIT );
     }
 
@@ -1034,49 +1085,9 @@
 // ---------------------------------------------------------------------------
 //
 void CCmPluginBaseEng::UpdateLocationRecordL(
-    CCmClientPluginInstance* aClientPluginInstance )
+        CCmClientPluginInstance* /*aClientPluginInstance*/ )
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_UPDATELOCATIONRECORDL_ENTRY );
-
-    if ( iLocationEnabled )
-        {
-        CCDIAPRecord* iapRecord =
-                    static_cast<CCDIAPRecord*>( aClientPluginInstance->iGenRecordArray[KIapRecordIndex] );
-
-        CCDLocationRecord* locationRecord =
-                    static_cast<CCDLocationRecord*>( aClientPluginInstance->iGenRecordArray[KLocationRecordIndex] );
-
-        // location record is not set as hidden because it can be shared between iaps
-        CopyAttributes( iapRecord, locationRecord );
-        locationRecord->ClearAttributes( ECDHidden );
-
-        delete iLocationRecord;
-        iLocationRecord = NULL;
-
-        iLocationRecord = static_cast<CCDLocationRecord*>
-                            ( CCDRecordBase::CreateCopyRecordL( *locationRecord ) );
-
-        iLocationRecord->SetElementId( locationRecord->ElementId() );
-
-        CheckIfNameModifiedL( iapRecord, locationRecord );
-
-        if ( !iLocationRecord->RecordId() )
-            {
-            iLocationRecord->SetRecordId( KCDNewRecordRequest );
-            iLocationRecord->StoreL( iSession );
-            }
-        else
-            {
-            iLocationRecord->ModifyL( iSession );
-            }
-        }
-    else
-        {
-        if ( iLocationRecord )
-            {
-            iLocationRecord->DeleteL( iSession );
-            }
-        }
     OstTraceFunctionExit0( CCMPLUGINBASEENG_UPDATELOCATIONRECORDL_EXIT );
     }
 
@@ -1105,8 +1116,8 @@
 
     if ( !iProxyRecord )
         {
-        iProxyRecord = static_cast<CCDProxiesRecord *>
-                      (CCDRecordBase::RecordFactoryL(KCDTIdProxiesRecord));
+        iProxyRecord = static_cast<CCDProxiesRecord *>(
+                CCDRecordBase::RecordFactoryL( KCDTIdProxiesRecord ) );
         }
 
     iProxyRecord->iUseProxyServer = aEnable;
@@ -1122,15 +1133,7 @@
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_ENABLELOCATIONL_ENTRY );
 
-    if ( aEnable )
-        {
-        if ( !iLocationRecord )
-            {
-            iLocationRecord = static_cast<CCDLocationRecord *>
-                         (CCDRecordBase::RecordFactoryL(KCDTIdLocationRecord));
-            }
-        }
-
+    // Not supported anymore
     iLocationEnabled = aEnable;
 
     OstTraceFunctionExit0( CCMPLUGINBASEENG_ENABLELOCATIONL_EXIT );
@@ -1147,8 +1150,8 @@
     iWapIPBearerRecord = FindWAPRecordL();
     if ( iWapIPBearerRecord )
         {
-        CCDWAPAccessPointRecord *wapApRecord = static_cast<CCDWAPAccessPointRecord *>
-                   (CCDRecordBase::RecordFactoryL(KCDTIdWAPAccessPointRecord));
+        CCDWAPAccessPointRecord *wapApRecord = static_cast<CCDWAPAccessPointRecord*>(
+                CCDRecordBase::RecordFactoryL( KCDTIdWAPAccessPointRecord ) );
 
         CleanupStack::PushL( wapApRecord );
 
@@ -1158,8 +1161,8 @@
             {
             CleanupStack::PopAndDestroy( wapApRecord );
 
-            wapApRecord = static_cast<CCDWAPAccessPointRecord *>
-                   (CCDRecordBase::RecordFactoryL(KCDTIdWAPAccessPointRecord));
+            wapApRecord = static_cast<CCDWAPAccessPointRecord*>(
+                    CCDRecordBase::RecordFactoryL( KCDTIdWAPAccessPointRecord ) );
             }
         else
             {
@@ -1175,6 +1178,7 @@
         {
         NewWapRecordL();
         }
+
     OstTraceFunctionExit0( CCMPLUGINBASEENG_LOADWAPRECORDL_EXIT );
     }
 
@@ -1196,7 +1200,7 @@
 // ---------------------------------------------------------------------------
 //
 void CCmPluginBaseEng::UpdateWapRecordL(
-    CCmClientPluginInstance* aClientPluginInstance )
+        CCmClientPluginInstance* aClientPluginInstance )
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_UPDATEWAPRECORDL_ENTRY );
 
@@ -1206,14 +1210,14 @@
     delete iWapIPBearerRecord;
     iWapIPBearerRecord = NULL;
 
-    CCDIAPRecord* iapRecord =
-        static_cast<CCDIAPRecord*>( aClientPluginInstance->iGenRecordArray[KIapRecordIndex] );
-
-    CCDWAPAccessPointRecord* wapAPRecord =
-        static_cast<CCDWAPAccessPointRecord*>( aClientPluginInstance->iGenRecordArray[KWAPAPRecordIndex] );
-
-    CCDWAPIPBearerRecord* wapIPBearerRecord =
-        static_cast<CCDWAPIPBearerRecord*>( aClientPluginInstance->iGenRecordArray[KWAPBearerRecordIndex] );
+    CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord*>(
+            aClientPluginInstance->iGenRecordArray[KIapRecordIndex] );
+
+    CCDWAPAccessPointRecord* wapAPRecord = static_cast<CCDWAPAccessPointRecord*>(
+            aClientPluginInstance->iGenRecordArray[KWAPAPRecordIndex] );
+
+    CCDWAPIPBearerRecord* wapIPBearerRecord = static_cast<CCDWAPIPBearerRecord*>(
+            aClientPluginInstance->iGenRecordArray[KWAPBearerRecordIndex] );
 
     CopyAttributes( iapRecord, wapAPRecord );
     CopyAttributes( iapRecord, wapIPBearerRecord );
@@ -1221,12 +1225,12 @@
     CheckIfNameModifiedL( iapRecord, wapAPRecord );
     CheckIfNameModifiedL( iapRecord, wapIPBearerRecord );
 
-    iWapAPRecord = static_cast<CCDWAPAccessPointRecord*>
-                            ( CCDRecordBase::CreateCopyRecordL( *wapAPRecord ) );
+    iWapAPRecord = static_cast<CCDWAPAccessPointRecord*>(
+            CCDRecordBase::CreateCopyRecordL( *wapAPRecord ) );
     iWapAPRecord->SetElementId( wapAPRecord->ElementId() );
 
-    iWapIPBearerRecord = static_cast<CCDWAPIPBearerRecord*>
-                        ( CCDRecordBase::CreateCopyRecordL( *wapIPBearerRecord ) );
+    iWapIPBearerRecord = static_cast<CCDWAPIPBearerRecord*>(
+            CCDRecordBase::CreateCopyRecordL( *wapIPBearerRecord ) );
     iWapIPBearerRecord->SetElementId( wapIPBearerRecord->ElementId() );
 
     if ( !iWapAPRecord->RecordId() )
@@ -1256,6 +1260,7 @@
         {
         iWapIPBearerRecord->ModifyL( iSession );
         }
+
     OstTraceFunctionExit0( DUP1_CCMPLUGINBASEENG_UPDATEWAPRECORDL_EXIT );
     }
 
@@ -1269,8 +1274,8 @@
 
     if ( !iWapIPBearerRecord )
         {
-        iWapIPBearerRecord = static_cast<CCDWAPIPBearerRecord *>
-                      ( CCDRecordBase::RecordFactoryL( KCDTIdWAPIPBearerRecord ) );
+        iWapIPBearerRecord = static_cast<CCDWAPIPBearerRecord*>(
+                CCDRecordBase::RecordFactoryL( KCDTIdWAPIPBearerRecord ) );
         iWapIPBearerRecord->iWAPProxyPort = 0;
         iWapIPBearerRecord->iWAPWSPOption = ECmWapWspOptionConnectionOriented;
         iWapIPBearerRecord->iWAPSecurity = EFalse;
@@ -1278,11 +1283,12 @@
 
     if ( !iWapAPRecord )
         {
-        iWapAPRecord = static_cast<CCDWAPAccessPointRecord *>
-                   ( CCDRecordBase::RecordFactoryL( KCDTIdWAPAccessPointRecord ) );
-        // SMS bearer is not supported by this version
+        iWapAPRecord = static_cast<CCDWAPAccessPointRecord*>(
+                CCDRecordBase::RecordFactoryL( KCDTIdWAPAccessPointRecord ) );
+        // SMS bearer is not supported by this version.
         iWapAPRecord->iWAPCurrentBearer.SetL( TPtrC( KCDTypeNameWAPIPBearer ) );
         }
+
     OstTraceFunctionExit0( CCMPLUGINBASEENG_NEWWAPRECORDL_EXIT );
     }
 
@@ -1313,9 +1319,10 @@
 // CCmPluginBaseEng::SetAttribute
 // ---------------------------------------------------------------------------
 //
-void CCmPluginBaseEng::SetAttribute( CCDRecordBase* aRecord,
-                                     TUint32 aAttribute,
-                                     TBool aSet )
+void CCmPluginBaseEng::SetAttribute(
+        CCDRecordBase* aRecord,
+        TUint32 aAttribute,
+        TBool aSet )
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_SETATTRIBUTE_ENTRY );
 
@@ -1335,22 +1342,23 @@
 // CCmPluginBaseEng::CopyAttributes
 // ---------------------------------------------------------------------------
 //
-void CCmPluginBaseEng::CopyAttributes( CCDRecordBase* aSrcRecord,
-                                       CCDRecordBase* aDstRecord )
+void CCmPluginBaseEng::CopyAttributes(
+        CCDRecordBase* aSrcRecord,
+        CCDRecordBase* aDstRecord )
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_COPYATTRIBUTES_ENTRY );
 
     if ( aSrcRecord == NULL || aDstRecord == NULL )
         {
+        OstTraceFunctionExit0( CCMPLUGINBASEENG_COPYATTRIBUTES_EXIT );
         return;
         }
 
-    // clear the target record attributes first
+    // Clear the target record attributes first.
     aDstRecord->ClearAttributes( aDstRecord->Attributes() );
-
     aDstRecord->SetAttributes( aSrcRecord->Attributes() );
 
-    OstTraceFunctionExit0( CCMPLUGINBASEENG_COPYATTRIBUTES_EXIT );
+    OstTraceFunctionExit0( DUP1_CCMPLUGINBASEENG_COPYATTRIBUTES_EXIT );
     }
 
 // ---------------------------------------------------------------------------
@@ -1362,12 +1370,11 @@
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_FINDWAPRECORDL_ENTRY );
 
     CMDBRecordSet<CCDWAPIPBearerRecord>* wapRS =
-            new(ELeave)
-                   CMDBRecordSet<CCDWAPIPBearerRecord>(KCDTIdWAPIPBearerRecord);
+            new( ELeave ) CMDBRecordSet<CCDWAPIPBearerRecord>( KCDTIdWAPIPBearerRecord );
     CleanupStack::PushL( wapRS );
 
-    CCDWAPIPBearerRecord* wapBearerRecord = static_cast<CCDWAPIPBearerRecord *>
-                      (CCDRecordBase::RecordFactoryL(KCDTIdWAPIPBearerRecord));
+    CCDWAPIPBearerRecord* wapBearerRecord = static_cast<CCDWAPIPBearerRecord*>(
+            CCDRecordBase::RecordFactoryL( KCDTIdWAPIPBearerRecord ) );
 
     CleanupStack::PushL( wapBearerRecord );
 
@@ -1377,19 +1384,17 @@
     CleanupStack::Pop( wapBearerRecord );
     wapBearerRecord = NULL;
 
-    if ( wapRS->FindL(iSession) )
+    if ( wapRS->FindL( iSession ) )
         {
-        wapBearerRecord =
-                        static_cast<CCDWAPIPBearerRecord *>(wapRS->iRecords[0]);
-
-        // we take over the ownership of this record
+        wapBearerRecord = static_cast<CCDWAPIPBearerRecord*>( wapRS->iRecords[0] );
+
+        // Take over the ownership of this record.
         wapRS->iRecords.Remove( 0 );
         }
 
     CleanupStack::PopAndDestroy( wapRS );
 
     OstTraceFunctionExit0( CCMPLUGINBASEENG_FINDWAPRECORDL_EXIT );
-
     return wapBearerRecord;
     }
 
@@ -1402,12 +1407,11 @@
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_FINDSEAMLESSNESSRECORDL_ENTRY );
 
     CMDBRecordSet<CCDIAPMetadataRecord>* metadataRecordSet =
-          new(ELeave) CMDBRecordSet<CCDIAPMetadataRecord>( iMetadataTableId );
+            new( ELeave ) CMDBRecordSet<CCDIAPMetadataRecord>( iMetadataTableId );
     CleanupStack::PushL( metadataRecordSet );
 
     CCDIAPMetadataRecord* metadataRecord =
-            new (ELeave) CCDIAPMetadataRecord( iMetadataTableId );
-
+            new( ELeave ) CCDIAPMetadataRecord( iMetadataTableId );
     CleanupStack::PushL( metadataRecord );
 
     metadataRecord->iIAP = IAPRecordElementId();
@@ -1434,7 +1438,6 @@
     CleanupStack::PopAndDestroy( metadataRecordSet );
 
     OstTraceFunctionExit0( CCMPLUGINBASEENG_FINDSEAMLESSNESSRECORDL_EXIT );
-
     return metadataRecord;
     }
 
@@ -1442,8 +1445,9 @@
 // CCmPluginBaseEng::DoMakeValidNameL
 // ---------------------------------------------------------------------------
 //
-HBufC* CCmPluginBaseEng::DoMakeValidNameL( const TDesC& aName,
-                                           const TUint32& aIapId  )
+HBufC* CCmPluginBaseEng::DoMakeValidNameL(
+        const TDesC& aName,
+        const TUint32& aIapId )
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_DOMAKEVALIDNAMEL_ENTRY );
 
@@ -1469,9 +1473,9 @@
             {
             changed = ETrue;
             postfix++;
-            // check the length of postfix, check text length accordingly
+            // Check the length of postfix, check text length accordingly.
             pf = postfix;
-            for (i=1; i<10; i++)
+            for ( i = 1; i < 10; i++ )
                 {
                 pf /= 10;
                 if ( !pf )
@@ -1496,7 +1500,7 @@
                 }
             if ( postfix )
                 {
-                TBuf< KMaxPostfixLength > postfixString;
+                TBuf<KMaxPostfixLength> postfixString;
                 if ( postfix > 9 )
                     {
                     postfixString.Format( KFormatLargePostfix, postfix );
@@ -1507,8 +1511,7 @@
                     postfixString.Format( KFormatPostfix, postfix );
 //     TODO:               AknTextUtils::LanguageSpecificNumberConversion( postfixString );
                     }
-                sgdptr.Format( KFormatNameWithPostfix, &sgdptr2,
-                                   &postfixString );
+                sgdptr.Format( KFormatNameWithPostfix, &sgdptr2, &postfixString );
                 }
             else
                 {
@@ -1531,7 +1534,6 @@
         }
 
     OstTraceFunctionExit0( CCMPLUGINBASEENG_DOMAKEVALIDNAMEL_EXIT );
-
     return temp;
     }
 
@@ -1539,8 +1541,9 @@
 // CCmPluginBaseEng::EnsureMaxLengthLC
 // ---------------------------------------------------------------------------
 //
-HBufC* CCmPluginBaseEng::EnsureMaxLengthLC( const TDesC& aName,
-                                            TBool& aChanged )
+HBufC* CCmPluginBaseEng::EnsureMaxLengthLC(
+        const TDesC& aName,
+        TBool& aChanged )
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_ENSUREMAXLENGTHLC_ENTRY );
 
@@ -1556,7 +1559,8 @@
 
     HBufC* corrname;
     if ( KApMaxConnNameLength < length )
-        { // name too long, truncate.
+        {
+        // Name too long, truncate.
         corrname = aName.Left( KApMaxConnNameLength ).AllocLC();
         aChanged = ETrue;
         }
@@ -1568,7 +1572,7 @@
             {
             User::Leave( KErrArgument );
             }
-        // comes here only if name is valid
+        // Comes here only if name is valid.
         if ( corrname->Length() != aName.Length() )
             {
             aChanged = ETrue;
@@ -1576,7 +1580,6 @@
         }
 
     OstTraceFunctionExit0( CCMPLUGINBASEENG_ENSUREMAXLENGTHLC_EXIT );
-
     return corrname;
     }
 
@@ -1613,8 +1616,8 @@
             prefix.Set( aName.Left( lastBrace ) );
             }
         }
+
     OstTraceFunctionExit0( CCMPLUGINBASEENG_GETPREFIX_EXIT );
-
     return prefix;
     }
 
@@ -1682,8 +1685,8 @@
                 }
             }
         }
+
     OstTraceFunctionExit0( CCMPLUGINBASEENG_GETPOSTFIX_EXIT );
-
     return postfix;
     }
 
@@ -1691,49 +1694,46 @@
 // CCmPluginBaseEng::IsValidNameL
 // ---------------------------------------------------------------------------
 //
-TBool CCmPluginBaseEng::IsValidNameL( const TDesC& aNameText,
-                                      const TUint32& aIapId )
+TBool CCmPluginBaseEng::IsValidNameL(
+        const TDesC& aNameText,
+        const TUint32& aIapId )
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_ISVALIDNAMEL_ENTRY );
 
     TBool retVal( ETrue );
 
     CMDBRecordSet<CCDIAPRecord>* iapRS =
-                      new(ELeave) CMDBRecordSet<CCDIAPRecord>(KCDTIdIAPRecord);
+            new( ELeave ) CMDBRecordSet<CCDIAPRecord>(KCDTIdIAPRecord);
     CleanupStack::PushL(iapRS);
 
-    CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord *>
-                            (CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
-
+    CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord*>(
+            CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
     CleanupStack::PushL( iapRecord );
 
-    // Prime record
+    // Prime record.
     iapRecord->iRecordName.SetL( aNameText );
-
     iapRS->iRecords.AppendL( iapRecord );
-
     CleanupStack::Pop( iapRecord );
-
     iapRecord = NULL;
 
-    if ( iapRS->FindL(iSession) )
+    if ( iapRS->FindL( iSession ) )
         {
         if ( iIapId )
-            // this is not a new CM
             {
+            // This is not a new CM.
             for ( TInt i = 0; i < iapRS->iRecords.Count(); ++i )
                 {
                 if ( iapRS->iRecords[i]->RecordId() != aIapId )
-                    // duplication because it's not our name
                     {
+                    // Duplication because it's not our name.
                     retVal = EFalse;
                     break;
                     }
                 }
             }
         else
-            // new CM -> any occurence is a duplication
             {
+            // New CM -> any occurence is a duplication.
             retVal = EFalse;
             }
         }
@@ -1741,7 +1741,6 @@
     CleanupStack::PopAndDestroy( iapRS );
 
     OstTraceFunctionExit0( CCMPLUGINBASEENG_ISVALIDNAMEL_EXIT );
-
     return retVal;
     }
 
@@ -1760,7 +1759,7 @@
     TUint quote( '\'' );  // TChar gives warnings in THUMB & ARMI
     TInt i( 0 );
 
-    for ( i=0; i<l; i++ )
+    for ( i = 0; i < l; i++ )
         {
         ret.Append( aLiteral[i] );
         if ( aLiteral[i] == quote )
@@ -1769,8 +1768,8 @@
             ret.Append( quote );
             }
         }
+
     OstTraceFunctionExit0( CCMPLUGINBASEENG_ESCAPETEXTLC_EXIT );
-
     return retbuf;
     }
 
@@ -1791,7 +1790,7 @@
         HBufC* newName = DoMakeValidNameL( aName, iIapId );
 
         if ( newName )
-            // name converted to unique
+            // Name converted to unique.
             {
             CleanupStack::PushL( newName );
             iIapRecord->iRecordName.SetL( *newName );
@@ -1817,6 +1816,7 @@
         {
         User::Leave( KErrCorrupt );
         }
+
     OstTraceFunctionExit0( CCMPLUGINBASEENG_SETDEFAULTNAMEL_EXIT );
     }
 
@@ -1841,7 +1841,7 @@
         HBufC* newName = DoMakeValidNameL( aName, iapid );
 
         if ( newName )
-            // name converted to unique
+            // Name converted to unique.
             {
             CleanupStack::PushL( newName );
             aIapRecord->iRecordName.SetL( *newName );
@@ -1880,9 +1880,14 @@
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_CHECKIFNAMEMODIFIEDL_ENTRY );
 
+    if ( !aSrcRecord || !aDestRecord )
+        {
+        User::Leave( KErrCorrupt );
+        }
+
     if ( !TPtrC( aSrcRecord->iRecordName ).CompareF( TPtrC( aDestRecord->iRecordName ) ) )
-        // names matche
         {
+        // Names match.
         OstTraceFunctionExit0( CCMPLUGINBASEENG_CHECKIFNAMEMODIFIEDL_EXIT );
         return;
         }
@@ -1897,8 +1902,6 @@
 // ---------------------------------------------------------------------------
 TMDBElementId CCmPluginBaseEng::IAPRecordElementId() const
     {
-    OstTraceFunctionEntry0( CCMPLUGINBASEENG_IAPRECORDELEMENTID_ENTRY );
-
     return ( KCDMaskShowField & iIapRecord->ElementId() );
     }
 
@@ -1921,45 +1924,43 @@
 
     TUint32 locId( 0 );
     CMDBRecordSet<CCDLocationRecord>* locRS =
-            new(ELeave) CMDBRecordSet<CCDLocationRecord>(KCDTIdLocationRecord);
+            new( ELeave ) CMDBRecordSet<CCDLocationRecord>( KCDTIdLocationRecord );
     CleanupStack::PushL( locRS );
 
-    CCDLocationRecord* locRecord = static_cast<CCDLocationRecord *>
-                         (CCDRecordBase::RecordFactoryL(KCDTIdLocationRecord));
-
+    CCDLocationRecord* locRecord = static_cast<CCDLocationRecord*>(
+            CCDRecordBase::RecordFactoryL( KCDTIdLocationRecord ) );
     CleanupStack::PushL( locRecord );
+
     locRecord->iRecordName.SetL( KLocationName );
     locRS->iRecords.AppendL( locRecord );
     CleanupStack::Pop( locRecord );
 
     if ( locRS->FindL(iSession) )
         {
-        locRecord = static_cast<CCDLocationRecord *>(locRS->iRecords[0]);
-
+        locRecord = static_cast<CCDLocationRecord*>( locRS->iRecords[0] );
         locId = locRecord->RecordId();
         }
     else
         {
-        User::Leave( KErrNotFound );
+        User::Leave( KErrNotFound ); //TODO, what to do if not found. Can we create it? need study.
         }
 
     CleanupStack::PopAndDestroy( locRS );
 
     OstTraceFunctionExit0( CCMPLUGINBASEENG_GETLOCATIONIDL_EXIT );
-
     return locId;
     }
 
 // ---------------------------------------------------------------------------
 // CCmPluginBaseEng::SetProxyServerNameL
 // ---------------------------------------------------------------------------
- void CCmPluginBaseEng::SetProxyServerNameL( const TDesC& aProxyServer,
-                                             CCDRecordBase* aProxyRecord )
+ void CCmPluginBaseEng::SetProxyServerNameL(
+         const TDesC& aProxyServer,
+         CCDRecordBase* aProxyRecord )
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_SETPROXYSERVERNAMEL_ENTRY );
 
-    CCDProxiesRecord* proxyRecord =
-                    static_cast<CCDProxiesRecord*>( aProxyRecord );
+    CCDProxiesRecord* proxyRecord = static_cast<CCDProxiesRecord*>( aProxyRecord );
 
     proxyRecord->iServerName.SetL( aProxyServer );
     if ( !aProxyServer.Length() )
@@ -1979,10 +1980,11 @@
 // CCmPluginBaseEng::CheckDNSServerAddressL
 // ---------------------------------------------------------------------------
 //
-EXPORT_C void CCmPluginBaseEng::CheckDNSServerAddressL( TBool aIPv6,
-                                                        CMDBField<TDesC>& aDNS1,
-                                                        CMDBField<TDesC>& aDNS2,
-                                                        CMDBField<TBool>& aDNSFromServer )
+EXPORT_C void CCmPluginBaseEng::CheckDNSServerAddressL(
+        TBool aIPv6,
+        CMDBField<TDesC>& aDNS1,
+        CMDBField<TDesC>& aDNS2,
+        CMDBField<TBool>& aDNSFromServer )
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_CHECKDNSSERVERADDRESSL_ENTRY );
 
@@ -1999,7 +2001,7 @@
                     }
                 else
                     {
-                    // Both are unspecified
+                    // Both are unspecified.
                     aDNSFromServer = ETrue;
                     }
                 }
@@ -2015,7 +2017,7 @@
                     }
                 else
                     {
-                    // Both are unspecified
+                    // Both are unspecified.
                     aDNSFromServer = ETrue;
                     }
                 }
@@ -2046,11 +2048,12 @@
 
     if ( iIapRecord )
         {
-        CCDIAPRecord* iapRecord =
-                static_cast<CCDIAPRecord*>( CCDRecordBase::CreateCopyRecordL( *iIapRecord ) );
+        CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord*>(
+                CCDRecordBase::CreateCopyRecordL( *iIapRecord ) );
+        iapRecord->SetElementId( iIapRecord->ElementId() );
         CleanupStack::PushL( iapRecord );
-        iapRecord->SetElementId( iIapRecord->ElementId() );
-        aClientPluginInstance->iGenRecordArray.AppendL( static_cast<CommsDat::CCDRecordBase*>( iapRecord ) );
+        aClientPluginInstance->iGenRecordArray.AppendL(
+                static_cast<CommsDat::CCDRecordBase*>( iapRecord ) );
         CleanupStack::Pop( iapRecord );
         }
     else
@@ -2073,11 +2076,12 @@
 
     if ( iNetworkRecord )
         {
-        CCDNetworkRecord* networkRecord =
-                static_cast<CCDNetworkRecord*>( CCDRecordBase::CreateCopyRecordL( *iNetworkRecord ) );
+        CCDNetworkRecord* networkRecord = static_cast<CCDNetworkRecord*>(
+                CCDRecordBase::CreateCopyRecordL( *iNetworkRecord ) );
+        networkRecord->SetElementId( iNetworkRecord->ElementId() );
         CleanupStack::PushL( networkRecord );
-        networkRecord->SetElementId( iNetworkRecord->ElementId() );
-        aClientPluginInstance->iGenRecordArray.AppendL( static_cast<CommsDat::CCDRecordBase*>( networkRecord ) );
+        aClientPluginInstance->iGenRecordArray.AppendL(
+                static_cast<CommsDat::CCDRecordBase*>( networkRecord ) );
         CleanupStack::Pop( networkRecord );
         }
     else
@@ -2087,11 +2091,12 @@
 
     if ( iWapAPRecord )
         {
-        CCDWAPAccessPointRecord* wapAPRecord =
-                static_cast<CCDWAPAccessPointRecord*>( CCDRecordBase::CreateCopyRecordL( *iWapAPRecord ) );
+        CCDWAPAccessPointRecord* wapAPRecord = static_cast<CCDWAPAccessPointRecord*>(
+                CCDRecordBase::CreateCopyRecordL( *iWapAPRecord ) );
+        wapAPRecord->SetElementId( iWapAPRecord->ElementId() );
         CleanupStack::PushL( wapAPRecord );
-        wapAPRecord->SetElementId( iWapAPRecord->ElementId() );
-        aClientPluginInstance->iGenRecordArray.AppendL( static_cast<CommsDat::CCDRecordBase*>( wapAPRecord ) );
+        aClientPluginInstance->iGenRecordArray.AppendL(
+                static_cast<CommsDat::CCDRecordBase*>( wapAPRecord ) );
         CleanupStack::Pop( wapAPRecord );
         }
     else
@@ -2101,11 +2106,12 @@
 
     if ( iWapIPBearerRecord )
         {
-        CCDWAPIPBearerRecord* wapIPBearerRecord =
-                static_cast<CCDWAPIPBearerRecord*>( CCDRecordBase::CreateCopyRecordL( *iWapIPBearerRecord ) );
+        CCDWAPIPBearerRecord* wapIPBearerRecord = static_cast<CCDWAPIPBearerRecord*>(
+                CCDRecordBase::CreateCopyRecordL( *iWapIPBearerRecord ) );
+        wapIPBearerRecord->SetElementId( iWapIPBearerRecord->ElementId() );
         CleanupStack::PushL( wapIPBearerRecord );
-        wapIPBearerRecord->SetElementId( iWapIPBearerRecord->ElementId() );
-        aClientPluginInstance->iGenRecordArray.AppendL( static_cast<CommsDat::CCDRecordBase*>( wapIPBearerRecord ) );
+        aClientPluginInstance->iGenRecordArray.AppendL(
+                static_cast<CommsDat::CCDRecordBase*>( wapIPBearerRecord ) );
         CleanupStack::Pop( wapIPBearerRecord );
         }
     else
@@ -2115,45 +2121,33 @@
 
     if ( iMetaDataRecord )
         {
-        CCDIAPMetadataRecord* metaDataRecord =
+        CCDIAPMetadataRecord* metadataRecord =
                 new( ELeave ) CCDIAPMetadataRecord( iMetadataTableId );
-        CleanupStack::PushL( metaDataRecord );
-        metaDataRecord->iIAP = IAPRecordElementId();
-        metaDataRecord->iMetadata.SetL( iMetaDataRecord->iMetadata );
-        metaDataRecord->iSeamlessness.SetL( iMetaDataRecord->iSeamlessness );
-        metaDataRecord->SetElementId( iMetaDataRecord->ElementId() );
-        // Record name is set during update.
+        CleanupStack::PushL( metadataRecord );
+        CopyRecordFieldsL( *iMetaDataRecord, *metadataRecord );
+        metadataRecord->SetElementId( iMetaDataRecord->ElementId() );
+        // Record name is set/changed during update.
 
         aClientPluginInstance->iGenRecordArray.AppendL(
-                static_cast<CommsDat::CCDRecordBase*>( metaDataRecord ) );
-        CleanupStack::Pop( metaDataRecord );
+                static_cast<CommsDat::CCDRecordBase*>( metadataRecord ) );
+        CleanupStack::Pop( metadataRecord );
         }
     else
         {
         aClientPluginInstance->iGenRecordArray.AppendL( NULL );
         }
 
-    if ( iLocationRecord )
-        {
-        CCDLocationRecord* locationRecord =
-                static_cast<CCDLocationRecord*>( CCDRecordBase::CreateCopyRecordL( *iLocationRecord ) );
-        CleanupStack::PushL( locationRecord );
-        locationRecord->SetElementId( iLocationRecord->ElementId() );
-        aClientPluginInstance->iGenRecordArray.AppendL( static_cast<CommsDat::CCDRecordBase*>( locationRecord ) );
-        CleanupStack::Pop( locationRecord );
-        }
-    else
-        {
-        aClientPluginInstance->iGenRecordArray.AppendL( NULL );
-        }
+    // Location record does not need to be loaded
+    aClientPluginInstance->iGenRecordArray.AppendL( NULL );
 
     if ( iProxyRecord )
         {
-        CCDProxiesRecord* proxyRecord =
-                static_cast<CCDProxiesRecord*>( CCDRecordBase::CreateCopyRecordL( *iProxyRecord ) );
+        CCDProxiesRecord* proxyRecord = static_cast<CCDProxiesRecord*>(
+                CCDRecordBase::CreateCopyRecordL( *iProxyRecord ) );
+        proxyRecord->SetElementId( iProxyRecord->ElementId() );
         CleanupStack::PushL( proxyRecord );
-        proxyRecord->SetElementId( iProxyRecord->ElementId() );
-        aClientPluginInstance->iGenRecordArray.AppendL( static_cast<CommsDat::CCDRecordBase*>( proxyRecord ) );
+        aClientPluginInstance->iGenRecordArray.AppendL(
+                static_cast<CommsDat::CCDRecordBase*>( proxyRecord ) );
         CleanupStack::Pop( proxyRecord );
         }
     else
@@ -2330,9 +2324,10 @@
             break;
         case ECmDestination:
             {
-            TRAPD( err, retVal = GetBearerBoolAttributeL( aAttribute,
-                                                          aClientPluginInstance->iGenRecordArray,
-                                                          aClientPluginInstance->iBearerSpecRecordArray ) );
+            TRAPD( err, retVal = GetBearerBoolAttributeL(
+                    aAttribute,
+                    aClientPluginInstance->iGenRecordArray,
+                    aClientPluginInstance->iBearerSpecRecordArray ) );
             if ( err )
                 {
                 if ( err == KErrNotFound )
@@ -2351,12 +2346,18 @@
             retVal = EFalse;
             }
             break;
+        case ECmLocationUsageEnabled:
+            {
+            retVal = iLocationEnabled;
+            }
+            break;
         case ECmCoverage:
             // By default the plugin has no network coverage.
             {
-            TRAPD( err, retVal = GetBearerBoolAttributeL( aAttribute,
-                                                          aClientPluginInstance->iGenRecordArray,
-                                                          aClientPluginInstance->iBearerSpecRecordArray ) );
+            TRAPD( err, retVal = GetBearerBoolAttributeL(
+                    aAttribute,
+                    aClientPluginInstance->iGenRecordArray,
+                    aClientPluginInstance->iBearerSpecRecordArray ) );
             if ( err )
                 {
                 if ( err == KErrNotFound )
@@ -2372,16 +2373,14 @@
             break;
         case ECmMetaHighlight:
             {
-            CCDIAPMetadataRecord* metadataRecord =
-                static_cast<CCDIAPMetadataRecord*>(
+            CCDIAPMetadataRecord* metadataRecord = static_cast<CCDIAPMetadataRecord*>(
                     aClientPluginInstance->iGenRecordArray[KMetaDataRecordIndex] );
             retVal = metadataRecord->iMetadata & EMetaHighlight;
             }
             break;
         case ECmMetaHiddenAgent:
             {
-            CCDIAPMetadataRecord* metadataRecord =
-                static_cast<CCDIAPMetadataRecord*>(
+            CCDIAPMetadataRecord* metadataRecord = static_cast<CCDIAPMetadataRecord*>(
                     aClientPluginInstance->iGenRecordArray[KMetaDataRecordIndex] );
             retVal = metadataRecord->iMetadata & EMetaHiddenAgent;
             }
@@ -2420,16 +2419,40 @@
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_GETSTRINGATTRIBUTEL_ENTRY );
 
+    if ( !aClientPluginInstance )
+        {
+        User::Leave( KErrCorrupt );
+        }
+
     HBufC* retVal = NULL;
 
     switch ( aAttribute )
         {
+        case ECmBearerIcon:
+            {
+            //TODO, read icon name from metadata record after commsdat changes implemented.
+            //CCDIAPMetadataRecord* metadataRecord = static_cast<CCDIAPMetadataRecord*>(
+            //        aClientPluginInstance->iGenRecordArray[KMetaDataRecordIndex] );
+
+            //if ( !metadataRecord )
+            //    {
+            //    User::Leave( KErrCorrupt );
+            //    }
+
+            //retVal = TPtrC( metadataRecord->iIconFileName ).AllocL();
+            retVal = KNullDesC().AllocL();//TODO, check this freed
+            }
+            break;
         case ECmStartPage:
             {
-            CCDWAPAccessPointRecord* wapAPRecord =
-                static_cast<CCDWAPAccessPointRecord*>(
+            CCDWAPAccessPointRecord* wapAPRecord = static_cast<CCDWAPAccessPointRecord*>(
                     aClientPluginInstance->iGenRecordArray[KWAPAPRecordIndex] );
 
+            if ( !wapAPRecord )
+                {
+                User::Leave( KErrCorrupt );
+                }
+
             retVal = TPtrC( wapAPRecord->iWAPStartPage ).AllocL();
             }
             break;
@@ -2438,84 +2461,89 @@
             CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord*>(
                     aClientPluginInstance->iGenRecordArray[KIapRecordIndex] );
 
+            if ( !iapRecord )
+                {
+                User::Leave( KErrCorrupt );
+                }
+
             retVal = TPtrC( iapRecord->iRecordName ).AllocL();
             }
             break;
         case ECmProxyServerName:
             {
-            if ( !aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] )
-                {
-                User::Leave( KErrNotFound );
-                }
-
             CCDProxiesRecord* proxyRecord = static_cast<CCDProxiesRecord*>(
                     aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] );
 
+            if ( !proxyRecord )
+                {
+                User::Leave( KErrCorrupt );
+                }
+
             retVal = TPtrC( proxyRecord->iServerName ).AllocL();
             }
             break;
         case ECmProxyProtocolName:
             {
-            if ( !aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] )
-                {
-                User::Leave( KErrNotFound );
-                }
-
             CCDProxiesRecord* proxyRecord = static_cast<CCDProxiesRecord*>(
                     aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] );
 
+            if ( !proxyRecord )
+                {
+                User::Leave( KErrCorrupt );
+                }
+
             retVal = TPtrC( proxyRecord->iExceptions ).AllocL();
             }
             break;
         case ECmProxyExceptions:
             {
-            if ( !aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] )
-                {
-                User::Leave( KErrNotFound );
-                }
-
             CCDProxiesRecord* proxyRecord = static_cast<CCDProxiesRecord*>(
                     aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] );
 
+            if ( !proxyRecord )
+                {
+                User::Leave( KErrCorrupt );
+                }
+
             retVal = TPtrC( proxyRecord->iProtocolName ).AllocL();
             }
             break;
         case ECmWapIPGatewayAddress:
             {
-            if ( !aClientPluginInstance->iGenRecordArray[KWAPBearerRecordIndex] )
-                {
-                User::Leave( KErrNotFound );
-                }
-
             CCDWAPIPBearerRecord* wapIPBearerRecord = static_cast<CCDWAPIPBearerRecord*>(
                     aClientPluginInstance->iGenRecordArray[KWAPBearerRecordIndex] );
 
+            if ( !wapIPBearerRecord )
+                {
+                User::Leave( KErrCorrupt );
+                }
+
             retVal = TPtrC( wapIPBearerRecord->iWAPGatewayAddress ).AllocL();
             }
             break;
         case ECmWapIPProxyLoginName:
             {
-            if ( !aClientPluginInstance->iGenRecordArray[KWAPBearerRecordIndex] )
-                {
-                User::Leave( KErrNotFound );
-                }
-
             CCDWAPIPBearerRecord* wapIPBearerRecord = static_cast<CCDWAPIPBearerRecord*>(
                     aClientPluginInstance->iGenRecordArray[KWAPBearerRecordIndex] );
 
+            if ( !wapIPBearerRecord )
+                {
+                User::Leave( KErrCorrupt );
+                }
+
             retVal = TPtrC( wapIPBearerRecord->iWAPProxyLoginName ).AllocL();
             }
             break;
         case ECmWapIPProxyLoginPass:
             {
-            if ( !aClientPluginInstance->iGenRecordArray[KWAPBearerRecordIndex] )
-                {
-                User::Leave( KErrNotFound );
-                }
-
             CCDWAPIPBearerRecord* wapIPBearerRecord = static_cast<CCDWAPIPBearerRecord*>(
                     aClientPluginInstance->iGenRecordArray[KWAPBearerRecordIndex] );
 
+            if ( !wapIPBearerRecord )
+                {
+                User::Leave( KErrCorrupt );
+                }
+
             retVal = TPtrC( wapIPBearerRecord->iWAPProxyLoginPass ).AllocL();
             }
             break;
@@ -2560,13 +2588,13 @@
     return retVal;
     }
 
-//-----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
 // CCmPluginBaseEng::GetIntAttributeL
 // -----------------------------------------------------------------------------
 EXPORT_C void CCmPluginBaseEng::SetIntAttributeL(
-    TUint32 aAttribute,
-    TUint32 aValue,
-    CCmClientPluginInstance* aClientPluginInstance )
+        TUint32 aAttribute,
+        TUint32 aValue,
+        CCmClientPluginInstance* aClientPluginInstance )
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_SETINTATTRIBUTEL_ENTRY );
 
@@ -2593,7 +2621,7 @@
                 {
                 static_cast<CCDIAPMetadataRecord*>(
                         aClientPluginInstance->iGenRecordArray[KMetaDataRecordIndex] )->
-                                iSeamlessness.SetL( aValue );
+                        iSeamlessness.SetL( aValue );
                 }
             else
                 {
@@ -2611,17 +2639,18 @@
             {
             if ( !aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] )
                 {
-                CCDProxiesRecord* proxyRecord =
-                        static_cast<CCDProxiesRecord*>( CCDRecordBase::CreateCopyRecordL( *iProxyRecord ) );
+                CCDProxiesRecord* proxyRecord = static_cast<CCDProxiesRecord*>(
+                        CCDRecordBase::CreateCopyRecordL( *iProxyRecord ) );
                 CleanupStack::PushL( proxyRecord );
                 proxyRecord->SetElementId( iProxyRecord->ElementId() );
-                aClientPluginInstance->iGenRecordArray.AppendL( static_cast<CommsDat::CCDRecordBase*>( proxyRecord ) );
+                aClientPluginInstance->iGenRecordArray.AppendL(
+                        static_cast<CommsDat::CCDRecordBase*>( proxyRecord ) );
                 CleanupStack::Pop( proxyRecord );
                 }
 
             static_cast<CCDProxiesRecord*>(
-                    aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] )
-                        ->iPortNumber = aValue;
+                    aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] )->
+                    iPortNumber = aValue;
             }
             break;
         case ECmWapIPWSPOption:
@@ -2633,39 +2662,43 @@
             else
                 {
                 static_cast<CCDWAPIPBearerRecord*>(
-                        aClientPluginInstance->iGenRecordArray[KWAPBearerRecordIndex] )->iWAPWSPOption.SetL( aValue );
+                        aClientPluginInstance->iGenRecordArray[KWAPBearerRecordIndex] )->
+                        iWAPWSPOption.SetL( aValue );
                 }
             }
             break;
         case ECmWapIPProxyPort:
             {
             static_cast<CCDWAPIPBearerRecord*>(
-                    aClientPluginInstance->iGenRecordArray[KWAPBearerRecordIndex] )->iWAPProxyPort.SetL( aValue );
+                    aClientPluginInstance->iGenRecordArray[KWAPBearerRecordIndex] )->
+                    iWAPProxyPort.SetL( aValue );
             }
             break;
         default:
             {
-            SetBearerIntAttributeL( aAttribute,
-                                    aValue,
-                                    aClientPluginInstance->iGenRecordArray,
-                                    aClientPluginInstance->iBearerSpecRecordArray );
+            SetBearerIntAttributeL(
+                    aAttribute,
+                    aValue,
+                    aClientPluginInstance->iGenRecordArray,
+                    aClientPluginInstance->iBearerSpecRecordArray );
             }
         }
+
     OstTraceFunctionExit0( CCMPLUGINBASEENG_SETINTATTRIBUTEL_EXIT );
     }
 
-//-----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
 // CCmPluginBaseEng::SetBoolAttributeL
 // -----------------------------------------------------------------------------
 EXPORT_C void CCmPluginBaseEng::SetBoolAttributeL(
-    TUint32 aAttribute,
-    TBool aValue,
-    CCmClientPluginInstance* aClientPluginInstance )
+        TUint32 aAttribute,
+        TBool aValue,
+        CCmClientPluginInstance* aClientPluginInstance )
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_SETBOOLATTRIBUTEL_ENTRY );
 
     CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord*>(
-                        aClientPluginInstance->iGenRecordArray[KIapRecordIndex] );
+            aClientPluginInstance->iGenRecordArray[KIapRecordIndex] );
 
     switch ( aAttribute )
         {
@@ -2707,17 +2740,18 @@
             {
             if ( !aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] )
                 {
-                CCDProxiesRecord* proxyRecord =
-                        static_cast<CCDProxiesRecord*>( CCDRecordBase::CreateCopyRecordL( *iProxyRecord ) );
+                CCDProxiesRecord* proxyRecord = static_cast<CCDProxiesRecord*>(
+                        CCDRecordBase::CreateCopyRecordL( *iProxyRecord ) );
                 CleanupStack::PushL( proxyRecord );
                 proxyRecord->SetElementId( iProxyRecord->ElementId() );
-                aClientPluginInstance->iGenRecordArray.AppendL( static_cast<CommsDat::CCDRecordBase*>( proxyRecord ) );
+                aClientPluginInstance->iGenRecordArray.AppendL(
+                        static_cast<CommsDat::CCDRecordBase*>( proxyRecord ) );
                 CleanupStack::Pop( proxyRecord );
                 }
 
             static_cast<CCDProxiesRecord*>(
-                    aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] )
-                        ->iUseProxyServer = aValue;
+                    aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] )->iUseProxyServer =
+                            aValue;
             }
             break;
         case ECmChargeCardUsageEnabled:
@@ -2732,9 +2766,8 @@
             break;
         case ECmMetaHighlight:
             {
-            CCDIAPMetadataRecord* metadataRecord =
-                static_cast<CCDIAPMetadataRecord*>(
-                        aClientPluginInstance->iGenRecordArray[KMetaDataRecordIndex] );
+            CCDIAPMetadataRecord* metadataRecord = static_cast<CCDIAPMetadataRecord*>(
+                    aClientPluginInstance->iGenRecordArray[KMetaDataRecordIndex] );
             if ( aValue )
                 {
                 metadataRecord->iMetadata = EMetaHighlight | metadataRecord->iMetadata;
@@ -2762,38 +2795,57 @@
         case ECmWapIPSecurity:
             {
             static_cast<CCDWAPIPBearerRecord*>(
-                    aClientPluginInstance->iGenRecordArray[KWAPBearerRecordIndex] )->iWAPSecurity.SetL( aValue );
+                    aClientPluginInstance->iGenRecordArray[KWAPBearerRecordIndex] )
+                    ->iWAPSecurity.SetL( aValue );
             }
             break;
         default:
             {
-            SetBearerBoolAttributeL( aAttribute,
-                                     aValue,
-                                     aClientPluginInstance->iGenRecordArray,
-                                     aClientPluginInstance->iBearerSpecRecordArray );
+            SetBearerBoolAttributeL(
+                    aAttribute,
+                    aValue,
+                    aClientPluginInstance->iGenRecordArray,
+                    aClientPluginInstance->iBearerSpecRecordArray );
             }
         }
+
     OstTraceFunctionExit0( CCMPLUGINBASEENG_SETBOOLATTRIBUTEL_EXIT );
     }
 
-//-----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
 // CCmPluginBaseEng::SetStringAttributeL
 // -----------------------------------------------------------------------------
 EXPORT_C void CCmPluginBaseEng::SetStringAttributeL(
-    TUint32 aAttribute,
-    const TDesC16& aValue,
-    CCmClientPluginInstance* aClientPluginInstance )
+        TUint32 aAttribute,
+        const TDesC16& aValue,
+        CCmClientPluginInstance* aClientPluginInstance )
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_SETSTRINGATTRIBUTEL_ENTRY );
 
     switch ( aAttribute )
         {
+        case ECmBearerIcon:
+            {
+            //TODO, write icon name to metadata record after commsdat changes implemented.
+            //CCDIAPMetadataRecord* metadataRecord = static_cast<CCDIAPMetadataRecord*>(
+            //        aClientPluginInstance->iGenRecordArray[KMetaDataRecordIndex] );
+
+            //if ( !metadataRecord )
+            //    {
+            //    User::Leave( KErrCorrupt );
+            //    }
+            //metadataRecord->iIconFileName.SetL( aValue );
+            }
+            break;
         case ECmStartPage:
             {
-            CCDWAPAccessPointRecord* wapAPRecord =
-                static_cast<CCDWAPAccessPointRecord*>(
-                        aClientPluginInstance->iGenRecordArray[KWAPAPRecordIndex] );
-
+            CCDWAPAccessPointRecord* wapAPRecord = static_cast<CCDWAPAccessPointRecord*>(
+                    aClientPluginInstance->iGenRecordArray[KWAPAPRecordIndex] );
+
+            if ( !wapAPRecord )
+                {
+                User::Leave( KErrCorrupt );
+                }
             wapAPRecord->iWAPStartPage.SetL( aValue );
             }
             break;
@@ -2802,23 +2854,25 @@
             CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord*>(
                     aClientPluginInstance->iGenRecordArray[KIapRecordIndex] );
 
+            if ( !iapRecord )
+                {
+                User::Leave( KErrCorrupt );
+                }
             SetNameL( aValue, iapRecord, aClientPluginInstance->iNamingMethod );
             }
             break;
         case ECmProxyServerName:
             {
-            CCDProxiesRecord* proxyRecord =
-                    static_cast<CCDProxiesRecord*>(
-                            aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] );
+            CCDProxiesRecord* proxyRecord = static_cast<CCDProxiesRecord*>(
+                    aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] );
             if ( !proxyRecord )
                 {
-                proxyRecord = static_cast<CCDProxiesRecord *>
-                              ( CCDRecordBase::RecordFactoryL(KCDTIdProxiesRecord ) );
-
-                // map proxy record to this iap.
-                proxyRecord->iService =
-                        static_cast<CCDProxiesRecord*>(
-                                aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] )->RecordId();
+                proxyRecord = static_cast<CCDProxiesRecord*>(
+                        CCDRecordBase::RecordFactoryL( KCDTIdProxiesRecord ) );
+
+                // Map proxy record to this iap.
+                proxyRecord->iService = static_cast<CCDProxiesRecord*>(
+                        aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] )->RecordId();
 
                 aClientPluginInstance->iGenRecordArray.Insert( proxyRecord, KProxyRecordIndex );
                 }
@@ -2828,18 +2882,16 @@
             break;
         case ECmProxyProtocolName:
             {
-            CCDProxiesRecord* proxyRecord =
-                    static_cast<CCDProxiesRecord*>(
-                            aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] );
+            CCDProxiesRecord* proxyRecord = static_cast<CCDProxiesRecord*>(
+                    aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] );
             if ( !proxyRecord )
                 {
-                proxyRecord = static_cast<CCDProxiesRecord *>
-                              ( CCDRecordBase::RecordFactoryL(KCDTIdProxiesRecord ) );
-
-                // map proxy record to this iap.
-                proxyRecord->iService =
-                        static_cast<CCDProxiesRecord*>(
-                                aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] )->RecordId();
+                proxyRecord = static_cast<CCDProxiesRecord*>(
+                        CCDRecordBase::RecordFactoryL( KCDTIdProxiesRecord ) );
+
+                // Map proxy record to this iap.
+                proxyRecord->iService = static_cast<CCDProxiesRecord*>(
+                        aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] )->RecordId();
 
                 aClientPluginInstance->iGenRecordArray.Insert( proxyRecord, KProxyRecordIndex );
                 }
@@ -2849,18 +2901,16 @@
             break;
         case ECmProxyExceptions:
             {
-            CCDProxiesRecord* proxyRecord =
-                    static_cast<CCDProxiesRecord*>(
-                            aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] );
+            CCDProxiesRecord* proxyRecord = static_cast<CCDProxiesRecord*>(
+                    aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] );
             if ( !proxyRecord )
                 {
-                proxyRecord = static_cast<CCDProxiesRecord *>
-                              ( CCDRecordBase::RecordFactoryL(KCDTIdProxiesRecord ) );
-
-                // map proxy record to this iap.
-                proxyRecord->iService =
-                        static_cast<CCDProxiesRecord*>(
-                                aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] )->RecordId();
+                proxyRecord = static_cast<CCDProxiesRecord*>(
+                        CCDRecordBase::RecordFactoryL( KCDTIdProxiesRecord ) );
+
+                // Map proxy record to this iap.
+                proxyRecord->iService = static_cast<CCDProxiesRecord*>(
+                        aClientPluginInstance->iGenRecordArray[KProxyRecordIndex] )->RecordId();
 
                 aClientPluginInstance->iGenRecordArray.Insert( proxyRecord, KProxyRecordIndex );
                 }
@@ -2873,6 +2923,10 @@
             CCDWAPIPBearerRecord* wapIPBearerRecord = static_cast<CCDWAPIPBearerRecord*>(
                     aClientPluginInstance->iGenRecordArray[KWAPBearerRecordIndex] );
 
+            if ( !wapIPBearerRecord )
+                {
+                User::Leave( KErrCorrupt );
+                }
             wapIPBearerRecord->iWAPGatewayAddress.SetL( aValue );
             }
             break;
@@ -2881,6 +2935,10 @@
             CCDWAPIPBearerRecord* wapIPBearerRecord = static_cast<CCDWAPIPBearerRecord*>(
                     aClientPluginInstance->iGenRecordArray[KWAPBearerRecordIndex] );
 
+            if ( !wapIPBearerRecord )
+                {
+                User::Leave( KErrCorrupt );
+                }
             wapIPBearerRecord->iWAPProxyLoginName.SetL( aValue );
             }
             break;
@@ -2889,27 +2947,33 @@
             CCDWAPIPBearerRecord* wapIPBearerRecord = static_cast<CCDWAPIPBearerRecord*>(
                     aClientPluginInstance->iGenRecordArray[KWAPBearerRecordIndex] );
 
+            if ( !wapIPBearerRecord )
+                {
+                User::Leave( KErrCorrupt );
+                }
             wapIPBearerRecord->iWAPProxyLoginPass.SetL( aValue );
             }
             break;
         default:
             {
-            SetBearerStringAttributeL( aAttribute,
-                                       aValue,
-                                       aClientPluginInstance->iGenRecordArray,
-                                       aClientPluginInstance->iBearerSpecRecordArray );
+            SetBearerStringAttributeL(
+                    aAttribute,
+                    aValue,
+                    aClientPluginInstance->iGenRecordArray,
+                    aClientPluginInstance->iBearerSpecRecordArray );
             }
         }
+
     OstTraceFunctionExit0( CCMPLUGINBASEENG_SETSTRINGATTRIBUTEL_EXIT );
     }
 
-//-----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
 // CCmPluginBaseEng::SetString8AttributeL
 // -----------------------------------------------------------------------------
 EXPORT_C void CCmPluginBaseEng::SetString8AttributeL(
-    TUint32 aAttribute,
-    const TDesC8& aValue,
-    CCmClientPluginInstance* aClientPluginInstance )
+        TUint32 aAttribute,
+        const TDesC8& aValue,
+        CCmClientPluginInstance* aClientPluginInstance )
     {
     OstTraceFunctionEntry0( CCMPLUGINBASEENG_SETSTRING8ATTRIBUTEL_ENTRY );
 
@@ -2917,12 +2981,14 @@
         {
         default:
             {
-            SetBearerString8AttributeL( aAttribute,
-                                        aValue,
-                                        aClientPluginInstance->iGenRecordArray,
-                                        aClientPluginInstance->iBearerSpecRecordArray );
+            SetBearerString8AttributeL(
+                    aAttribute,
+                    aValue,
+                    aClientPluginInstance->iGenRecordArray,
+                    aClientPluginInstance->iBearerSpecRecordArray );
             }
         }
+
     OstTraceFunctionExit0( CCMPLUGINBASEENG_SETSTRING8ATTRIBUTEL_EXIT );
     }
 
@@ -2941,7 +3007,6 @@
         }
 
     OstTraceFunctionExit0( DUP1__ISUNSPECIFIEDIPV4ADDRESS_EXIT );
-
     return EFalse;
     }
 
@@ -2968,7 +3033,6 @@
         }
 
     OstTraceFunctionExit0( DUP2__CLASSIFYIPV6ADDRESS_EXIT );
-
     return EIPv6UserDefined;
     }
 
--- a/cmmanager/cmmgr/cmmpluginbase/src/ccmpluginbaseengtextresolver.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmpluginbase/src/ccmpluginbaseengtextresolver.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -27,15 +27,16 @@
     {
     _LIT(KCMManagerTranslationFile, "cmmanager_");
     _LIT(KTranslationPath, "\\resource\\qt\\translations");
-    
-    TBool result = HbTextResolverSymbian::Init( KCMManagerTranslationFile,
-                                                KTranslationPath );
+
+    TBool result = HbTextResolverSymbian::Init(
+            KCMManagerTranslationFile,
+            KTranslationPath );
     if ( result )
         {
         OstTrace0( TRACE_ERROR, CCMPLUGINBASEENGTEXTRESOLVER_RESOLVETEXTL, "CCmPluginBaseEngTextResolver::ResolveTextL" );
         }
-    
-    return HbTextResolverSymbian::LoadL( aTextId );        
+
+    return HbTextResolverSymbian::LoadL( aTextId );
     }
 
-    
+// End of file
--- a/cmmanager/cmmgr/cmmplugins/cmpluginlan/data/1020737B.rss	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginlan/data/1020737B.rss	Wed Jun 23 17:49:20 2010 +0100
@@ -17,7 +17,7 @@
 *
 */
 
-#include "ecom/RegistryInfo.rh"
+#include "ecom/registryinfo.rh"
 
 // Because attribute enums had to be added to namespace CMManager
 // it's not possible to included cmpluginlanbasedef.h
--- a/cmmanager/cmmgr/cmmplugins/cmpluginlan/group/cmpluginlan.mmp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginlan/group/cmpluginlan.mmp	Wed Jun 23 17:49:20 2010 +0100
@@ -49,7 +49,8 @@
 MW_LAYER_SYSTEMINCLUDE
 
 LIBRARY euser.lib
-LIBRARY	ECOM.LIB
+LIBRARY	ecom.lib
+LIBRARY commsdat.lib
+LIBRARY featmgr.lib
+LIBRARY cmmanagerdatabase.lib
 LIBRARY	cmmpluginbase.lib
-LIBRARY COMMSDAT.lib
-LIBRARY featmgr.lib
\ No newline at end of file
--- a/cmmanager/cmmgr/cmmplugins/cmpluginlan/inc/cmpluginlan.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginlan/inc/cmpluginlan.h	Wed Jun 23 17:49:20 2010 +0100
@@ -324,12 +324,23 @@
         void GetDefaultLanBearerRecordL(
                 RPointerArray<CommsDat::CCDRecordBase>& aRecordArray );
 
+        /**
+         * Returns the default priority value identified with the parameter.
+         * @param aAttribute Indentifies the default priority value requested.
+         */
+        TUint32 GetDefPriorityL( const TUint32 aAttribute ) const;
+
     private: // Data
 
         /**
          * Pointer to LAN bearer record.
          */
         CommsDat::CCDLANBearerRecord* iBearerRecord;
+
+        /**
+         * Bearer priority table ID.
+         */
+        CommsDat::TMDBElementId iBearerPriorityTableId;
     };
 
 #endif // LAN_PLUGIN_H
--- a/cmmanager/cmmgr/cmmplugins/cmpluginlan/src/cmpluginlan.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginlan/src/cmpluginlan.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -57,8 +57,6 @@
 const TInt KLanLastSocketClosedTimeout = -1;
 const TInt KLanLastSessionClosedTimeout = -1;
 
-const TUint32 KDefaultPriorityLAN = 0;
-
 
 // ---------------------------------------------------------
 // CCmPluginLan::NewOutgoingL()
@@ -135,6 +133,16 @@
     FeatureManager::InitializeLibL();
 
     CCmPluginBaseEng::ConstructL();
+    
+    // Get bearer priority table ID.
+    TRAP_IGNORE( iBearerPriorityTableId = 
+            CCDGlobalBearerTypePriorizationRecord::TableIdL( iSession ) );
+
+    if ( !iBearerPriorityTableId )
+        {
+        iBearerPriorityTableId = 
+                CCDGlobalBearerTypePriorizationRecord::CreateTableL( iSession );
+        }
 
     OstTraceFunctionExit0( CCMPLUGINLAN_CONSTRUCTL_EXIT );
     }
@@ -197,7 +205,6 @@
 void CCmPluginLan::PreparePluginToLoadRecordsL()
     {
     OstTraceFunctionEntry0( CCMPLUGINLAN_PREPAREPLUGINTOLOADRECORDSL_ENTRY );
-
     OstTraceFunctionExit0( CCMPLUGINLAN_PREPAREPLUGINTOLOADRECORDSL_EXIT );
     }
 
@@ -206,8 +213,8 @@
 // ----------------------------------------------------------------------------
 //
 void CCmPluginLan::PreparePluginToUpdateRecordsL(
-    RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
-    RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray )
+        RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
+        RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray )
     {
     OstTraceFunctionEntry0( CCMPLUGINLAN_PREPAREPLUGINTOUPDATERECORDSL_ENTRY );
 
@@ -245,11 +252,10 @@
     delete iServiceRecord;
     iServiceRecord = NULL;
 
-    iServiceRecord = static_cast<CCDLANServiceRecord*>
-                (CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord ) );
+    iServiceRecord = static_cast<CCDLANServiceRecord*>(
+            CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord ) );
 
-    CCDLANServiceRecord* lanServiceRecord = static_cast<CCDLANServiceRecord *>( iServiceRecord );
-
+    CCDLANServiceRecord* lanServiceRecord = static_cast<CCDLANServiceRecord*>( iServiceRecord );
 
     if ( FeatureManager::FeatureSupported( KFeatureIdIPv6 ) )
         {
@@ -283,6 +289,7 @@
         lanServiceRecord->iConfigDaemonManagerName.SetL( KEmpty );
         lanServiceRecord->iConfigDaemonName.SetL( KEmpty );
         }
+
     OstTraceFunctionExit0( CCMPLUGINLAN_CREATESERVICERECORDL_EXIT );
     }
 
@@ -831,9 +838,14 @@
             retVal = KCommDbBearerLAN;
             }
             break;
+        case ECmDefaultUiPriority:
+            {
+            retVal = GetDefPriorityL( aAttribute );
+            }
+            break;
         case ECmDefaultPriority:
             {
-            retVal = KDefaultPriorityLAN;
+            retVal = GetDefPriorityL( aAttribute );
             }
             break;
         case ELanServiceExtensionTableRecordId:
@@ -1311,9 +1323,13 @@
             }
             break;
         case ECmDefaultUiPriority:
+            {
+            retVal = GetDefPriorityL( aAttribute );
+            }
+            break;
         case ECmDefaultPriority:
             {
-            retVal = KDefaultPriorityLAN;
+            retVal = GetDefPriorityL( aAttribute );
             }
             break;
         case ECmExtensionLevel:
@@ -1459,4 +1475,44 @@
     OstTraceFunctionExit0( CCMPLUGINLAN_GETBEARERTABLEIDSTOBEOBSERVED_EXIT );
     }
 
+// ---------------------------------------------------------------------------
+// CCmPluginLan::GetDefPriorityL
+// ---------------------------------------------------------------------------
+//
+TUint32 CCmPluginLan::GetDefPriorityL( const TUint32 aAttribute ) const//TODO, OST
+    {
+
+    TUint32 retVal( KDataMobilitySelectionPolicyPriorityWildCard );
+
+    CCDGlobalBearerTypePriorizationRecord* priorityRecord =
+            new( ELeave ) CCDGlobalBearerTypePriorizationRecord( iBearerPriorityTableId );
+    CleanupStack::PushL( priorityRecord );
+
+    priorityRecord->iServiceType.SetL( TPtrC( KCDTypeNameLANService ) );
+
+    if ( priorityRecord->FindL( iSession ) )
+        {
+        priorityRecord->LoadL( iSession );
+
+        switch ( aAttribute )
+            {
+            case ECmDefaultPriority:
+                {
+                retVal = priorityRecord->iPriority;
+                }
+                break;
+            case ECmDefaultUiPriority:
+                {
+                retVal = priorityRecord->iUIPriority;
+                }
+                break;
+            default:
+                break;
+            }
+        }
+    CleanupStack::PopAndDestroy( priorityRecord );
+
+    return retVal;
+    }
+
 //  End of File
--- a/cmmanager/cmmgr/cmmplugins/cmpluginlan/src/cmpluginlanproxy.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginlan/src/cmpluginlanproxy.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -20,7 +20,7 @@
 
 #include "cmpluginlan.h"
 #include <e32std.h>
-#include <ecom/ImplementationProxy.h>
+#include <ecom/implementationproxy.h>
 
 // Exported proxy for instantiation method resolution
 // Define the interface UIDs
--- a/cmmanager/cmmgr/cmmplugins/cmpluginpacketdata/data/1020737C.rss	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginpacketdata/data/1020737C.rss	Wed Jun 23 17:49:20 2010 +0100
@@ -16,7 +16,7 @@
 *
 */
 
-#include "ecom/RegistryInfo.rh"
+#include "ecom/registryinfo.rh"
 
 // Because attribute enums had to be added to namespace CMManager
 // it's not possible to included cmpluginpacketdatadef.h.
--- a/cmmanager/cmmgr/cmmplugins/cmpluginpacketdata/group/bld.inf	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginpacketdata/group/bld.inf	Wed Jun 23 17:49:20 2010 +0100
@@ -24,7 +24,7 @@
 
 PRJ_EXPORTS
 // export iby files
-../Rom/cmmpluginpacketdata.iby   CORE_MW_LAYER_IBY_EXPORT_PATH(cmmpluginpacketdata.iby)
+../rom/cmmpluginpacketdata.iby   CORE_MW_LAYER_IBY_EXPORT_PATH(cmmpluginpacketdata.iby)
 
 PRJ_MMPFILES
 cmpluginpacketdata.mmp
--- a/cmmanager/cmmgr/cmmplugins/cmpluginpacketdata/group/cmpluginpacketdata.mmp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginpacketdata/group/cmpluginpacketdata.mmp	Wed Jun 23 17:49:20 2010 +0100
@@ -16,7 +16,6 @@
 *
 */
 
-#include <data_caging_paths.hrh>
 #include <platform_paths.hrh>
 
 TARGET      cmpluginpacketdata.dll
@@ -32,13 +31,12 @@
 SOURCE      cmpluginpacketdataproxy.cpp
 SOURCE      cmpluginpacketdata.cpp
 
-SOURCEPATH  ../Data
+SOURCEPATH  ../data
 
 START RESOURCE 1020737C.rss
 TARGET cmpluginpacketdata.rsc
 END
 
-//USERINCLUDE     ../../../Framework/SrcData
 USERINCLUDE     ../data
 
 // Component specific internal headers 
@@ -54,8 +52,9 @@
 LIBRARY euser.lib
 LIBRARY	ecom.lib
 LIBRARY cmmpluginbase.lib
-LIBRARY commsdat.lib
 LIBRARY etel.lib
 LIBRARY etelpckt.lib
 LIBRARY featmgr.lib
 LIBRARY centralrepository.lib 
+LIBRARY cmmanagerdatabase.lib
+LIBRARY commsdat.lib
--- a/cmmanager/cmmgr/cmmplugins/cmpluginpacketdata/inc/cmpluginpacketdata.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginpacketdata/inc/cmpluginpacketdata.h	Wed Jun 23 17:49:20 2010 +0100
@@ -396,8 +396,9 @@
         * @param aServiceRecord Pointer to the service record where to save the
         * pdp type.
         */
-        void SetPDPTypeL( RPacketContext::TProtocolType aPdpType,
-                          CommsDat::CCDWCDMAPacketServiceRecord* aServiceRecord );
+        void SetPDPTypeL(
+                RPacketContext::TProtocolType aPdpType,
+                CommsDat::CCDWCDMAPacketServiceRecord* aServiceRecord );
 
         /**
          * Sets the daemon name for the Connection Method.
@@ -407,8 +408,14 @@
          * specific records of the Connection Method.
          */
         void SetDaemonNameL(
-            RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
-            RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
+                RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
+                RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
+
+        /**
+         * Returns the default priority value identified with the parameter.
+         * @param aAttribute Indentifies the default priority value requested.
+         */
+        TUint32 GetDefPriorityL( const TUint32 aAttribute ) const;
 
     private:
         /**
@@ -422,22 +429,27 @@
         /**
          * Boolean to define if this is outgoing or incoming packetdata cm.
          */
-        TBool   iOutgoing;
+        TBool iOutgoing;
 
         /**
-         * Id of the bearer record of the iap.
+         * ID of the bearer record of the IAP.
          */
         TUint32 iBearerRecordId;
 
         /**
-         * Name of the bearer record of the iap.
+         * Name of the bearer record of the IAP.
          */
-        HBufC*  iBearerRecordName;
+        HBufC* iBearerRecordName;
 
         /**
-         * pointer to the QoS record of the iap.
+         * Pointer to the QoS record of the IAP.
          */
         CommsDat::CCDUmtsR99QoSAndOnTableRecord* iPacketDataQoSRecord;
+
+        /**
+         * Bearer priority table ID.
+         */
+        CommsDat::TMDBElementId iBearerPriorityTableId;
     };
 
 #endif // PACKETDATA_PLUGIN_H
--- a/cmmanager/cmmgr/cmmplugins/cmpluginpacketdata/src/cmpluginpacketdata.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginpacketdata/src/cmpluginpacketdata.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -17,11 +17,12 @@
 */
 
 
-#include <stringloader.h>
-#include <FeatMgr.h>
+#include <StringLoader.h>
+#include <featmgr.h>
 #include <centralrepository.h>
 #include <CoreApplicationUIsSDKCRKeys.h>
 
+#include "datamobilitycommsdattypes.h"
 #include "cmpluginpacketdata.h"
 
 #include "OstTraceDefinitions.h"
@@ -34,9 +35,7 @@
 
 // ================= CONSTANTS =======================
 
-const TUint32 KDefaultPriorityPacketData = 1;
-
-/// Modem bearer names for GPRS/WCDMA Access Points
+/// Modem bearer names for GPRS/WCDMA access points.
 _LIT( KModemBearerPacketData, "GPRS Modem" );
 _LIT( KDefaultQosDataRecordName, "PRIMARY1" );
 _LIT( KDefaultQosDataRecordNamewithSpace, "PRIMARY1 " );
@@ -313,6 +312,16 @@
     FeatureManager::InitializeLibL();
     CCmPluginBaseEng::ConstructL();
 
+    // Get bearer priority table ID.
+    TRAP_IGNORE( iBearerPriorityTableId =
+            CCDGlobalBearerTypePriorizationRecord::TableIdL( iSession ) );
+
+    if ( !iBearerPriorityTableId )
+        {
+        iBearerPriorityTableId =
+                CCDGlobalBearerTypePriorizationRecord::CreateTableL( iSession );
+        }
+
     OstTraceFunctionExit0( CCMPLUGINPACKETDATA_CONSTRUCTL_EXIT );
     }
 
@@ -385,11 +394,13 @@
     {
     OstTraceFunctionEntry0( CCMPLUGINPACKETDATA_PREPAREPLUGINTOUPDATERECORDSL_ENTRY );
 
-    CCDIAPRecord* iapRecord =
-                static_cast<CCDIAPRecord*>( aGenRecordArray[KIapRecordIndex] );
-
-    CCDWCDMAPacketServiceRecord* serviceRecord =
-            static_cast<CCDWCDMAPacketServiceRecord*>( aGenRecordArray[KServiceRecordIndex] );
+    //TODO, Add null checks for mandatory specific record pointers.
+
+    CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord*>(
+            aGenRecordArray[KIapRecordIndex] );
+
+    CCDWCDMAPacketServiceRecord* serviceRecord = static_cast<CCDWCDMAPacketServiceRecord*>(
+            aGenRecordArray[KServiceRecordIndex] );
 
     CheckIfNameModifiedL( iapRecord, serviceRecord );
 
@@ -418,7 +429,7 @@
     {
     OstTraceFunctionEntry0( CCMPLUGINPACKETDATA_SETDAEMONNAMEL_ENTRY );
 
-    // use DHCP if we can
+    // Use DHCP if we can.
     TBool ipfromSrv = GetBearerBoolAttributeL( EPacketDataIPAddrFromServer,
                                                aGenRecordArray,
                                                aBearerSpecRecordArray );
@@ -1231,9 +1242,13 @@
                 }
                 break;
             case ECmDefaultUiPriority:
+                {
+                retVal = GetDefPriorityL( aAttribute );
+                }
+                break;
             case ECmDefaultPriority:
                 {
-                retVal = KDefaultPriorityPacketData;
+                retVal = GetDefPriorityL( aAttribute );
                 }
                 break;
             case ECmExtensionLevel:
@@ -2492,11 +2507,14 @@
             retVal = KCommDbBearerWcdma;
             }
             break;
-
         case ECmDefaultUiPriority:
+            {
+            retVal = GetDefPriorityL( aAttribute );
+            }
+            break;
         case ECmDefaultPriority:
             {
-            retVal = KDefaultPriorityPacketData;
+            retVal = GetDefPriorityL( aAttribute );
             }
             break;
         case ECmExtensionLevel:
@@ -2984,4 +3002,46 @@
     OstTraceFunctionExit0( CCMPLUGINPACKETDATA_GETBEARERTABLEIDSTOBEOBSERVEDL_EXIT );
     }
 
+// ---------------------------------------------------------------------------
+// CCmPluginPacketData::GetDefPriorityL
+// ---------------------------------------------------------------------------
+//
+TUint32 CCmPluginPacketData::GetDefPriorityL( const TUint32 aAttribute ) const
+    {
+    OstTraceFunctionEntry0( CCMPLUGINPACKETDATA_GETDEFPRIORITYL_ENTRY );
+
+    TUint32 retVal( KDataMobilitySelectionPolicyPriorityWildCard );
+
+    CCDGlobalBearerTypePriorizationRecord* priorityRecord =
+            new( ELeave ) CCDGlobalBearerTypePriorizationRecord( iBearerPriorityTableId );
+    CleanupStack::PushL( priorityRecord );
+
+    priorityRecord->iServiceType.SetL( TPtrC( KCDTypeNameOutgoingWCDMA ) );
+
+    if ( priorityRecord->FindL( iSession ) )
+        {
+        priorityRecord->LoadL( iSession );
+
+        switch ( aAttribute )
+            {
+            case ECmDefaultPriority:
+                {
+                retVal = priorityRecord->iPriority;
+                }
+                break;
+            case ECmDefaultUiPriority:
+                {
+                retVal = priorityRecord->iUIPriority;
+                }
+                break;
+            default:
+                break;
+            }
+        }
+    CleanupStack::PopAndDestroy( priorityRecord );
+
+    OstTraceFunctionExit0( CCMPLUGINPACKETDATA_GETDEFPRIORITYL_EXIT );
+    return retVal;
+    }
+
 // End of file
--- a/cmmanager/cmmgr/cmmplugins/cmpluginpacketdata/src/cmpluginpacketdataproxy.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginpacketdata/src/cmpluginpacketdataproxy.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -18,7 +18,7 @@
 
 
 #include <e32std.h>
-#include <ecom/ImplementationProxy.h>
+#include <ecom/implementationproxy.h>
 
 #include "cmpluginpacketdata.h"
 
@@ -29,9 +29,9 @@
     IMPLEMENTATION_PROXY_ENTRY( KUidPacketDataBearerType, CCmPluginPacketData::NewL)
     };
 
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
     {
-    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+    aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
 
     return ImplementationTable;
     }
--- a/cmmanager/cmmgr/cmmplugins/cmpluginwlan/data/10281BB2.rss	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginwlan/data/10281BB2.rss	Wed Jun 23 17:49:20 2010 +0100
@@ -17,7 +17,7 @@
 *
 */
 
-#include "ecom/RegistryInfo.rh"
+#include "ecom/registryinfo.rh"
 
 // Because attribute enums had to be added to namespace CMManager
 // it's not possible to included cmpluginwlandef.h
--- a/cmmanager/cmmgr/cmmplugins/cmpluginwlan/group/bld.inf	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginwlan/group/bld.inf	Wed Jun 23 17:49:20 2010 +0100
@@ -25,7 +25,7 @@
 
 PRJ_EXPORTS
 // export iby files
-../Rom/cmmpluginwlan.iby   CORE_MW_LAYER_IBY_EXPORT_PATH(cmmpluginwlan.iby)
+../rom/cmmpluginwlan.iby   CORE_MW_LAYER_IBY_EXPORT_PATH(cmmpluginwlan.iby)
 
 
 PRJ_MMPFILES
--- a/cmmanager/cmmgr/cmmplugins/cmpluginwlan/group/cmpluginwlan.mmp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginwlan/group/cmpluginwlan.mmp	Wed Jun 23 17:49:20 2010 +0100
@@ -17,7 +17,6 @@
 *
 */
 
-#include <data_caging_paths.hrh>
 #include <platform_paths.hrh>
 
 TARGET      cmpluginwlan.dll
--- a/cmmanager/cmmgr/cmmplugins/cmpluginwlan/inc/cmpluginwlan.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginwlan/inc/cmpluginwlan.h	Wed Jun 23 17:49:20 2010 +0100
@@ -340,8 +340,9 @@
          * @param aSourceRecord A record where to copy from.
          * @param aDestRecord A record where to copy to.
          */
-        void CopyWlanServiceRecordL( CCDWlanServiceRecord* aSourceRecord,
-                                     CCDWlanServiceRecord* aDestRecord);
+        void CopyWlanServiceRecordL(
+                CCDWlanServiceRecord* aSourceRecord,
+                CCDWlanServiceRecord* aDestRecord);
 
         /**
          * Copies the bearer specific records to copy instance.
@@ -361,8 +362,9 @@
          * @param aAttribute Identifies the attribute to be checked.
          * @param aValue A value to be checked.
          */
-        void CheckSecurityAttributeValidityL( const TUint32 aAttribute,
-                                              const TUint32 aValue );
+        void CheckSecurityAttributeValidityL(
+                const TUint32 aAttribute,
+                const TUint32 aValue );
 
         /**
          * Convert a 8-bit string in ascii format to hex format. Ownership of
@@ -382,19 +384,30 @@
          */
         TUint8 ConvertHexCharToNumberL( const TUint8 aHexChar );
 
+        /**
+         * Returns the default priority value identified with the parameter.
+         * @param aAttribute Indentifies the default priority value requested.
+         */
+        TUint32 GetDefPriorityL( const TUint32 aAttribute ) const;
+
     private: // Data
 
         /**
-         * WLan service record.
+         * WLAN service record.
          */
         CCDWlanServiceRecord* iWlanServiceRecord;
 
         /**
-         * WLAN table id.
+         * WLAN table ID.
          */
         CommsDat::TMDBElementId iWlanTableId;
 
         /**
+         * Bearer priority table ID.
+         */
+        CommsDat::TMDBElementId iBearerPriorityTableId;
+
+        /**
          * Boolean to save the WAPI support info.
          */
         TBool iWAPISupported;
--- a/cmmanager/cmmgr/cmmplugins/cmpluginwlan/src/cmpluginwlan.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginwlan/src/cmpluginwlan.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -25,6 +25,7 @@
 #include <cmcommonconstants.h>
 #include <featmgr.h>
 
+#include "datamobilitycommsdattypes.h"
 #include "cmpluginwlan.h"
 #include "cmwlancoveragecheck.h"
 #include "cmmanagerdef.h"
@@ -52,13 +53,11 @@
 
 const TInt KWlanServiceRecordIndex = 0;
 
-const TUint32 KDefaultPriorityWLan = 0;
-
 const TInt KWlanLastSocketActivityTimeout = -1;
 const TInt KWlanLastSessionClosedTimeout = 1;
 const TInt KWlanLastSocketClosedTimeout = -1;
 
-/// Modem bearer names for WLAN connection methods
+/// Modem bearer names for WLAN connection methods.
 _LIT( KModemBearerWLAN, "WLANBearer" );
 
 _LIT( KWlanBearerName, "WLANBearer" );
@@ -154,6 +153,16 @@
 
     CCmPluginBaseEng::ConstructL();
 
+    // Get bearer priority table ID.
+    TRAP_IGNORE( iBearerPriorityTableId =
+            CCDGlobalBearerTypePriorizationRecord::TableIdL( iSession ) );
+
+    if ( !iBearerPriorityTableId )
+        {
+        iBearerPriorityTableId =
+                CCDGlobalBearerTypePriorizationRecord::CreateTableL( iSession );
+        }
+
     // get WLAN table id
     TRAP_IGNORE( iWlanTableId = CCDWlanServiceRecord::TableIdL( iSession ) );
 
@@ -312,12 +321,12 @@
             break;
         case ECmDefaultUiPriority:
             {
-            retVal = KDefaultPriorityWLan;
+            retVal = GetDefPriorityL( aAttribute );
             }
             break;
         case ECmDefaultPriority:
             {
-            retVal = KDefaultPriorityWLan;
+            retVal = GetDefPriorityL( aAttribute );
             }
             break;
         case EWlanServiceId:
@@ -453,7 +462,7 @@
             break;
         case EWlan802_1xAllowUnencrypted:
             {
-            retVal = static_cast<TBool>( wlanServiceRecord->iWlanWpaKeyLength );
+            retVal = static_cast<TBool>( wlanServiceRecord->iWlanWpaKeyLength );//TODO, change typecast to if-else structure?
             }
             break;
         default:
@@ -1232,8 +1241,8 @@
 
     TBool retVal( EFalse );
 
-    CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *>
-                        ( CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord) );
+    CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *>(
+            CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord) );
 
     CleanupStack::PushL( iapRecord );
     iapRecord->SetRecordId( aIapId );
@@ -1307,8 +1316,8 @@
 
     if ( TPtrC( KCDTypeNameLANService ) == iIapRecord->iServiceType )
         {
-        iServiceRecord = static_cast<CCDLANServiceRecord *>
-                    ( CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord ) );
+        iServiceRecord = static_cast<CCDLANServiceRecord*>(
+                CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord ) );
 
         ServiceRecord().SetRecordId( iIapRecord->iService );
         ServiceRecord().LoadL( iSession );
@@ -1362,11 +1371,10 @@
     delete iServiceRecord;
     iServiceRecord = NULL;
 
-    iServiceRecord = static_cast<CCDLANServiceRecord*>
-                (CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord ) );
+    iServiceRecord = static_cast<CCDLANServiceRecord*>(
+            CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord ) );
 
-    CCDLANServiceRecord* lanServiceRecord = static_cast<CCDLANServiceRecord *>( iServiceRecord );
-
+    CCDLANServiceRecord* lanServiceRecord = static_cast<CCDLANServiceRecord*>( iServiceRecord );
 
     if ( FeatureManager::FeatureSupported( KFeatureIdIPv6 ) )
         {
@@ -1401,7 +1409,7 @@
         lanServiceRecord->iConfigDaemonName.SetL( KEmpty );
         }
 
-    // create WLAN service record
+    // Create WLAN service record.
     CreateWlanServiceRecordL();
 
     OstTraceFunctionExit0( CCMPLUGINWLAN_CREATESERVICERECORDL_EXIT );
@@ -1422,9 +1430,11 @@
     iWlanServiceRecord = new( ELeave ) CCDWlanServiceRecord ( iWlanTableId );
     iWlanServiceRecord->SetRecordId( KCDNewRecordRequest );
 
+    // Some attributes need to have default values set.
     iWlanServiceRecord->iRecordName.SetL( iIapRecord->iRecordName );
     iWlanServiceRecord->iWlanConnMode.SetL( CMManager::EInfra );
     iWlanServiceRecord->iWlanSecMode.SetL( CMManager::EWlanSecModeOpen );
+    iWlanServiceRecord->iWlanAuthMode.SetL( CMManager::EWlanAuthModeOpen );
     iWlanServiceRecord->iWlanScanSSID.SetL( EFalse );
 
     OstTraceFunctionExit0( CCMPLUGINWLAN_CREATEWLANSERVICERECORDL_EXIT );
@@ -2226,9 +2236,13 @@
             }
             break;
         case ECmDefaultUiPriority:
+            {
+            retVal = GetDefPriorityL( aAttribute );
+            }
+            break;
         case ECmDefaultPriority:
             {
-            retVal = KDefaultPriorityWLan;
+            retVal = GetDefPriorityL( aAttribute );
             }
             break;
         case ECmExtensionLevel:
@@ -2614,4 +2628,44 @@
     return result;
     }
 
+// ---------------------------------------------------------------------------
+// CCmPluginWlan::GetDefPriorityL
+// ---------------------------------------------------------------------------
+//
+TUint32 CCmPluginWlan::GetDefPriorityL( const TUint32 aAttribute ) const//TODO, OST
+    {
+
+    TUint32 retVal( KDataMobilitySelectionPolicyPriorityWildCard );
+
+    CCDGlobalBearerTypePriorizationRecord* priorityRecord =
+            new( ELeave ) CCDGlobalBearerTypePriorizationRecord( iBearerPriorityTableId );
+    CleanupStack::PushL( priorityRecord );
+
+    priorityRecord->iServiceType.SetL( TPtrC( KCDTypeNameLANService ) );
+
+    if ( priorityRecord->FindL( iSession ) )
+        {
+        priorityRecord->LoadL( iSession );
+
+        switch ( aAttribute )
+            {
+            case ECmDefaultPriority:
+                {
+                retVal = priorityRecord->iPriority;
+                }
+                break;
+            case ECmDefaultUiPriority:
+                {
+                retVal = priorityRecord->iUIPriority;
+                }
+                break;
+            default:
+                break;
+            }
+        }
+    CleanupStack::PopAndDestroy( priorityRecord );
+
+    return retVal;
+    }
+
 // End of File
--- a/cmmanager/cmmgr/cmmplugins/cmpluginwlan/src/cmpluginwlanproxy.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginwlan/src/cmpluginwlanproxy.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -18,7 +18,7 @@
 
 #include "cmpluginwlan.h"
 #include <e32std.h>
-#include <ecom/ImplementationProxy.h>
+#include <ecom/implementationproxy.h>
 
 // Exported proxy for instantiation method resolution
 // Define the interface UIDs
--- a/cmmanager/cmmgr/cmmserver/inc/cmmanagertextresolver.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmserver/inc/cmmanagertextresolver.h	Wed Jun 23 17:49:20 2010 +0100
@@ -22,7 +22,7 @@
 /**
  *  Utility class for resolving localised text.
  */
-class CCmManagerTextResolver
+NONSHARABLE_CLASS( CCmManagerTextResolver ) : public CBase
     {
 public:    
     /**
--- a/cmmanager/cmmgr/cmmserver/inc/cmmcache.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmserver/inc/cmmcache.h	Wed Jun 23 17:49:20 2010 +0100
@@ -533,6 +533,13 @@
     void CheckIfConnMethodReferencesCanBeRemovedL( const CCmmConnMethodInstance& aConnMethodInstance );
 
     /**
+     * Check if given connection method is referenced from any protected destination.
+     */
+    void CheckIfConnMethodBelongsToProtectedDestinationL(
+            const CCmmConnMethodInstance& aConnMethodInstance,
+            TBool& aBelongsToProtectedDestination );
+
+    /**
      * Check if the given connection method can be deleted.
      */
     void CheckIfConnMethodCanBeDeletedL( const CCmmConnMethodInstance& aConnMethodInstance );
--- a/cmmanager/cmmgr/cmmserver/inc/cmmconnmethodinstance.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmserver/inc/cmmconnmethodinstance.h	Wed Jun 23 17:49:20 2010 +0100
@@ -69,16 +69,6 @@
 
 public:
     /**
-     * Set the plugin base pointer.
-     */
-    void SetPlugin( CCmPluginBaseEng* aPlugin );
-
-    /**
-     * Get the plugin base pointer.
-     */
-    CCmPluginBaseEng* GetPlugin() const;
-
-    /**
      * Get connection method ID.
      */
     TUint32 GetId() const;
@@ -94,11 +84,6 @@
     TUint32 GetBearerType() const;
 
     /**
-     * Set bearer type.
-     */
-    void SetBearerType( const TUint32& aBearerType );
-
-    /**
      * Get handle ID.
      */
     TInt GetHandle() const;
@@ -171,8 +156,8 @@
      * @return None
      */
     void SetIntAttributeL(
-        const TUint32& aAttribute,
-        const TUint32& aValue );
+            const TUint32& aAttribute,
+            const TUint32& aValue );
 
     /**
      * Sets the integer value identified by aAttribute.
@@ -181,8 +166,8 @@
      * @return None
      */
     void SetBoolAttributeL(
-        const TUint32& aAttribute,
-        const TBool& aValue );
+            const TUint32& aAttribute,
+            const TBool& aValue );
 
     /**
      * Sets the 16 bit string value identified by aAttribute.
@@ -191,8 +176,8 @@
      * @return None
      */
     void SetStringAttributeL(
-        const TUint32& aAttribute,
-        const TDesC16& aValue );
+            const TUint32& aAttribute,
+            const TDesC16& aValue );
 
     /**
      * Sets the 8 bit string value identified by aAttribute.
@@ -201,13 +186,8 @@
      * @return None
      */
     void SetString8AttributeL(
-        const TUint32& aAttribute,
-        const TDesC8& aValue );
-
-    /**
-     * Gets the current status of this connection method instance.
-     */
-    TCmmConnMethodStatus GetStatus() const;
+            const TUint32& aAttribute,
+            const TDesC8& aValue );
 
     /**
      * Sets a new status value.
--- a/cmmanager/cmmgr/cmmserver/inc/cmmconnmethodstruct.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmserver/inc/cmmconnmethodstruct.h	Wed Jun 23 17:49:20 2010 +0100
@@ -80,8 +80,9 @@
     void SetStatus( const TCmmConnMethodStatus& aStatus );
 
     /**
-     * TODO
-     * 
+     * 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.
      */
     void RefreshConnMethodInstanceL(
             CCmmConnMethodInstance& aConnMethodInstance );
@@ -93,8 +94,7 @@
     TInt SessionInstanceClosed(); //TODO, rename to ConnMethodInstanceClosed ?
 
     /**
-     * Set the connection method plugin. Updates status and sets reference
-     * counter to 1.
+     * Set the connection method plugin pointer, bearer type and status.
      */
     void SetPlugin(
             CCmPluginBaseEng* aPlugin,
--- a/cmmanager/cmmgr/cmmserver/inc/cmmdestinationinstance.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmserver/inc/cmmdestinationinstance.h	Wed Jun 23 17:49:20 2010 +0100
@@ -119,6 +119,12 @@
     HBufC* GetLocalisedDestinationNameL();
     void SetDestinationNameL( const TDesC& aDestinationName );
 
+    /**
+     * Get the destination icon.
+     */
+    HBufC* GetDestinationIconL();
+    void SetDestinationIconL( const TDesC& aDestinationIcon );
+
     void GetMetadataL(
             const CMManager::TSnapMetadataField& aMetadataField,
             TUint32& aMetadata );
--- a/cmmanager/cmmgr/cmmserver/inc/cmminstancemapping.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmserver/inc/cmminstancemapping.h	Wed Jun 23 17:49:20 2010 +0100
@@ -48,6 +48,9 @@
 
     // IDs for unsupported connection methods inside this destination.
     RArray<TUint32> iUnsupportedConnMethods;
+    
+    // The destination metadata.
+    TUint32 iMetadata;
     };
 
 
@@ -142,6 +145,14 @@
     TInt DestinationsContainingConnMethod( const TUint32& aConnMethodId ) const;
 
     /**
+     * Returns the destination ids containing the connection method given as
+     * parameter.
+     */
+    void DestinationsContainingConnMethodL(
+            const TUint32 aConnMethodId,
+            RArray<TUint32>& aDestinationIds ) const;
+
+    /**
      * Returns all conenction method IDs. Unsupported connection methods are
      * included if aCheckBearerType is set to EFalse.
      */
@@ -241,6 +252,11 @@
     void RemoveConnMethodFromDestinations(
             const TUint32& aConnMethodId,
             RArray<TUint32>& aChangedDestinations );
+    
+    /**
+     * Get the metadata of the destination identified with given id.
+     */
+    TUint32 DestinationMetadata( const TUint32 aDestinationId ) const;
 
 private:
     /**
--- a/cmmanager/cmmgr/cmmserver/inc/cmmserver.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmserver/inc/cmmserver.h	Wed Jun 23 17:49:20 2010 +0100
@@ -104,6 +104,15 @@
             TInt& aAction,
             TSecurityInfo& aMissing );
 
+    /**
+     * Checks the client's capabilities in the middle of request handling. Some
+     * checks cannot be done with CustomSecurityCheckL() at the start phase of
+     * the operation.
+     * @param aMsg The IPC message from the client.
+     * @return Returns ETrue if client has the needed capabilities. Otherwise
+     * returns EFalse.
+     */
+    CPolicyServer::TCustomResult CapabilityCheckWithProtection( const RMessage2& aMessage );
 
 protected: // From CActive
     /**
--- a/cmmanager/cmmgr/cmmserver/inc/cmmsession.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmserver/inc/cmmsession.h	Wed Jun 23 17:49:20 2010 +0100
@@ -184,6 +184,7 @@
     void GetAllDestinationsL( const RMessage2& aMessage );
     void GetEasyWLANIdL( const RMessage2& aMessage );
     void GetSupportedBearersL( const RMessage2& aMessage );
+    void GetUncategorizedIconL( const RMessage2& aMessage );
     void ReadDefaultConnectionL( const RMessage2& aMessage );
     void ReadGenConnSettingsL( const RMessage2& aMessage );
     void WriteGenConnSettingsL( const RMessage2& aMessage );
@@ -192,7 +193,6 @@
     void CopyConnMethodL( const RMessage2& aMessage );
     void MoveConnMethodL( const RMessage2& aMessage );
     void RemoveConnMethodL( const RMessage2& aMessage );
-
     void RemoveAllReferencesL( const RMessage2& aMessage );
 
     void GetDestinationL( const RMessage2& aMessage );
@@ -210,6 +210,7 @@
     void IsDestinationConnectedL( const RMessage2& aMessage );
     void IsDestinationHiddenL( const RMessage2& aMessage );
     void DestinationIsEqualL( const RMessage2& aMessage );
+    void GetDestinationIconL( const RMessage2& aMessage );
 
     void DestAddConnMethodL( const RMessage2& aMessage );
     void DestAddEmbeddedDestinationL( const RMessage2& aMessage );
@@ -223,6 +224,7 @@
     void SetDestinationHiddenL( const RMessage2& aMessage );
     void UpdateDestinationL( const RMessage2& aMessage );
     void DeleteDestinationL( const RMessage2& aMessage );
+    void SetDestinationIconL( const RMessage2& aMessage );
 
     void CreateConnMethodL( const RMessage2& aMessage );
     void UpdateConnMethodL( const RMessage2& aMessage );
@@ -247,6 +249,13 @@
     void CreateCopyOfExistingL( const RMessage2& aMessage );
     void GetEmbeddedDestinationL( const RMessage2& aMessage );
 
+    /**
+     * Check if CM is protected and if so then check the needed capabilities.
+     */
+    void CheckCapabilitiesForProtectedCML( 
+            const RMessage2& aMessage,
+            CCmmConnMethodInstance* aConnectionMethod );
+
 private:
     RMessage2 iMessage;
 
--- a/cmmanager/cmmgr/cmmserver/src/cmmanagerimpl.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmserver/src/cmmanagerimpl.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -304,23 +304,25 @@
             CleanupStack::PushL( plugin );
 
             TBool inserted( EFalse );
-            //TODO, Implement plugin sorting by priority later.
-            /*
-            TInt defaultPriority( KDataMobilitySelectionPolicyPriorityWildCard );
+
+            TInt defaultPriority( CMManager::KDataMobilitySelectionPolicyPriorityWildCard );
 
-            // No UI priority -> wildcard
-            TRAP_IGNORE( defaultPriority = plugin->GetIntAttributeL( ECmDefaultUiPriority ) );
+            // No priority -> wildcard
+            TRAP_IGNORE( defaultPriority = plugin->GetBearerInfoIntL(
+                    CMManager::ECmDefaultPriority ) );
 
-            for ( TInt j( 0 ); j < iPlugins->Count(); ++j )
+            for ( TInt j = 0; j < iPlugins->Count(); j++ )
                 {
-                if ( defaultPriority > (*iPlugins)[j]->GetIntAttributeL( ECmDefaultUiPriority ) )
+                TUint32 bearerToCompare = (*iPlugins)[j]->GetBearerInfoIntL(
+                        CMManager::ECmDefaultPriority );
+                if ( defaultPriority > bearerToCompare )
                     {
                     continue;
                     }
-                else if ( defaultPriority == (*iPlugins)[j]->GetIntAttributeL( ECmDefaultUiPriority ) )
+                else if ( defaultPriority == bearerToCompare )
                     {
-                    if ( plugin->GetIntAttributeL( ECmExtensionLevel ) >
-                        (*iPlugins)[j]->GetIntAttributeL( ECmExtensionLevel ) )
+                    if ( plugin->GetBearerInfoIntL( ECmExtensionLevel ) >
+                            (*iPlugins)[j]->GetBearerInfoIntL( ECmExtensionLevel ) )
                         {
                         iPlugins->InsertL( j, plugin );
                         inserted = ETrue;
@@ -333,7 +335,7 @@
                     inserted = ETrue;
                     break;
                     }
-                }*/
+                }
 
             if ( !inserted )
                 {
--- a/cmmanager/cmmgr/cmmserver/src/cmmcache.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmserver/src/cmmcache.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -401,11 +401,13 @@
 
 
     // Store the connection method into cache.
-    CCmmConnMethodStruct* connMethodStruct = CCmmConnMethodStruct::NewLC( connMethodId ); // Use connMethodId here, so ID is either a real ID or a temporary ID.
+    // Use connMethodId here, so ID is either a real ID or a temporary ID.
+    CCmmConnMethodStruct* connMethodStruct = CCmmConnMethodStruct::NewL( connMethodId );
     connMethodStruct->SetPlugin( plugin, aBearerType, ECmmConnMethodStatusNotSaved );
+    CleanupStack::Pop( plugin );
+    CleanupStack::PushL( connMethodStruct );
     iConnMethodArray.AppendL( connMethodStruct );
     CleanupStack::Pop( connMethodStruct );
-    CleanupStack::Pop( plugin ); //TODO, pop after SetPlugin()-call?
 
     // Copy the connection method data to session instance.
     aConnMethodInstance.CopyDataL( connMethodStruct ); // Will increase reference counter.
@@ -416,6 +418,7 @@
         // Add connection method to destination.
         aDestinationInstance->AddConnMethodL( aConnMethodInstance );
         }
+
     OstTraceFunctionExit0( CCMMCACHE_CREATECONNMETHODL_EXIT );
     }
 
@@ -445,15 +448,21 @@
         User::Leave( KErrNotFound );
         }
 
-    CCmPluginBaseEng* pluginCopy = plugin->CreateCopyL( aConnMethodInstance.GetPluginDataInstance() );
+    CCmPluginBaseEng* pluginCopy =
+            plugin->CreateCopyL( aConnMethodInstance.GetPluginDataInstance() );
     CleanupStack::PushL( pluginCopy );
 
     // Store the connection method into cache.
-    CCmmConnMethodStruct* connMethodStruct = CCmmConnMethodStruct::NewLC( NextFreeTemporaryId() );
-    connMethodStruct->SetPlugin( pluginCopy, aConnMethodInstance.GetBearerType(), ECmmConnMethodStatusNotSaved );
+    CCmmConnMethodStruct* connMethodStruct =
+            CCmmConnMethodStruct::NewL( NextFreeTemporaryId() );
+    connMethodStruct->SetPlugin(
+            pluginCopy,
+            aConnMethodInstance.GetBearerType(),
+            ECmmConnMethodStatusNotSaved );
+    CleanupStack::Pop( pluginCopy );
+    CleanupStack::PushL( connMethodStruct );
     iConnMethodArray.AppendL( connMethodStruct );
     CleanupStack::Pop( connMethodStruct );
-    CleanupStack::Pop( pluginCopy ); //TODO, pop after SetPlugin()-call?
 
     // Copy the connection method data to session instance.
     aNewConnMethodInstance.CopyDataL( connMethodStruct ); // Will increase reference counter.
@@ -2103,11 +2112,12 @@
         }
 
     // Store the connection method into cache.
-    CCmmConnMethodStruct* connMethodStruct = CCmmConnMethodStruct::NewLC( aConnMethodId );
+    CCmmConnMethodStruct* connMethodStruct = CCmmConnMethodStruct::NewL( aConnMethodId );
     connMethodStruct->SetPlugin( plugin, bearerType, ECmmConnMethodStatusValid );
+    CleanupStack::Pop( plugin );
+    CleanupStack::PushL( connMethodStruct );
     iConnMethodArray.AppendL( connMethodStruct );
     CleanupStack::Pop( connMethodStruct );
-    CleanupStack::Pop( plugin ); //TODO, pop after SetPlugin()-call?
 
     // Copy the connection method data to session instance.
     aConnMethodInstance.CopyDataL( connMethodStruct ); // Will increase reference counter.
@@ -2875,6 +2885,8 @@
 void CCmmCache::CheckIfConnMethodReferencesCanBeRemovedL(
         const CCmmConnMethodInstance& aConnMethodInstance )
     {
+    OstTraceFunctionEntry0( CCMMCACHE_CHECKIFCONNMETHODREFERENCESCANBEREMOVEDL_ENTRY );
+
     TUint32 connMethodId( aConnMethodInstance.GetId() );
 
     // Check that connection method exists in database.
@@ -2889,8 +2901,6 @@
         User::Leave( KErrArgument );
         }
 
-    //TODO, what if protected?
-
     // Iterate all destinations in database and check if possible reference can
     // be removed.
     RArray<TUint32> dbDestinations;
@@ -2910,6 +2920,49 @@
         {
         User::Leave( KErrInUse );
         }
+
+    OstTraceFunctionExit0( CCMMCACHE_CHECKIFCONNMETHODREFERENCESCANBEREMOVEDL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// Check if the given connection method can have all references removed and
+// made into an uncategorized connection method. //TODO, fix comment, this looks like copy&paste from above
+// ---------------------------------------------------------------------------
+//
+void CCmmCache::CheckIfConnMethodBelongsToProtectedDestinationL(
+        const CCmmConnMethodInstance& aConnMethodInstance,
+        TBool& aBelongsToProtectedDestination )
+    {
+    OstTraceFunctionEntry0( CCMMCACHE_CHECKIFCONNMETHODBELONGSTOPROTECTEDDESTINATIONL_ENTRY );
+
+    TUint32 connMethodId( aConnMethodInstance.GetId() );
+
+    // Check that connection method exists in database.
+    if ( !iInstanceMapping->ValidConnMethodId( connMethodId ) )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    aBelongsToProtectedDestination = EFalse;
+    // Get destinations which have references to connection method passed as parameter.
+    RArray<TUint32> dbDestinations;
+    CleanupClosePushL( dbDestinations );
+    iInstanceMapping->DestinationsContainingConnMethodL( connMethodId, dbDestinations );
+    TUint32 metadata( 0 );
+    for ( TInt i = 0; i < dbDestinations.Count(); i++ )
+        {
+        // Check if any of destinations is protected.
+        metadata = iInstanceMapping->DestinationMetadata( dbDestinations[i] );
+        TUint32 protlevel = ( metadata & KDestProtectionLevelMask ) >> KBitsToShiftDestProtectionLevel;
+        if ( protlevel == CMManager::EProtLevel1 || protlevel == CMManager::EProtLevel3 )
+            {
+            aBelongsToProtectedDestination = ETrue;
+            break;
+            }
+        }
+    CleanupStack::PopAndDestroy( &dbDestinations );
+
+    OstTraceFunctionExit0( CCMMCACHE_CHECKIFCONNMETHODBELONGSTOPROTECTEDDESTINATIONL_EXIT );
     }
 
 // ---------------------------------------------------------------------------
@@ -2919,6 +2972,8 @@
 void CCmmCache::CheckIfConnMethodCanBeDeletedL(
         const CCmmConnMethodInstance& aConnMethodInstance )
     {
+    OstTraceFunctionEntry0( CCMMCACHE_CHECKIFCONNMETHODCANBEDELETEDL_ENTRY );
+
     TUint32 connMethodId( aConnMethodInstance.GetId() );
 
     // Find connection method from cache.
@@ -2961,6 +3016,8 @@
         {
         User::Leave( KErrLocked );
         }
+
+    OstTraceFunctionExit0( CCMMCACHE_CHECKIFCONNMETHODCANBEDELETEDL_EXIT );
     }
 
 // ---------------------------------------------------------------------------
@@ -2970,6 +3027,8 @@
 void CCmmCache::CheckIfDestinationCanBeDeletedL(
         const CCmmDestinationInstance& aDestinationInstance )
     {
+    OstTraceFunctionEntry0( CCMMCACHE_CHECKIFDESTINATIONCANBEDELETEDL_ENTRY );
+
     TUint32 destinationId( aDestinationInstance.GetId() );
 
     // Find destination from cache.
@@ -3019,6 +3078,8 @@
         {
         User::Leave( KErrInUse );
         }
+
+    OstTraceFunctionExit0( CCMMCACHE_CHECKIFDESTINATIONCANBEDELETEDL_EXIT );
     }
 
 // ---------------------------------------------------------------------------
@@ -3035,13 +3096,16 @@
 // methods inside it are connected.
 // ---------------------------------------------------------------------------
 //
-void CCmmCache::DeleteDestinationForcedL( CCmmDestinationInstance& aDestinationInstance ) //TODO, OST
+void CCmmCache::DeleteDestinationForcedL( CCmmDestinationInstance& aDestinationInstance )
     {
-    //TODO
+    OstTraceFunctionEntry0( CCMMCACHE_DELETEDESTINATIONFORCEDL_ENTRY );
+
     if ( !DestinationConnectedL( 0, &aDestinationInstance ) )
         {
         DeleteDestinationL( aDestinationInstance, ETrue );
         }
+
+    OstTraceFunctionExit0( CCMMCACHE_DELETEDESTINATIONFORCEDL_EXIT );
     }
 
 // End of file
--- a/cmmanager/cmmgr/cmmserver/src/cmmconnmethodinstance.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmserver/src/cmmconnmethodinstance.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -36,7 +36,9 @@
 // Two phased construction.
 // ---------------------------------------------------------------------------
 //
-CCmmConnMethodInstance* CCmmConnMethodInstance::NewL( CCmmSession* aCmmSession, CCmmCache* aCache )
+CCmmConnMethodInstance* CCmmConnMethodInstance::NewL(
+        CCmmSession* aCmmSession,
+        CCmmCache* aCache )
     {
     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_NEWL_ENTRY );
 
@@ -51,7 +53,9 @@
 // Two phased construction.
 // ---------------------------------------------------------------------------
 //
-CCmmConnMethodInstance* CCmmConnMethodInstance::NewLC( CCmmSession* aCmmSession, CCmmCache* aCache )
+CCmmConnMethodInstance* CCmmConnMethodInstance::NewLC(
+        CCmmSession* aCmmSession,
+        CCmmCache* aCache )
     {
     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_NEWLC_ENTRY );
 
@@ -86,7 +90,9 @@
 // Constructor.
 // ---------------------------------------------------------------------------
 //
-CCmmConnMethodInstance::CCmmConnMethodInstance( CCmmSession* aCmmSession, CCmmCache* aCache )
+CCmmConnMethodInstance::CCmmConnMethodInstance(
+        CCmmSession* aCmmSession,
+        CCmmCache* aCache )
         :
         iCmmSession( aCmmSession ),
         iCache( aCache )
@@ -117,37 +123,11 @@
     }
 
 // ---------------------------------------------------------------------------
-// Set the plugin base pointer.
-// ---------------------------------------------------------------------------
-//
-void CCmmConnMethodInstance::SetPlugin( CCmPluginBaseEng* aPlugin )
-    {
-    OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_SETPLUGIN_ENTRY );
-
-    iPlugin = aPlugin;
-
-    OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_SETPLUGIN_EXIT );
-    }
-
-// ---------------------------------------------------------------------------
-// Get the plugin base pointer.
-// ---------------------------------------------------------------------------
-//
-CCmPluginBaseEng* CCmmConnMethodInstance::GetPlugin() const
-    {
-    OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_GETPLUGIN_ENTRY );
-    OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_GETPLUGIN_EXIT );
-    return iPlugin;
-    }
-
-// ---------------------------------------------------------------------------
 // Get pointer to the plugin data container.
 // ---------------------------------------------------------------------------
 //
 CCmClientPluginInstance* CCmmConnMethodInstance::GetPluginDataInstance() const
     {
-    OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_GETPLUGINDATAINSTANCE_ENTRY );
-    OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_GETPLUGINDATAINSTANCE_EXIT );
     return iPluginDataInstance;
     }
 
@@ -157,9 +137,6 @@
 //
 TUint32 CCmmConnMethodInstance::GetId() const
     {
-    OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_GETID_ENTRY );
-    OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_GETID_EXIT );
-
     return iConnMethodId;
     }
 
@@ -182,26 +159,10 @@
 //
 TUint32 CCmmConnMethodInstance::GetBearerType() const
     {
-    OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_GETBEARERTYPE_ENTRY );
-    OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_GETBEARERTYPE_EXIT );
-
     return iBearerType;
     }
 
 // ---------------------------------------------------------------------------
-// Get bearer type.
-// ---------------------------------------------------------------------------
-//
-void CCmmConnMethodInstance::SetBearerType( const TUint32& aBearerType )
-    {
-    OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_SETBEARERTYPE_ENTRY );
-
-    iBearerType = aBearerType;
-
-    OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_SETBEARERTYPE_EXIT );
-    }
-
-// ---------------------------------------------------------------------------
 // Get handle ID.
 // ---------------------------------------------------------------------------
 //
@@ -307,52 +268,6 @@
     }
 
 // ---------------------------------------------------------------------------
-// Refresh the relevant connection method data in cache side object to be in
-// synch with database and copy that data back to this session side connection
-// method object.
-// ---------------------------------------------------------------------------
-//
-//TODO, cleanup
-/*
-void CCmmConnMethodInstance::RefreshDataL( CCmmConnMethodStruct* aConnMethodStruct ) //TODO, remove
-    {
-
-    //TODO
-    //if ( !aConnMethodStruct )
-        //{
-        //User::Leave( KErrCorrupt );
-        //}
-    if ( !iPlugin )
-        {
-        User::Leave( KErrCorrupt );
-        }
-
-    switch ( aConnMethodStruct->GetStatus() )
-        {
-        case ECmmConnMethodStatusValid:
-        case ECmmConnMethodStatusToBeDeleted:
-            {
-            //TODO, add record status check later and only call Reload() if necessary. TCmmRecordStatus
-            //if ( !aConnMethodStruct->UpToDate() )
-            //    {
-                iPlugin->ReLoadL();
-            //    }
-            iPlugin->GetPluginDataL( iPluginDataInstance );
-            }
-            break;
-        case ECmmConnMethodStatusNotSaved: // This is checked before.
-        case ECmmConnMethodStatusChanged:
-        default:
-            User::Leave( KErrCorrupt );  // Error, invalid status.
-            break;
-        }
-
-    // Internal state need to be set to the same state as after a successfull update.
-    UpdateSuccessful();
-
-    }*/
-
-// ---------------------------------------------------------------------------
 // CCmmConnMethodInstance::GetIntAttributeL
 // ---------------------------------------------------------------------------
 //
@@ -360,9 +275,15 @@
     {
     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_GETINTATTRIBUTEL_ENTRY );
 
-    __ASSERT_DEBUG( iPlugin != NULL, User::Leave( KErrNotFound ) );
+    if ( !iPlugin )
+        {
+        User::Leave( KErrCorrupt );
+        }
 
-    return iPlugin->GetIntAttributeL( aAttribute, iPluginDataInstance );
+    TUint32 result = iPlugin->GetIntAttributeL( aAttribute, iPluginDataInstance );
+
+    OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_GETINTATTRIBUTEL_EXIT );
+    return result;
     }
 
 // ---------------------------------------------------------------------------
@@ -373,10 +294,12 @@
     {
     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_GETBOOLATTRIBUTEL_ENTRY );
 
-    __ASSERT_DEBUG( iPlugin != NULL, User::Leave( KErrNotFound ) );
+    if ( !iPlugin )
+        {
+        User::Leave( KErrCorrupt );
+        }
 
     TBool retVal( EFalse );
-
     switch ( aAttribute )
         {
         case CMManager::ECmConnected:
@@ -399,6 +322,7 @@
             {
             retVal = iPlugin->GetBoolAttributeL( aAttribute, iPluginDataInstance );
             }
+            break;
         }
 
     OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_GETBOOLATTRIBUTEL_EXIT );
@@ -413,9 +337,15 @@
     {
     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_GETSTRINGATTRIBUTEL_ENTRY );
 
-    __ASSERT_DEBUG( iPlugin != NULL, User::Leave( KErrNotFound ) );
+    if ( !iPlugin )
+        {
+        User::Leave( KErrCorrupt );
+        }
 
-    return iPlugin->GetStringAttributeL( aAttribute, iPluginDataInstance );
+    HBufC* result = iPlugin->GetStringAttributeL( aAttribute, iPluginDataInstance );
+
+    OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_GETSTRINGATTRIBUTEL_EXIT );
+    return result;
     }
 
 // ---------------------------------------------------------------------------
@@ -426,9 +356,15 @@
     {
     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_GETSTRING8ATTRIBUTEL_ENTRY );
 
-    __ASSERT_DEBUG( iPlugin != NULL, User::Leave( KErrNotFound ) );
+    if ( !iPlugin )
+        {
+        User::Leave( KErrCorrupt );
+        }
 
-    return iPlugin->GetString8AttributeL( aAttribute, iPluginDataInstance );
+    HBufC8* result = iPlugin->GetString8AttributeL( aAttribute, iPluginDataInstance );
+
+    OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_GETSTRING8ATTRIBUTEL_EXIT );
+    return result;
     }
 
 // ---------------------------------------------------------------------------
@@ -441,7 +377,10 @@
     {
     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_SETINTATTRIBUTEL_ENTRY );
 
-    __ASSERT_DEBUG( iPlugin != NULL, User::Leave( KErrNotFound ) );
+    if ( !iPlugin )
+        {
+        User::Leave( KErrCorrupt );
+        }
 
     iPlugin->SetIntAttributeL( aAttribute, aValue, iPluginDataInstance );
 
@@ -458,7 +397,10 @@
     {
     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_SETBOOLATTRIBUTEL_ENTRY );
 
-    __ASSERT_DEBUG( iPlugin != NULL, User::Leave( KErrNotFound ) );
+    if ( !iPlugin )
+        {
+        User::Leave( KErrCorrupt );
+        }
 
     iPlugin->SetBoolAttributeL( aAttribute, aValue, iPluginDataInstance );
 
@@ -475,7 +417,10 @@
     {
     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_SETSTRINGATTRIBUTEL_ENTRY );
 
-    __ASSERT_DEBUG( iPlugin != NULL, User::Leave( KErrNotFound ) );
+    if ( !iPlugin )
+        {
+        User::Leave( KErrCorrupt );
+        }
 
     iPlugin->SetStringAttributeL( aAttribute, aValue, iPluginDataInstance );
 
@@ -492,7 +437,10 @@
     {
     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_SETSTRING8ATTRIBUTEL_ENTRY );
 
-    __ASSERT_DEBUG( iPlugin != NULL, User::Leave( KErrNotFound ) );
+    if ( !iPlugin )
+        {
+        User::Leave( KErrCorrupt );
+        }
 
     iPlugin->SetString8AttributeL( aAttribute, aValue, iPluginDataInstance );
 
@@ -500,17 +448,6 @@
     }
 
 // ---------------------------------------------------------------------------
-// Gets the current status of this connection method instance.
-// ---------------------------------------------------------------------------
-//
-TCmmConnMethodStatus CCmmConnMethodInstance::GetStatus() const
-    {
-    OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_GETSTATUS_ENTRY );
-    OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_GETSTATUS_EXIT );
-    return iStatus;
-    }
-
-// ---------------------------------------------------------------------------
 // Sets a new status value.
 // ---------------------------------------------------------------------------
 //
@@ -531,7 +468,11 @@
 //
 void CCmmConnMethodInstance::UpdateSuccessful()
     {
+    OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_UPDATESUCCESSFUL_ENTRY );
+
     SetStatus( ECmmConnMethodStatusValid );
+
+    OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_UPDATESUCCESSFUL_EXIT );
     }
 
 // ---------------------------------------------------------------------------
@@ -542,8 +483,12 @@
 //
 void CCmmConnMethodInstance::DeleteSuccessful( const TUint32& aNewSecondaryId )
     {
+    OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_DELETESUCCESSFUL_ENTRY );
+
     SetStatus( ECmmConnMethodStatusChanged );
     SetId( aNewSecondaryId );
+
+    OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_DELETESUCCESSFUL_EXIT );
     }
 
 // ---------------------------------------------------------------------------
--- a/cmmanager/cmmgr/cmmserver/src/cmmconnmethodstruct.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmserver/src/cmmconnmethodstruct.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -172,11 +172,9 @@
     }
 
 // ---------------------------------------------------------------------------
-// TODO
-//
-// Refresh the relevant connection method data in cache side object to be in
-// synch with database and copy that data back to this session side connection
-// method object.
+// 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.
 // ---------------------------------------------------------------------------
 //
 void CCmmConnMethodStruct::RefreshConnMethodInstanceL(
@@ -236,8 +234,7 @@
     }
 
 // ---------------------------------------------------------------------------
-// Set the connection method plugin. Updates status and sets reference
-// counter to 1.
+// Set the connection method plugin pointer, bearer type and status.
 // ---------------------------------------------------------------------------
 //
 void CCmmConnMethodStruct::SetPlugin(
@@ -251,13 +248,13 @@
     // when data is copied into it.
     if ( iReferenceCounter != 0 )
         {
-        ASSERT( 0 ); // Error.
+        ASSERT( 0 ); // Error, wrong internal status.
         }
 
     iConnMethodPlugin = aPlugin;
     iBearerType = aBearerType;
 
-    switch ( aStatus ) //TODO, add missing status
+    switch ( aStatus )
         {
         // Fallthrough intended
         case ECmmConnMethodStatusNotSaved:
@@ -265,9 +262,10 @@
             iStatus = aStatus;
             break;
         case ECmmConnMethodStatusChanged:
+        case ECmmConnMethodStatusToBeDeleted:
         default:
             iStatus = ECmmConnMethodStatusChanged;
-            ASSERT( 0 ); // Error, invalid status.
+            ASSERT( 0 ); // Error, invalid status as argument.
             break;
         }
 
--- a/cmmanager/cmmgr/cmmserver/src/cmmdestinationinstance.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmserver/src/cmmdestinationinstance.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -425,6 +425,8 @@
 //
 HBufC* CCmmDestinationInstance::GetLocalisedDestinationNameL()
     {
+    OstTraceFunctionEntry0( CCMMDESTINATIONINSTANCE_GETLOCALISEDDESTINATIONNAMEL_ENTRY );
+
     RefreshRecordL( ECmmDestNetworkRecord );
 
     if ( !iNetworkRecord )
@@ -463,12 +465,13 @@
             break;
         }
 
-    // Not Internet, operator or intranet...or something went wrong 
+    // Not Internet, operator or intranet, or something went wrong. 
     if ( !isLocalised || ( isLocalised && !resolvedText ) )
         {
-        resolvedText = ( iNetworkRecord->iRecordName.GetL() ).AllocL();
+        resolvedText = TPtrC( iNetworkRecord->iRecordName ).AllocL();
         }
-    
+
+    OstTraceFunctionExit0( CCMMDESTINATIONINSTANCE_GETLOCALISEDDESTINATIONNAMEL_EXIT );
     return resolvedText;
     }
 
@@ -480,8 +483,6 @@
     {
     OstTraceFunctionEntry0( CCMMDESTINATIONINSTANCE_SETDESTINATIONNAMEL_ENTRY );
 
-    //TODO, capability check depending on destination protection level, or if it is internet destination. Internet destination should be protected always?
-
     // Write action, load all records.
     LoadAllRecordsL();
 
@@ -496,6 +497,48 @@
     }
 
 // ---------------------------------------------------------------------------
+// Get the destination icon.
+// ---------------------------------------------------------------------------
+//
+HBufC* CCmmDestinationInstance::GetDestinationIconL()
+    {
+    OstTraceFunctionEntry0( CCMMDESTINATIONINSTANCE_GETDESTINATIONICONL_ENTRY );
+
+    RefreshRecordL( ECmmDestMetadataRecord );
+
+    if ( !iMetadataRecord )
+        {
+        User::Leave( KErrCorrupt );
+        }
+
+    HBufC* icon( NULL );
+    //icon = TPtrC( iMetadataRecord->iIconFileName ).AllocL();//TODO, enable after commsdat icon changes are implemented.
+	icon = KNullDesC().AllocL();//TODO
+
+    OstTraceFunctionExit0( CCMMDESTINATIONINSTANCE_GETDESTINATIONICONL_EXIT );
+    return icon;
+    }
+
+// ---------------------------------------------------------------------------
+// Set the destination icon.
+// ---------------------------------------------------------------------------
+//
+void CCmmDestinationInstance::SetDestinationIconL( const TDesC& /*aDestinationIcon*/ )
+    {
+    OstTraceFunctionEntry0( CCMMDESTINATIONINSTANCE_SETDESTINATIONICONL_ENTRY );
+
+    // Write action, load all records.
+    LoadAllRecordsL();
+
+    //iMetadataRecord->iIconFileName.SetL( aDestinationIcon );//TODO, enable after commsdat icon changes are implemented.
+
+    iMetadataRecordStatus = ECmmRecordStatusModified;
+    iStatus = ECmmDestinationStatusChanged;
+
+    OstTraceFunctionExit0( CCMMDESTINATIONINSTANCE_SETDESTINATIONICONL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
 // Get metadata of specified type.
 // ---------------------------------------------------------------------------
 //
@@ -630,8 +673,7 @@
     // Write action, load all records.
     LoadAllRecordsL();
 
-    //TODO, verify capability check is done (NetworkControl).
-
+    //TODO, comment this:
     iCurrentProtectionLevel = aProtectionLevel;
     if ( !iProtectionChanged )
         {
@@ -1289,19 +1331,16 @@
     TBool result( ETrue );
 
     if ( iNetworkRecordStatus != ECmmRecordStatusLoaded &&
-            iNetworkRecordStatus != ECmmRecordStatusExpired &&
             iNetworkRecordStatus != ECmmRecordStatusModified )
         {
         result = EFalse;
         }
     if ( iDestApRecordStatus != ECmmRecordStatusLoaded &&
-            iDestApRecordStatus != ECmmRecordStatusExpired &&
             iDestApRecordStatus != ECmmRecordStatusModified )
         {
         result = EFalse;
         }
     if ( iMetadataRecordStatus != ECmmRecordStatusLoaded &&
-            iMetadataRecordStatus != ECmmRecordStatusExpired &&
             iMetadataRecordStatus != ECmmRecordStatusModified )
         {
         result = EFalse;
@@ -1316,7 +1355,11 @@
     }
 
 // ---------------------------------------------------------------------------
-// Loads a certain type of record from database if it is not up-to-date.
+// Loads a requested type of record from database if it is not yet loaded.
+//
+// Currently all records are loaded when client opens a handle to a
+// destination, but if future optimizations are added and records are only
+// loaded when needed, the functionality of this method becomes essential.
 // ---------------------------------------------------------------------------
 //
 void CCmmDestinationInstance::RefreshRecordL( TCmmDbRecords aRecordType )
@@ -1344,16 +1387,16 @@
         {
         // Fallthrough intended
         case ECmmRecordStatusBlank:
-        case ECmmRecordStatusExpired:
             iCache->LoadDestinationRecordL( *this, aRecordType );
             break;
         case ECmmRecordStatusLoaded:
         case ECmmRecordStatusModified:
             // Record is up-to-date.
             break;
+        case ECmmRecordStatusExpired:
         case ECmmRecordStatusUnsaved:
         default:
-            User::Leave( KErrCorrupt ); // Error, unknown status.
+            User::Leave( KErrCorrupt ); // Error, invalid or unknown status.
             break;
         }
 
@@ -1362,6 +1405,7 @@
 
 // ---------------------------------------------------------------------------
 // Loads all records from database that are not up-to-date.
+// Guarantees the record pointers are valid or leaves.
 // ---------------------------------------------------------------------------
 //
 void CCmmDestinationInstance::LoadAllRecordsL()
--- a/cmmanager/cmmgr/cmmserver/src/cmmdestinationstruct.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmserver/src/cmmdestinationstruct.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -211,7 +211,7 @@
         // Not found -> fill in with default values.
         iMetadataRecord->iSNAP = iId;
         iMetadataRecord->iMetadata = 0;
-        iMetadataRecord->iIcon = 0;
+        //iMetadataRecord->iIcon = 0;//TODO, set to 0 or not?
         iMetadataRecord->SetRecordId( KCDNewRecordRequest );
         iMetadataRecordStatus = ECmmRecordStatusUnsaved;
         }
@@ -836,7 +836,7 @@
                     {
                     // Normal connection method.
                     snapRecord2->iEmbeddedSNAP = 0;
-                    snapRecord2->iIAP = ( KCDMaskShowField & CommsDat::KCDTIdIAPRecord ) | ( connMethodRealId << 8 );
+                    snapRecord2->iIAP = CommsDat::KCDTIdIAPRecord | ( connMethodRealId << 8 );
                     snapRecord2->iPriority = i + 1; // Priority values start from 1.
                     aDestinationInstance.iConnMethodItemArray[i].iPriority = i + 1; // Update this just in case.
                     }
@@ -1333,6 +1333,10 @@
                 {
                 metadataRecord->iIcon.SetL( source->iIcon );
                 }
+            //if ( !source->iIconFileName.IsNull() )//TODO, enable after commsdat icon changes are implemented.
+                //{
+                //metadataRecord->iIconFileName.SetL( source->iIconFileName );
+                //}
             metadataRecord->SetElementId( source->ElementId() );
 
             CleanupStack::Pop( metadataRecord );
--- a/cmmanager/cmmgr/cmmserver/src/cmminstancemapping.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmserver/src/cmminstancemapping.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -445,6 +445,55 @@
     }
 
 // ---------------------------------------------------------------------------
+// Returns the destination IDs containing the connection method given as
+// parameter.
+// ---------------------------------------------------------------------------
+//
+void CCmmInstanceMapping::DestinationsContainingConnMethodL(
+        const TUint32 aConnMethodId,
+        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++ )
+        {
+        TBool foundInThisDestination( EFalse );
+
+        // Loop through all connection methods in this destination.
+        count = iDestinations[i]->iConnMethodItemArray.Count();
+        for ( TInt j = 0; j < count; j++ )
+            {
+            if ( iDestinations[i]->iConnMethodItemArray[j].iId == aConnMethodId )
+                {
+                foundInThisDestination = ETrue;
+                aDestinationIds.AppendL( iDestinations[i]->iId );
+                break;
+                }
+            }
+
+        // Check unsupported connection methods also.
+        if ( !foundInThisDestination )
+            {
+            count = iDestinations[i]->iUnsupportedConnMethods.Count();
+            for ( TInt j = 0; j < count; j++ )
+                {
+                if ( iDestinations[i]->iUnsupportedConnMethods[j] == aConnMethodId )
+                    {
+                    aDestinationIds.AppendL( iDestinations[i]->iId );
+                    break;
+                    }
+                }
+            }
+        }
+    
+    OstTraceFunctionExit0( CCMMINSTANCEMAPPING_DESTINATIONSCONTAININGCONNMETHODL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
 // Get database session.
 // ---------------------------------------------------------------------------
 //
@@ -575,7 +624,21 @@
                     {
                     CDestination* dest = CDestination::NewL();
                     dest->iId = destinationId;
-                    iDestinations.Append( dest );
+
+                    CCDSNAPMetadataRecord* metadataRecord = new( ELeave ) CCDSNAPMetadataRecord( 
+                            iCache.TableId( ECmmDestMetadataRecord ) );
+                    CleanupStack::PushL( metadataRecord );
+
+                    // Add destination metadata.
+                    metadataRecord->iSNAP.SetL( destinationId );
+                    if ( metadataRecord->FindL( Session() ) )
+                        {
+                        metadataRecord->LoadL( Session() );
+                        dest->iMetadata = metadataRecord->iMetadata;
+                        iDestinations.AppendL( dest );
+                        }
+                    CleanupStack::PopAndDestroy( metadataRecord );
+                    metadataRecord = NULL;
                     }
                 }
             }
@@ -1064,6 +1127,7 @@
         const TUint32& aConnMethodId,
         RArray<TUint32>& aChangedDestinations )
     {
+    OstTraceFunctionEntry0( DUP1_CCMMINSTANCEMAPPING_REMOVECONNMETHOD_ENTRY );
 
     // Remove from list of connection methods.
     for ( TInt i = 0; i < iConnMethodItemArray.Count(); i++ )
@@ -1089,7 +1153,8 @@
                 }
             }
         }
-
+    
+    OstTraceFunctionExit0( DUP1_CCMMINSTANCEMAPPING_REMOVECONNMETHOD_EXIT );
     }
 
 // ---------------------------------------------------------------------------
@@ -1159,4 +1224,28 @@
     OstTraceFunctionExit0( CCMMINSTANCEMAPPING_REMOVECONNMETHODFROMDESTINATIONS_EXIT );
     }
 
+// ---------------------------------------------------------------------------
+// Iterate through destinations to find the one identified with parameter
+// and returns its metadata mask.
+// ---------------------------------------------------------------------------
+//
+TUint32 CCmmInstanceMapping::DestinationMetadata( 
+        const TUint32 aDestinationId ) const
+    {
+    OstTraceFunctionEntry0( CCMMINSTANCEMAPPING_DESTINATIONMETADATA_ENTRY );
+
+    TUint32 metadata( 0 );
+    for ( TInt i = 0; i < iDestinations.Count(); i++ )
+        {
+        if ( iDestinations[i]->iId == aDestinationId )
+            {
+            metadata = iDestinations[i]->iMetadata;
+            break;
+            }
+        }
+
+    OstTraceFunctionExit0( CCMMINSTANCEMAPPING_DESTINATIONMETADATA_EXIT );
+    return metadata;
+    }
+
 // End of file
--- a/cmmanager/cmmgr/cmmserver/src/cmmserver.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmserver/src/cmmserver.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -34,29 +34,29 @@
 
 const TInt CCmmServer::iCmmRanges[iCmmRangeCount] =
     {
-    0,      //   0-10
-    11,     //  11-14
-    15,     //  15-21
-    22,     //  22-99
-    100,    // 100-112
-    113,    // 113-126
-    127,    // 127-199
-    200,    // 200-205
-    206,    // 206-210
-    211,    // 211-214
-    215,    // 215-220
-    221     // 221-KMaxInt
+    0,      //  1.   0-11
+    12,     //  2.  12-15
+    16,     //  3.  16-22
+    23,     //  4.  23-99
+    100,    //  5. 100-113
+    114,    //  6. 114-128
+    129,    //  7. 129-199
+    200,    //  8. 200-205
+    206,    //  9. 206-210
+    211,    // 10. 211-214
+    215,    // 11. 215-220
+    221     // 12. 221-KMaxInt
     };
 
 const TUint8 CCmmServer::iCmmElementIndex[iCmmRangeCount] =
     {
-    CPolicyServer::EAlwaysPass,     // 0-10
-    CPolicyServer::ECustomCheck,    // 11-14
-    CPolicyServer::ECustomCheck,    // 15-21
-    CPolicyServer::ENotSupported,   // 22-99
-    CPolicyServer::EAlwaysPass,     // 100-112
-    CPolicyServer::ECustomCheck,    // 113-126
-    CPolicyServer::ENotSupported,   // 127-199
+    CPolicyServer::EAlwaysPass,     // 0-11
+    CPolicyServer::ECustomCheck,    // 12-15
+    CPolicyServer::ECustomCheck,    // 16-22
+    CPolicyServer::ENotSupported,   // 23-99
+    CPolicyServer::EAlwaysPass,     // 100-113
+    CPolicyServer::ECustomCheck,    // 114-128
+    CPolicyServer::ENotSupported,   // 129-199
     CPolicyServer::EAlwaysPass,     // 200-205
     CPolicyServer::ECustomCheck,    // 206-210
     CPolicyServer::ECustomCheck,    // 211-214
@@ -73,12 +73,12 @@
     {_INIT_SECURITY_POLICY_C1(ECapabilityNetworkControl), CPolicyServer::EFailClient},
     };
 
-const CPolicyServer::TPolicy CCmmServer::iCmmPolicy = //TODO, check comments
+const CPolicyServer::TPolicy CCmmServer::iCmmPolicy =
     {
     CPolicyServer::EAlwaysPass, // Specifies all connect attempts should pass
     iCmmRangeCount,     // Count of ranges
-    iCmmRanges,         // 0-999, 1000-1008, 1009...
-    iCmmElementIndex,   // Only range 1000-1008 are checked
+    iCmmRanges,         // 0-11, 12-15, 16...
+    iCmmElementIndex,   // What to do for each range
     iCmmElements        // The list of policy elements
     };
 
@@ -96,7 +96,7 @@
     {
     switch ( aMessage.Function() )
         {
-        // ***********  2nd range: 11-14 *************
+        // ***********  2nd range: 12-15 *************
         case ECmmGetConnMethodInfoInt:
         case ECmmGetConnMethodInfoBool:
         case ECmmGetConnMethodInfoString:
@@ -127,7 +127,7 @@
                 case CMManager::EWlanWapiPsk:
                 case CMManager::EWlanWapiPskFormat:
                 // 802.1x:
-                case CMManager::EWlan802_1xAllowUnencrypted: //TODO, should this be here?
+                case CMManager::EWlan802_1xAllowUnencrypted:
                 // Authentication:
                 case CMManager::ECmIFAuthName:
                 case CMManager::EPacketDataIFAuthName:
@@ -139,38 +139,31 @@
                         EPass : EFail;
                     }
                 default:
-                    // By default reading does not need any capabilities
+                    // By default reading does not need any capabilities.
                     return EPass;
                 }
             }
-        // ***********  3rd range: 15-21 *************
+        // ***********  3rd range: 16-22 *************
         case ECmmUpdateBearerPriorityArray:
         case ECmmWriteDefaultConnection:
         case ECmmWriteGeneralConnectionSettings:
+        // At this phase all capabilities are not checked because of
+        // it's too heavy operation...
+        // At Session phase the protection of the destination and/or
+        // connection method is checked. If protected, 
+        // ECapabilityNetworkControl is checked.
+        case ECmmCopyConnMethod:
+        case ECmmMoveConnMethod:
+        case ECmmRemoveConnMethod:
+        case ECmmRemoveAllReferences:
             {
             // ECapabilityWriteDeviceData is needed for writing
             return ( iCmmElements[1].iPolicy.CheckPolicy( aMessage ) ) ?
                 EPass : EFail;
             }
-        case ECmmCopyConnMethod:
-        case ECmmMoveConnMethod:
-        case ECmmRemoveConnMethod:
-        case ECmmRemoveAllReferences:
-            {
-            // At this phase capability is not checked because of
-            // it's too heavy operation...
-            // At later phase the protection of the target destination
-            // and/or connection method is checked.
-            return EPass;
-            }
-        // ***********  6th range: 113-126 *************
+        // ***********  6th range: 114-128 *************
         case EDestCreateDestinationWithName:
         case EDestCreateDestinationWithNameAndId:
-            {
-            // ECapabilityWriteDeviceData is needed for writing
-            return ( iCmmElements[1].iPolicy.CheckPolicy( aMessage ) ) ?
-                EPass : EFail;
-            }
         case EDestIsConnected:
         case EDestAddConnMethod:
         case EDestAddEmbeddedDestination:
@@ -183,34 +176,32 @@
         case EDestSetHidden:
         case EDestUpdate:
         case EDestDelete:
-            {
-            // At this phase capability is not checked because of
-            // it's too heavy operation...
-            // At Session phase the protection of the destination and/or
-            // connection method is checked. If destination/connection method
-            // is protected ECapabilityNetworkControl is required from a
-            // client.
-            return EPass;
-            }
-        // ***********  9th range: 206-210 *************
-        case ECMCreateConnMethod:
-        case ECMCreateConnMethodWithId:
+        case EDestSetIcon:
             {
             // ECapabilityWriteDeviceData is needed for writing
             return ( iCmmElements[1].iPolicy.CheckPolicy( aMessage ) ) ?
                 EPass : EFail;
             }
+        // ***********  9th range: 206-210 *************
+
+        // ECapabilityWriteDeviceData is needed for writing
+        case ECMCreateConnMethod:
+        case ECMCreateConnMethodWithId:
+        
+        // At this phase all capabilities are not checked because of
+        // it's too heavy operation...
+        // At Session phase the protection of the destination and/or
+        // connection method is checked. If protected, 
+        // ECapabilityNetworkControl is checked.
         case ECMCreateConnMethodToDest:
         case ECMCreateConnMethodToDestWithId:
         case ECMCreateCopyOfExisting:
             {
-            // At this phase capability is not checked because of
-            // it's too heavy operation...
-            // At Session phase the protection of the destination and/or
-            // connection method is checked.
-            return EPass;
+            return ( iCmmElements[1].iPolicy.CheckPolicy( aMessage ) ) ?
+                EPass : EFail;
             }
         // ***********  11th range: 215-220 *************
+        // Protection of the CM is checked later(protected needs ECapabilityNetworkControl)
         case ECMSetIntAttribute:
         case ECMSetBoolAttribute:
         case ECMSetStringAttribute:
@@ -235,7 +226,7 @@
                 case CMManager::EWlanWapiPsk:
                 case CMManager::EWlanWapiPskFormat:
                 // 802.1x:
-                case CMManager::EWlan802_1xAllowUnencrypted: //TODO, should this be here?
+                case CMManager::EWlan802_1xAllowUnencrypted:
                 // Authentication:
                 case CMManager::ECmIFAuthName:
                 case CMManager::EPacketDataIFAuthName:
@@ -257,7 +248,8 @@
         case ECMDelete:
         case ECMUpdate:
             {
-            // ECapabilityWriteDeviceData
+            // ECapabilityWriteDeviceData (if protected, ECapabilityNetworkControl
+            // is checked later).
             return ( iCmmElements[1].iPolicy.CheckPolicy( aMessage ) ) ?
                 EPass : EFail;
             }
@@ -266,6 +258,50 @@
         }
     }
 
+/**
+ * This is for checking client's capabilities at later phase after
+ * protections of destination/connection method have been checked
+ * first.
+ */
+CPolicyServer::TCustomResult CCmmServer::CapabilityCheckWithProtection( 
+        const RMessage2& aMessage )
+    {
+    switch ( aMessage.Function() )
+        {
+        case ECmmCopyConnMethod:
+        case ECmmMoveConnMethod:
+        case ECmmRemoveConnMethod:
+        case ECmmRemoveAllReferences:
+        case EDestAddConnMethod:
+        case EDestDeleteConnMethod:
+        case EDestAddEmbeddedDestination:
+        case EDestRemoveConnMethod:
+        case EDestModifyPriority:
+        case EDestSetName:
+        case EDestSetMetadata:
+        case EDestSetProtection:
+        case EDestSetHidden:
+        case EDestUpdate:
+        case EDestDelete:
+        case EDestSetIcon:
+        case ECMCreateConnMethodToDest:
+        case ECMCreateConnMethodToDestWithId:
+        case ECMUpdate:
+        case ECMDelete:
+        case ECMSetIntAttribute:
+        case ECMSetBoolAttribute:
+        case ECMSetStringAttribute:
+        case ECMSetString8Attribute:
+            {
+            // ECapabilityNetworkControl
+            return ( iCmmElements[3].iPolicy.CheckPolicy( aMessage ) ) ? EPass : EFail;
+            }
+        default:
+            // Execution should never come here.
+            return EFail;
+        }
+    }
+
 CCmmServer::CCmmServer( TInt aPriority ) : CPolicyServer( aPriority, iCmmPolicy )
     {
     OstTraceFunctionEntry0( CCMMSERVER_CCMMSERVER_ENTRY );
@@ -340,7 +376,10 @@
     {
     OstTraceFunctionEntry0( CCMMSERVER_NEWSESSIONL_ENTRY );
 
-    return CCmmSession::NewL( *const_cast<CCmmServer*>( this ), iCmManager->Cache() );
+    CSession2* session = CCmmSession::NewL( *const_cast<CCmmServer*>( this ), iCmManager->Cache() );
+
+    OstTraceFunctionExit0( CCMMSERVER_NEWSESSIONL_EXIT );
+    return session;
     }
 
 // -----------------------------------------------------------------------------
@@ -376,6 +415,7 @@
             iShutdown->Start();
             }
         }
+
     OstTraceFunctionExit0( CCMMSERVER_DECREMENTSESSIONS_EXIT );
     }
 
@@ -387,7 +427,10 @@
     {
     OstTraceFunctionEntry0( CCMMSERVER_NEWCONTAINERL_ENTRY );
 
-    return iContainerIndex->CreateL();
+    CObjectCon* container = iContainerIndex->CreateL();
+
+    OstTraceFunctionExit0( CCMMSERVER_NEWCONTAINERL_EXIT );
+    return container;
     }
 
 // -----------------------------------------------------------------------------
@@ -419,7 +462,6 @@
     ReStart();
 
     OstTraceFunctionExit0( CCMMSERVER_RUNERROR_EXIT );
-
     return KErrNone;
     }
 
--- a/cmmanager/cmmgr/cmmserver/src/cmmsession.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/cmmserver/src/cmmsession.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -207,6 +207,11 @@
             GetSupportedBearersL( aMessage );
             }
             break;
+        case ECmmGetUncategorizedIcon:
+            {
+            GetUncategorizedIconL( aMessage );
+            }
+            break;
         case ECmmReadDefaultConnection:
             {
             ReadDefaultConnectionL( aMessage );
@@ -269,6 +274,7 @@
         case EDestIsConnected:
         case EDestIsHidden:
         case EDestIsEqual:
+        case EDestGetIcon:
         case EDestAddConnMethod:
         case EDestAddEmbeddedDestination:
         case EDestDeleteConnMethod:
@@ -280,6 +286,7 @@
         case EDestSetHidden:
         case EDestUpdate:
         case EDestDelete:
+        case EDestSetIcon:
             {
             ServiceDestinationL( aMessage );
             }
@@ -682,7 +689,7 @@
     CleanupStack::PushL( result );
 
     TInt bufferLen = aMessage.GetDesMaxLength( 2 );
-    if ( result && result->Length() > bufferLen )
+    if ( result->Length() > bufferLen )
         {
         User::Leave( KErrArgument );
         }
@@ -714,7 +721,7 @@
     CleanupStack::PushL( result );
 
     TInt bufferLen = aMessage.GetDesMaxLength( 2 );
-    if ( result && result->Length() > bufferLen )
+    if ( result->Length() > bufferLen )
         {
         User::Leave( KErrArgument );
         }
@@ -782,7 +789,7 @@
     CleanupStack::PushL( result );
 
     TInt bufferLen = aMessage.GetDesMaxLength( 2 );
-    if ( result && result->Length() > bufferLen )
+    if ( result->Length() > bufferLen )
         {
         User::Leave( KErrArgument );
         }
@@ -814,7 +821,7 @@
     CleanupStack::PushL( result );
 
     TInt bufferLen = aMessage.GetDesMaxLength( 2 );
-    if ( result && result->Length() > bufferLen )
+    if ( result->Length() > bufferLen )
         {
         User::Leave( KErrArgument );
         }
@@ -1017,6 +1024,29 @@
     }
 
 // -----------------------------------------------------------------------------
+// CCmmSession::GetUncategorizedIconL
+// -----------------------------------------------------------------------------
+//
+void CCmmSession::GetUncategorizedIconL( const RMessage2& aMessage )
+    {
+    OstTraceFunctionEntry0( CCMMSESSION_GETUNCATEGORIZEDICONL_ENTRY );
+
+    HBufC* result = KNullDesC().AllocLC(); //TODO, Is there an uncategorized icon?
+
+    TInt bufferLen = aMessage.GetDesMaxLength( 0 );
+    if ( result->Length() > bufferLen )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    TPtrC resultPtr = result->Des();
+    aMessage.WriteL( 0, resultPtr );
+    CleanupStack::PopAndDestroy( result );
+
+    OstTraceFunctionExit0( CCMMSESSION_GETUNCATEGORIZEDICONL_EXIT );
+    }
+
+// -----------------------------------------------------------------------------
 // CCmmSession::ReadDefaultConnectionL
 // -----------------------------------------------------------------------------
 //
@@ -1249,7 +1279,20 @@
         User::Leave( KErrArgument );
         }
 
-    //TODO, capability check, what to do if anything is protected.
+    // Check the protection level of the destination.
+    // And based on that check the needed capabilities from the client.
+    CMManager::TProtectionLevel protLevel( CMManager::EProtLevel0 );
+    destination->GetProtectionL( protLevel );
+    CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass );
+    if ( protLevel == CMManager::EProtLevel1 )
+        {
+        capabilities = iServer.CapabilityCheckWithProtection( aMessage );
+        }
+
+    if ( capabilities == CPolicyServer::EFail )
+        {
+        User::Leave( KErrPermissionDenied );
+        }
 
     // Add connection method into destination.
     TInt index = destination->AddConnMethodL( *connMethod );
@@ -1313,7 +1356,38 @@
         User::Leave( KErrInUse );
         }
 
-    //TODO, capability checks, what to do if anything is protected.
+    // Check the protection level of the source and target destination.
+    // And based on those check the needed capabilities from the client.
+    TBool protectionExists( EFalse );
+    CMManager::TProtectionLevel protLevelSource( CMManager::EProtLevel0 );
+    sourceDestination->GetProtectionL( protLevelSource );
+    if ( protLevelSource == CMManager::EProtLevel1 
+            || protLevelSource == CMManager::EProtLevel3 )
+        {
+        protectionExists = ETrue;
+        }
+
+    // If source destination is not protected check the target destination.
+    if ( !protectionExists )
+        {
+        CMManager::TProtectionLevel protLevelTarget( CMManager::EProtLevel0 );
+        targetDestination->GetProtectionL( protLevelTarget );
+        if ( protLevelTarget == CMManager::EProtLevel1 )
+            {
+            protectionExists = ETrue;
+            }
+        }
+
+    CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass );
+    if ( protectionExists )
+        {
+        capabilities = iServer.CapabilityCheckWithProtection( aMessage );
+        }
+
+    if ( capabilities == CPolicyServer::EFail )
+        {
+        User::Leave( KErrPermissionDenied );
+        }
 
     // Add connection method into target destination and update it.
     attributesPckg().iIndex = targetDestination->AddConnMethodL( *connMethod );
@@ -1343,7 +1417,20 @@
     CCmmConnMethodInstance* connMethodInstance =
             ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int1() );
 
-    //TODO, capability checks
+    // Check the protection level of the destination.
+    // And based on that check the needed capabilities from the client.
+    CMManager::TProtectionLevel protLevel( CMManager::EProtLevel0 );
+    destinationInstance->GetProtectionL( protLevel );
+    CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass );
+    if ( protLevel == CMManager::EProtLevel1 || protLevel == CMManager::EProtLevel3 )
+        {
+        capabilities = iServer.CapabilityCheckWithProtection( aMessage );
+        }
+
+    if ( capabilities == CPolicyServer::EFail )
+        {
+        User::Leave( KErrPermissionDenied );
+        }
 
     destinationInstance->RemoveConnMethodFromDestinationL( *connMethodInstance );
     destinationInstance->UpdateL();
@@ -1363,6 +1450,20 @@
     CCmmConnMethodInstance* connMethodInstance =
             ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int0() );
 
+    TBool capabilityCheckNeeded( EFalse );
+    iCache.CheckIfConnMethodBelongsToProtectedDestinationL(
+            *connMethodInstance,
+            capabilityCheckNeeded );
+    if ( capabilityCheckNeeded )
+        {
+        CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass );
+        capabilities = iServer.CapabilityCheckWithProtection( aMessage );
+        if ( capabilities == CPolicyServer::EFail )
+            {
+            User::Leave( KErrPermissionDenied );
+            }
+        }
+
     iCache.CheckIfConnMethodReferencesCanBeRemovedL( *connMethodInstance );
     iCache.RemoveAllReferencesToConnMethodL( *connMethodInstance );
 
@@ -1454,6 +1555,11 @@
             DestinationIsEqualL( aMessage );
             }
             break;
+        case EDestGetIcon:
+            {
+            GetDestinationIconL( aMessage );
+            }
+            break;
         case EDestAddConnMethod:
             {
             DestAddConnMethodL( aMessage );
@@ -1509,6 +1615,11 @@
             DeleteDestinationL( aMessage );
             }
             break;
+        case EDestSetIcon:
+            {
+            SetDestinationIconL( aMessage );
+            }
+            break;
         default:
             {
             User::Leave( KErrNotSupported );
@@ -1847,6 +1958,33 @@
     }
 
 // -----------------------------------------------------------------------------
+// CCmmSession::GetDestinationIconL
+// -----------------------------------------------------------------------------
+//
+void CCmmSession::GetDestinationIconL( const RMessage2& aMessage )
+    {
+    OstTraceFunctionEntry0( CCMMSESSION_GETDESTINATIONICONL_ENTRY );
+
+    CCmmDestinationInstance* destinationInstance =
+            ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() );
+
+    HBufC* icon = destinationInstance->GetDestinationIconL();
+    CleanupStack::PushL( icon );
+    TPtrC iconPtr( icon->Des() );
+
+    TInt bufferLen = aMessage.GetDesMaxLength( 0 );
+    if ( iconPtr.Length() > bufferLen )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    aMessage.WriteL( 0, iconPtr );
+    CleanupStack::PopAndDestroy( icon );
+
+    OstTraceFunctionExit0( CCMMSESSION_GETDESTINATIONICONL_EXIT );
+    }
+
+// -----------------------------------------------------------------------------
 // CCmmSession::GetDestinationIdL
 // -----------------------------------------------------------------------------
 //
@@ -2012,6 +2150,20 @@
 
     CCmmDestinationInstance* destination =
             ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() );
+
+    // Check the protection and if protected check the needed capabilities.
+    CMManager::TProtectionLevel protLevel =
+            destination->CurrentProtectionLevel();
+    if ( protLevel == CMManager::EProtLevel1 )
+        {
+        CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass );
+        capabilities = iServer.CapabilityCheckWithProtection( aMessage );
+        if ( capabilities == CPolicyServer::EFail )
+            {
+            User::Leave( KErrPermissionDenied );
+            }
+        }
+
     CCmmConnMethodInstance* connMethod =
             ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int0() );
 
@@ -2035,12 +2187,26 @@
     {
     OstTraceFunctionEntry0( CCMMSESSION_DESTADDEMBEDDEDDESTINATIONL_ENTRY );
 
-    CCmmDestinationInstance* destination =
+    CCmmDestinationInstance* destinationInstance =
             ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() );
+
+    // Check the protection and if protected check the needed capabilities.
+    CMManager::TProtectionLevel protLevel = 
+            destinationInstance->CurrentProtectionLevel();
+    if ( protLevel == CMManager::EProtLevel1 )
+        {
+        CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass );
+        capabilities = iServer.CapabilityCheckWithProtection( aMessage );
+        if ( capabilities == CPolicyServer::EFail )
+            {
+            User::Leave( KErrPermissionDenied );
+            }
+        }
+
     CCmmDestinationInstance* embeddedDestination =
             ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int0() );
 
-    TInt index = destination->AddEmbeddedDestinationL( *embeddedDestination );
+    TInt index = destinationInstance->AddEmbeddedDestinationL( *embeddedDestination );
     TPckg<TInt> indexPckg( index );
     aMessage.WriteL( 1, indexPckg );
 
@@ -2059,8 +2225,25 @@
             ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() );
     CCmmConnMethodInstance* connMethodInstance =
             ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int0() );
-
-    //TODO, capability checks
+    
+    // Check the protection of destination and if protected check the needed
+    // capabilities.
+    CMManager::TProtectionLevel protLevel = 
+            destinationInstance->CurrentProtectionLevel();
+    if ( protLevel == CMManager::EProtLevel1 ||
+            protLevel == CMManager::EProtLevel3 )
+        {
+        CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass );
+        capabilities = iServer.CapabilityCheckWithProtection( aMessage );
+        if ( capabilities == CPolicyServer::EFail )
+            {
+            User::Leave( KErrPermissionDenied );
+            }
+        }
+
+    // Check the protection of CM and if protected check the needed
+    // capabilities.
+    CheckCapabilitiesForProtectedCML( aMessage, connMethodInstance );
 
     destinationInstance->DeleteConnMethodFromDestinationL( *connMethodInstance );
 
@@ -2080,7 +2263,20 @@
     CCmmConnMethodInstance* connMethodInstance =
             ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int0() );
 
-    //TODO, capability checks
+    // Check the protection of destination and if protected check the needed
+    // capabilities.
+    CMManager::TProtectionLevel protLevel = 
+            destinationInstance->CurrentProtectionLevel();
+    if ( protLevel == CMManager::EProtLevel1 ||
+            protLevel == CMManager::EProtLevel3 )
+        {
+        CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass );
+        capabilities = iServer.CapabilityCheckWithProtection( aMessage );
+        if ( capabilities == CPolicyServer::EFail )
+            {
+            User::Leave( KErrPermissionDenied );
+            }
+        }
 
     destinationInstance->RemoveConnMethodFromDestinationL( *connMethodInstance );
 
@@ -2097,11 +2293,25 @@
 
     CCmmDestinationInstance* destinationInstance =
             ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() );
+
+    // Check the protection of destination and if protected check the needed
+    // capabilities.
+    CMManager::TProtectionLevel protLevel = 
+            destinationInstance->CurrentProtectionLevel();
+    if ( protLevel == CMManager::EProtLevel1 ||
+            protLevel == CMManager::EProtLevel3 )
+        {
+        CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass );
+        capabilities = iServer.CapabilityCheckWithProtection( aMessage );
+        if ( capabilities == CPolicyServer::EFail )
+            {
+            User::Leave( KErrPermissionDenied );
+            }
+        }
+
     CCmmConnMethodInstance* connMethodInstance =
             ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int0() );
 
-    //TODO, capability checks
-
     // Index values start from 0 (0 meaning highest priority).
     TUint index( ( TUint )aMessage.Int1() );
 
@@ -2121,6 +2331,28 @@
     CCmmDestinationInstance* destinationInstance =
             ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() );
 
+    // Check that client does not try to change the name of the Internet Destination.
+    TUint32 metadata( 0 );
+    destinationInstance->GetMetadataL( CMManager::ESnapMetadataPurpose, metadata );
+    if ( metadata == CMManager::ESnapPurposeInternet )
+        {
+        User::Leave( KErrPermissionDenied );
+        }
+
+    // Check the protection and if protected check the needed capabilities.
+    CMManager::TProtectionLevel protLevel =
+            destinationInstance->CurrentProtectionLevel();
+    if ( protLevel == CMManager::EProtLevel1 ||
+            protLevel == CMManager::EProtLevel2 )
+        {
+        CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass );
+        capabilities = iServer.CapabilityCheckWithProtection( aMessage );
+        if ( capabilities == CPolicyServer::EFail )
+            {
+            User::Leave( KErrPermissionDenied );
+            }
+        }
+
     // Load and check name.
     TInt destNameLength = aMessage.GetDesLength( 0 );
     if ( destNameLength <= 0 )
@@ -2147,6 +2379,48 @@
     }
 
 // -----------------------------------------------------------------------------
+// CCmmSession::SetDestinationIconL
+// -----------------------------------------------------------------------------
+//
+void CCmmSession::SetDestinationIconL( const RMessage2& aMessage )
+    {
+    OstTraceFunctionEntry0( CCMMSESSION_SETDESTINATIONICONL_ENTRY );
+
+    CCmmDestinationInstance* destinationInstance =
+            ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() );
+
+    // Check the protection and if protected check the needed capabilities.
+    CMManager::TProtectionLevel protLevel =
+            destinationInstance->CurrentProtectionLevel(); //TODO, check the current level can't be altered without proper capas.
+    if ( protLevel == CMManager::EProtLevel1 ||
+            protLevel == CMManager::EProtLevel2 )
+        {
+        CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass );
+        capabilities = iServer.CapabilityCheckWithProtection( aMessage );
+        if ( capabilities == CPolicyServer::EFail )
+            {
+            User::Leave( KErrPermissionDenied );
+            }
+        }
+
+    // Load and check name.
+    TInt destIconNameLength = aMessage.GetDesLength( 0 );
+    if ( destIconNameLength < 0 || destIconNameLength > KCmmStringLengthMax )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    HBufC* newIconName = HBufC::NewLC( destIconNameLength );
+    TPtr ptrNewIconName = newIconName->Des();
+    aMessage.ReadL( 0, ptrNewIconName );
+
+    destinationInstance->SetDestinationIconL( *newIconName );
+    CleanupStack::PopAndDestroy( newIconName );
+
+    OstTraceFunctionExit0( CCMMSESSION_SETDESTINATIONICONL_EXIT );
+    }
+
+// -----------------------------------------------------------------------------
 // CCmmSession::SetDestinationMetadataL
 // -----------------------------------------------------------------------------
 //
@@ -2154,11 +2428,23 @@
     {
     OstTraceFunctionEntry0( CCMMSESSION_SETDESTINATIONMETADATAL_ENTRY );
 
-    //TODO, Capability check. Protection level or Internet destination.
-
     CCmmDestinationInstance* destinationInstance =
             ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() );
 
+    // Check the protection and if protected check the needed capabilities.
+    CMManager::TProtectionLevel protLevel =
+            destinationInstance->CurrentProtectionLevel();
+    if ( protLevel == CMManager::EProtLevel1 ||
+            protLevel == CMManager::EProtLevel2 )
+        {
+        CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass );
+        capabilities = iServer.CapabilityCheckWithProtection( aMessage );
+        if ( capabilities == CPolicyServer::EFail )
+            {
+            User::Leave( KErrPermissionDenied );
+            }
+        }
+
     CMManager::TSnapMetadataField metadataField =
             ( CMManager::TSnapMetadataField )aMessage.Int0();
     TUint32 metadata = aMessage.Int1();
@@ -2176,7 +2462,13 @@
     {
     OstTraceFunctionEntry0( CCMMSESSION_SETDESTINATIONPROTECTIONL_ENTRY );
 
-    //TODO, Capability check: ECapabilityNetworkControl
+    // Check the needed capabilities.
+    CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass );
+    capabilities = iServer.CapabilityCheckWithProtection( aMessage );
+    if ( capabilities == CPolicyServer::EFail )
+        {
+        User::Leave( KErrPermissionDenied );
+        }
 
     CCmmDestinationInstance* destinationInstance =
             ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() );
@@ -2198,6 +2490,20 @@
     CCmmDestinationInstance* destinationInstance =
             ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() );
 
+    // Check the protection and if protected check the needed capabilities.
+    CMManager::TProtectionLevel protLevel =
+            destinationInstance->CurrentProtectionLevel();
+    if ( protLevel == CMManager::EProtLevel1 ||
+            protLevel == CMManager::EProtLevel2 )
+        {
+        CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass );
+        capabilities = iServer.CapabilityCheckWithProtection( aMessage );
+        if ( capabilities == CPolicyServer::EFail )
+            {
+            User::Leave( KErrPermissionDenied );
+            }
+        }
+
     TBool hidden = aMessage.Int0();
     destinationInstance->SetMetadataL( CMManager::ESnapMetadataHiddenAgent, hidden );
 
@@ -2214,6 +2520,22 @@
 
     CCmmDestinationInstance* destinationInstance =
             ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() );
+
+    // Check the protection and if protected check the needed capabilities
+    CMManager::TProtectionLevel protLevel =
+            destinationInstance->CurrentProtectionLevel();
+    if ( protLevel == CMManager::EProtLevel1 ||
+         protLevel == CMManager::EProtLevel2 ||
+         protLevel == CMManager::EProtLevel3 )
+        {
+        CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass );
+        capabilities = iServer.CapabilityCheckWithProtection( aMessage );
+        if ( capabilities == CPolicyServer::EFail )
+            {
+            User::Leave( KErrPermissionDenied );
+            }
+        }
+
     destinationInstance->UpdateL();
 
     OstTraceFunctionExit0( CCMMSESSION_UPDATEDESTINATIONL_EXIT );
@@ -2230,6 +2552,22 @@
     CCmmDestinationInstance* destinationInstance =
             ( CCmmDestinationInstance* )iDestinationObjects->AtL( aMessage.Int3() );
 
+    // Check the protection of destination and if protected check the needed
+    // capabilities.
+    CMManager::TProtectionLevel protLevel =
+            destinationInstance->CurrentProtectionLevel();
+    if ( protLevel == CMManager::EProtLevel1 ||
+         protLevel == CMManager::EProtLevel2 ||
+         protLevel == CMManager::EProtLevel3 )
+        {
+        CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass );
+        capabilities = iServer.CapabilityCheckWithProtection( aMessage );
+        if ( capabilities == CPolicyServer::EFail )
+            {
+            User::Leave( KErrPermissionDenied );
+            }
+        }
+
     iCache.CheckIfDestinationCanBeDeletedL( *destinationInstance );
     iCache.DeleteDestinationL( *destinationInstance );
 
@@ -2380,13 +2718,14 @@
 
     TUint32 bearerType( aMessage.Int0() );
 
-    CCmmConnMethodInstance* connMethod = CCmmConnMethodInstance::NewLC( this, &iCache );
-    iCache.CreateConnMethodL( *connMethod, NULL, bearerType, 0 );
-
-    iConnMethodContainer->AddL( ( CObject* ) connMethod );
-    TInt handle = iConnMethodObjects->AddL( ( CObject* ) connMethod );
-    connMethod->SetHandle( handle );
-    CleanupStack::Pop( connMethod );
+    CCmmConnMethodInstance* connMethodInstance =
+            CCmmConnMethodInstance::NewLC( this, &iCache );
+    iCache.CreateConnMethodL( *connMethodInstance, NULL, bearerType, 0 );
+
+    iConnMethodContainer->AddL( ( CObject* ) connMethodInstance );
+    TInt handle = iConnMethodObjects->AddL( ( CObject* ) connMethodInstance );
+    connMethodInstance->SetHandle( handle );
+    CleanupStack::Pop( connMethodInstance );
 
     TPckg<TInt> handlePckg( handle );
     TInt error = aMessage.Write( 3, handlePckg );
@@ -2408,9 +2747,13 @@
     {
     OstTraceFunctionEntry0( CCMMSESSION_UPDATECONNMETHODL_ENTRY );
 
-    CCmmConnMethodInstance* connMethod =
+    CCmmConnMethodInstance* connMethodInstance =
             ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int3() );
-    connMethod->UpdateL();
+
+    // Check if the Client has capabilities to delete this CM.
+    CheckCapabilitiesForProtectedCML( aMessage, connMethodInstance );
+
+    connMethodInstance->UpdateL();
 
     OstTraceFunctionExit0( CCMMSESSION_UPDATECONNMETHODL_EXIT );
     }
@@ -2435,7 +2778,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// CCmmSession::ConnMethodUpdateL
+// CCmmSession::DeleteConnMethodL
 // -----------------------------------------------------------------------------
 //
 void CCmmSession::DeleteConnMethodL( const RMessage2& aMessage )
@@ -2445,6 +2788,9 @@
     CCmmConnMethodInstance* connMethodInstance =
             ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int3() );
 
+    // Check if the Client has capabilities to delete this CM.
+    CheckCapabilitiesForProtectedCML( aMessage, connMethodInstance );
+
     iCache.CheckIfConnMethodCanBeDeletedL( *connMethodInstance );
     iCache.DeleteConnMethodL( *connMethodInstance );
     // Ignore the boolean return value. It is always true, or the
@@ -2583,7 +2929,7 @@
     CleanupStack::PushL( value );
     TPtrC valuePtr = value->Des();
 
-    // check the buffer length of the given buffer
+    // Check the buffer length of the given buffer.
     TInt bufferLen = aMessage.GetDesMaxLength( 1 );
     if ( valuePtr.Length() > bufferLen )
         {
@@ -2617,7 +2963,7 @@
     CleanupStack::PushL( value );
     TPtrC8 valuePtr = value->Des();
 
-    // check the buffer length of the given buffer
+    // Check the buffer length of the given buffer.
     TInt bufferLen = aMessage.GetDesMaxLength( 1 );
     if ( valuePtr.Length() > bufferLen )
         {
@@ -2641,6 +2987,10 @@
     CCmmConnMethodInstance* cm =
             ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int3() );
 
+    // Check the capability needed if protected CM
+    // ECapabilityWriteDeviceData is checked earlier already.
+    CheckCapabilitiesForProtectedCML( aMessage, cm );
+
     TUint32 attribute( aMessage.Int0() );
     TUint32 value( aMessage.Int1() );
 
@@ -2660,6 +3010,10 @@
     CCmmConnMethodInstance* cm =
             ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int3() );
 
+    // Check the capability needed if protected CM
+    // ECapabilityWriteDeviceData is checked earlier already.
+    CheckCapabilitiesForProtectedCML( aMessage, cm );
+
     TUint32 attribute( aMessage.Int0() );
     TBool value( aMessage.Int1() );
 
@@ -2679,6 +3033,10 @@
     CCmmConnMethodInstance* cm =
             ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int3() );
 
+    // Check the capability needed if protected CM
+    // ECapabilityWriteDeviceData is checked earlier already.
+    CheckCapabilitiesForProtectedCML( aMessage, cm );
+
     TUint32 attribute( aMessage.Int0() );
 
     HBufC* value = HBufC::NewLC( aMessage.GetDesLengthL( 1 ) );
@@ -2703,6 +3061,10 @@
     CCmmConnMethodInstance* cm =
             ( CCmmConnMethodInstance* )iConnMethodObjects->AtL( aMessage.Int3() );
 
+    // Check the capability needed if protected CM
+    // ECapabilityWriteDeviceData is checked earlier already.
+    CheckCapabilitiesForProtectedCML( aMessage, cm );
+
     TUint32 attribute( aMessage.Int0() );
 
     HBufC8* value = HBufC8::NewLC( aMessage.GetDesLengthL( 1 ) );
@@ -2881,6 +3243,19 @@
     CCmmDestinationInstance* destination =
             ( CCmmDestinationInstance* )iDestinationObjects->AtL( destinationHandle );
 
+    // Check the protection and if protected check the needed capabilities.
+    CMManager::TProtectionLevel protLevel =
+            destination->CurrentProtectionLevel();
+    if ( protLevel == CMManager::EProtLevel1 )
+        {
+        CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass );
+        capabilities = iServer.CapabilityCheckWithProtection( aMessage );
+        if ( capabilities == CPolicyServer::EFail )
+            {
+            User::Leave( KErrPermissionDenied );
+            }
+        }
+
     CCmmConnMethodInstance* connMethod = CCmmConnMethodInstance::NewLC( this, &iCache );
     iCache.CreateConnMethodL( *connMethod, destination, bearerType, 0 );
 
@@ -2917,6 +3292,19 @@
     CCmmDestinationInstance* destination =
             ( CCmmDestinationInstance* )iDestinationObjects->AtL( destinationHandle );
 
+    // Check the protection and if protected check the needed capabilities.
+    CMManager::TProtectionLevel protLevel =
+            destination->CurrentProtectionLevel();
+    if ( protLevel == CMManager::EProtLevel1 )
+        {
+        CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass );
+        capabilities = iServer.CapabilityCheckWithProtection( aMessage );
+        if ( capabilities == CPolicyServer::EFail )
+            {
+            User::Leave( KErrPermissionDenied );
+            }
+        }
+
     CCmmConnMethodInstance* connMethod =
             CCmmConnMethodInstance::NewLC( this, &iCache );
     // Will check if ID is available.
@@ -3061,4 +3449,28 @@
     OstTraceFunctionExit0( CCMMSESSION_GETEMBEDDEDDESTINATIONL_EXIT );
     }
 
+// -----------------------------------------------------------------------------
+// Check if CM is protected and if so then check the needed capabilities.
+// -----------------------------------------------------------------------------
+//
+void CCmmSession::CheckCapabilitiesForProtectedCML(
+        const RMessage2& aMessage,
+        CCmmConnMethodInstance* aConnectionMethodInstance )
+    {
+    OstTraceFunctionEntry0( CCMMSESSION_CHECKCAPABILITIESFORPROTECTEDCML_ENTRY );
+
+    TBool prot = aConnectionMethodInstance->GetBoolAttributeL( CMManager::ECmProtected );
+    if ( prot )
+        {
+        CPolicyServer::TCustomResult capabilities( CPolicyServer::EPass );
+        capabilities = iServer.CapabilityCheckWithProtection( aMessage );
+        if ( capabilities == CPolicyServer::EFail )
+            {
+            User::Leave( KErrPermissionDenied );
+            }
+        }
+
+    OstTraceFunctionExit0( CCMMSESSION_CHECKCAPABILITIESFORPROTECTEDCML_EXIT );
+    }
+
 // End of file
--- a/cmmanager/cmmgr/database/group/cmmanagerdatabase.mmp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cmmgr/database/group/cmmanagerdatabase.mmp	Wed Jun 23 17:49:20 2010 +0100
@@ -17,7 +17,6 @@
 *
 */
 
-#include <data_caging_paths.hrh>
 #include <platform_paths.hrh>
 
 TARGET        	cmmanagerdatabase.dll
@@ -42,9 +41,7 @@
 MW_LAYER_SYSTEMINCLUDE
 
 LIBRARY       	euser.lib
-//LIBRARY         ECom.lib
 LIBRARY         COMMSDAT.lib
-//LIBRARY         flogger.lib
 
 
 #if defined(ARMCC)
--- a/cmmanager/cpdestinationplugin/cpdestinationplugin.pro	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cpdestinationplugin/cpdestinationplugin.pro	Wed Jun 23 17:49:20 2010 +0100
@@ -10,14 +10,13 @@
 # Contributors:
 #
 # Description:
-#
+# Control Panel Destinations & Access points plugin project file
 
 TEMPLATE = lib
 TARGET = cpdestinationplugin
 DEPENDPATH += .
 INCLUDEPATH += . 
 CONFIG += hb plugin
-CONFIG += debug
 MOC_DIR = moc
 OBJECTS_DIR = obj
 RCC_DIR = rcc
--- a/cmmanager/cpdestinationplugin/src/cpadddestinationentryitemdata.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cpdestinationplugin/src/cpadddestinationentryitemdata.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -175,6 +175,7 @@
             CmDestinationShim *destination = cmm->destination(destinationList[i]);
             if (0 == dest.compare(destination->name())) {
                 retVal = false;
+                delete destination;
                 break;
             }
             delete destination;
--- a/cmmanager/cpdestinationplugin/src/cpdestinationentryitem.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cpdestinationplugin/src/cpdestinationentryitem.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -571,6 +571,7 @@
             if (0 == destination.compare(dest->name())) {
                 destination = hbTrId("txt_occ_info_name_already_in_use");
                 retVal = false;
+                delete dest;
                 break;
             }
             delete dest;
@@ -692,7 +693,6 @@
     try {
         cmm = new CmManagerShim();
         if (isDestinationNameValid(destinationName, cmm)) {
-            cmm = new CmManagerShim();
             destination = cmm->destination(mDestinationId);
             destination->setName(destinationName);
             destination->update();
--- a/cmmanager/cpdestinationplugin/src/cpiapitem.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cpdestinationplugin/src/cpiapitem.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -223,6 +223,7 @@
             CmConnectionMethodShim *cm = destination->connectionMethodByID(mIapId);
             destination->deleteConnectionMethod(cm);
             destination->update();
+            delete cm;
             delete destination;
         } else {
             CmConnectionMethodShim *cm = mCmm->connectionMethod(mIapId);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cpdestinationplugin/tsrc/ut/hbautotest.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -0,0 +1,831 @@
+/*
+* 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:
+*
+*/
+
+#include "hbautotest.h"
+#include <hbmainwindow.h>
+#include <hbwidget.h>
+
+
+const qreal STEP = 4; //How many pixels to drag before sending an event
+
+//Init static members
+bool HbAutoTest::pointerPressed = false;
+QPointF HbAutoTest::pressPoint = QPointF();
+
+void HbAutoTest::mouseMove (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos, int delay)
+{
+    if (delay!=-1) {
+        QTest::qWait(delay);
+    }
+    QPointF targetPoint=QPointF();
+    if (pos==QPointF()) {
+        targetPoint = middlePointOfWidget(widget);
+    } else {
+        targetPoint = widget->mapToScene(pos);
+    }
+    if (pointerPressed) {
+        //Now we should drag an item
+        drag(window, targetPoint);
+            HbAutoTestMouseEvent me (
+            QEvent::MouseMove, 
+            targetPoint.toPoint(), 
+            window->viewport()->mapToGlobal(targetPoint.toPoint()), 
+            Qt::NoButton, 
+            Qt::NoButton, 
+            Qt::NoModifier);
+            QSpontaneKeyEvent::setSpontaneous(&me);
+            qApp->notify((window->viewport()), &me);
+            QCoreApplication::sendPostedEvents();
+            QTest::qWait(1);
+    } else {
+            HbAutoTestMouseEvent me (
+            QEvent::MouseMove, 
+            targetPoint.toPoint(), 
+            window->viewport()->mapToGlobal(targetPoint.toPoint()), 
+            Qt::NoButton, 
+            Qt::NoButton, 
+            Qt::NoModifier);
+            QSpontaneKeyEvent::setSpontaneous(&me);
+            qApp->notify((window->viewport()), &me);
+            QCoreApplication::sendPostedEvents();
+            QTest::qWait(1);
+
+    }
+    QTest::qWait(1);
+    QTest::qWait(1);
+}
+ 
+void HbAutoTest::mousePress (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos, int delay)
+{
+    if (delay!=-1) {
+        QTest::qWait(delay);
+    }
+    pointerPressed=true;
+    QPointF targetPoint=QPointF();
+    if (pos==QPointF()) {
+        targetPoint = middlePointOfWidget(widget);
+    } else {
+        targetPoint = widget->mapToScene(pos);
+    }
+    QCursor::setPos(window->mapToGlobal(targetPoint.toPoint()));
+
+    pressPoint=targetPoint;
+    
+    HbAutoTestMouseEvent me (
+    QEvent::MouseButtonPress, 
+    targetPoint.toPoint(), 
+    window->viewport()->mapToGlobal(targetPoint.toPoint()), 
+    Qt::LeftButton, 
+    Qt::LeftButton, 
+    Qt::NoModifier);
+
+    QSpontaneKeyEvent::setSpontaneous(&me);
+    qApp->notify((window->viewport()), &me);
+    QCoreApplication::sendPostedEvents();
+    QCoreApplication::sendPostedEvents();
+    QTest::qWait(1);
+}
+
+void HbAutoTest::mouseRelease (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos, int delay)
+{
+    if (delay!=-1) {
+        QTest::qWait(delay);
+    }
+    pointerPressed=false;
+    QPointF targetPoint=QPointF();
+    if (pos==QPointF()) {
+        targetPoint = middlePointOfWidget(widget);
+    } else {
+        targetPoint = widget->mapToScene(pos);
+    }
+    QCursor::setPos(window->mapToGlobal(targetPoint.toPoint()));
+    pressPoint=QPointF();
+    HbAutoTestMouseEvent me (
+    QEvent::MouseButtonRelease, 
+    targetPoint.toPoint(), 
+    window->viewport()->mapToGlobal(targetPoint.toPoint()), 
+    Qt::LeftButton, 
+    Qt::NoButton, 
+    Qt::NoModifier);
+
+    QSpontaneKeyEvent::setSpontaneous(&me);
+    qApp->notify((window->viewport()), &me);
+    QCoreApplication::sendPostedEvents();
+
+    QTest::qWait(1);
+    QTest::qWait(1);
+}
+
+void HbAutoTest::mouseClick (HbAutoTestMainWindow *window, const HbWidget *widget, QPointF pos, int delay)
+{
+    if (delay!=-1) {
+        QTest::qWait(delay);
+    }
+    QPointF targetPoint=QPointF();
+    if (pos==QPointF()) {
+        targetPoint = middlePointOfWidget(widget);
+    } else {
+        targetPoint = widget->mapToScene(pos);
+    }
+    
+    QCursor::setPos(window->mapToGlobal(targetPoint.toPoint()));
+    
+    HbAutoTestMouseEvent me (
+    QEvent::MouseButtonPress, 
+    targetPoint.toPoint(), 
+    window->viewport()->mapToGlobal(targetPoint.toPoint()), 
+    Qt::LeftButton, 
+    Qt::LeftButton, 
+    Qt::NoModifier);
+    QSpontaneKeyEvent::setSpontaneous(&me);
+    qApp->notify((window->viewport()), &me);
+    QCoreApplication::sendPostedEvents();
+    QTest::qWait(1);
+
+    if (delay!=-1) {
+        QTest::qWait(delay);
+    }
+    HbAutoTestMouseEvent me2 (
+    QEvent::MouseButtonRelease, 
+    targetPoint.toPoint(), 
+    window->viewport()->mapToGlobal(targetPoint.toPoint()), 
+    Qt::LeftButton, 
+    Qt::NoButton,
+    Qt::NoModifier);
+
+    QSpontaneKeyEvent::setSpontaneous(&me2);
+    qApp->notify((window->viewport()), &me2);
+    QCoreApplication::sendPostedEvents();
+
+    QTest::qWait(1);
+    QTest::qWait(1);
+}   
+
+QPointF HbAutoTest::middlePointOfWidget( const HbWidget* widget)
+{
+    QRectF widgetRect = widget->rect();
+    QRectF widgetSceneRect = widget->mapRectToScene(widgetRect);
+    qreal middleX = ((widgetSceneRect.right() - widgetSceneRect.left())/2)+widgetSceneRect.left();
+    qreal middleY = ((widgetSceneRect.bottom() - widgetSceneRect.top())/2)+widgetSceneRect.top();  
+    return QPointF(middleX,middleY);
+}
+
+
+
+void HbAutoTest::drag(HbAutoTestMainWindow *window, QPointF targetPoint)
+{
+    qreal tempX = targetPoint.x() - pressPoint.x();
+    qreal tempY = targetPoint.y() - pressPoint.y();
+    qreal totalTrip = sqrt ((tempX * tempX) + (tempY * tempY));
+    
+    int numberOfSteps = qRound(totalTrip / STEP);
+    HbAutoTestMouseEvent me (
+        QEvent::MouseMove, 
+        targetPoint.toPoint(), 
+        window->viewport()->mapToGlobal(targetPoint.toPoint()), 
+        Qt::NoButton , 
+        Qt::LeftButton, 
+        Qt::NoModifier);
+
+    QPointF nextPanPoint=pressPoint;
+    for (int i=1; i<numberOfSteps; i++) { //On purpose not =<
+        
+        nextPanPoint.setY (pressPoint.y()+((i / (qreal)numberOfSteps) * tempY));
+        nextPanPoint.setX (pressPoint.x()+((i / (qreal)numberOfSteps) * tempX));
+        
+        QCursor::setPos(window->mapToGlobal(nextPanPoint.toPoint()));
+
+        me =  HbAutoTestMouseEvent (QEvent::MouseMove,
+                            nextPanPoint.toPoint(), 
+                            window->viewport()->mapToGlobal(nextPanPoint.toPoint()), 
+                            Qt::NoButton, 
+                            Qt::LeftButton, 
+                            Qt::NoModifier);   
+
+        QSpontaneKeyEvent::setSpontaneous(&me);
+        qApp->notify((window->viewport()), &me);
+        QCoreApplication::sendPostedEvents();
+    }
+
+    QCursor::setPos(window->mapToGlobal(targetPoint.toPoint()));
+
+    //One more (or the only one) step to the target
+    me =  HbAutoTestMouseEvent (QEvent::MouseMove,
+                            targetPoint.toPoint(), 
+                            window->viewport()->mapToGlobal(targetPoint.toPoint()), 
+                            Qt::NoButton, 
+                            Qt::LeftButton, 
+                            Qt::NoModifier);   
+    QSpontaneKeyEvent::setSpontaneous(&me);
+    qApp->notify((window->viewport()), &me);
+    QCoreApplication::sendPostedEvents();
+}
+
+
+void HbAutoTest::simulateEvent(QWidget *widget, bool press, int code,
+                              Qt::KeyboardModifiers modifier, QString text, bool repeat, int delay)
+    {
+        //Q_ASSERT_X(dynamic_cast<HbAutoTestMainWindow *>(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow");
+        /*extern int Q_TESTLIB_EXPORT defaultKeyDelay();
+
+        if (delay == -1 || delay < defaultKeyDelay())
+            delay = defaultKeyDelay();
+        if(delay > 0)
+            QTest::qWait(delay);*/
+        Q_UNUSED(delay);
+        QTest::qWait(10); //TODO: Remove this and reveal above out-commented code
+
+        HbAutoTestKeyEvent a(press ? QEvent::KeyPress : QEvent::KeyRelease, code, modifier, text, repeat);
+        QSpontaneKeyEvent::setSpontaneous(&a);
+        if (!qApp->notify(widget, &a))
+            QTest::qWarn("Keyboard event not accepted by receiving widget");
+    }
+
+void HbAutoTest::sendKeyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key code,
+                             QString text, Qt::KeyboardModifiers modifier, int delay)
+    {
+        QTEST_ASSERT(qApp);
+
+        if (!widget)
+            widget = QWidget::keyboardGrabber();
+        if (!widget) {
+            if (QWidget *apw = QApplication::activePopupWidget())
+                widget = apw->focusWidget() ? apw->focusWidget() : apw;
+            else
+                widget = QApplication::focusWidget();
+        }
+        if (!widget)
+            widget = QApplication::activeWindow();
+
+        QTEST_ASSERT(widget);
+
+        if (action == QTest::Click) {
+            QPointer<QWidget> ptr(widget);
+            sendKeyEvent(QTest::Press, widget, code, text, modifier, delay);
+            if (!ptr) {
+                // if we send key-events to embedded widgets, they might be destroyed
+                // when the user presses Return
+                return;
+            }
+            sendKeyEvent(QTest::Release, widget, code, text, modifier, delay);
+            return;
+        }
+
+        bool repeat = false;
+
+        if (action == QTest::Press) {
+            if (modifier & Qt::ShiftModifier)
+                simulateEvent(widget, true, Qt::Key_Shift, 0, QString(), false, delay);
+
+            if (modifier & Qt::ControlModifier)
+                simulateEvent(widget, true, Qt::Key_Control, modifier & Qt::ShiftModifier, QString(), false, delay);
+
+            if (modifier & Qt::AltModifier)
+                simulateEvent(widget, true, Qt::Key_Alt,
+                              modifier & (Qt::ShiftModifier | Qt::ControlModifier), QString(), false, delay);
+            if (modifier & Qt::MetaModifier)
+                simulateEvent(widget, true, Qt::Key_Meta, modifier & (Qt::ShiftModifier
+                                                                      | Qt::ControlModifier | Qt::AltModifier), QString(), false, delay);
+            simulateEvent(widget, true, code, modifier, text, repeat, delay);
+        } else if (action == QTest::Release) {
+            simulateEvent(widget, false, code, modifier, text, repeat, delay);
+
+            if (modifier & Qt::MetaModifier)
+                simulateEvent(widget, false, Qt::Key_Meta, modifier, QString(), false, delay);
+            if (modifier & Qt::AltModifier)
+                simulateEvent(widget, false, Qt::Key_Alt, modifier &
+                              (Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier), QString(), false, delay);
+
+            if (modifier & Qt::ControlModifier)
+                simulateEvent(widget, false, Qt::Key_Control,
+                              modifier & (Qt::ShiftModifier | Qt::ControlModifier), QString(), false, delay);
+
+            if (modifier & Qt::ShiftModifier)
+                simulateEvent(widget, false, Qt::Key_Shift, modifier & Qt::ShiftModifier, QString(), false, delay);
+        }
+    }
+
+void HbAutoTest::sendKeyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key code,
+                             char ascii, Qt::KeyboardModifiers modifier, int delay)
+    {
+        Q_ASSERT_X(dynamic_cast<HbAutoTestMainWindow *>(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow");
+        QString text;
+        if (ascii)
+            text = QString(QChar::fromLatin1(ascii));
+        sendKeyEvent(action, widget, code, text, modifier, delay);
+    }
+
+void HbAutoTest::keyEvent(QTest::KeyAction action, QWidget *widget, char ascii,
+                                Qt::KeyboardModifiers modifier, int delay)
+    { 
+        Q_ASSERT_X(dynamic_cast<HbAutoTestMainWindow *>(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow");
+        sendKeyEvent(action, widget, asciiToKey(ascii), ascii, modifier, delay); 
+     }
+     
+void HbAutoTest::keyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key key,
+                                Qt::KeyboardModifiers modifier, int delay)
+    { 
+        Q_ASSERT_X(dynamic_cast<HbAutoTestMainWindow *>(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow");
+        sendKeyEvent(action, widget, key, keyToAscii(key), modifier, delay); 
+     }
+
+void HbAutoTest::keyClicks(QWidget *widget, const QString &sequence,
+                                 Qt::KeyboardModifiers modifier, int delay)
+    {
+        Q_ASSERT_X(dynamic_cast<HbAutoTestMainWindow *>(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow");
+        for (int i=0; i < sequence.length(); i++)
+            keyEvent(QTest::Click, widget, sequence.at(i).toLatin1(), modifier, delay);
+    }
+
+void HbAutoTest::keyPress(QWidget *widget, char key, Qt::KeyboardModifiers modifier, int delay)
+    { 
+        Q_ASSERT_X(dynamic_cast<HbAutoTestMainWindow *>(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow");
+        keyEvent(QTest::Press, widget, key, modifier, delay); 
+    }
+    
+void HbAutoTest::keyRelease(QWidget *widget, char key, Qt::KeyboardModifiers modifier, int delay)
+    { 
+        Q_ASSERT_X(dynamic_cast<HbAutoTestMainWindow *>(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow");
+        keyEvent(QTest::Release, widget, key, modifier, delay); 
+    }
+    
+void HbAutoTest::keyClick(QWidget *widget, char key, Qt::KeyboardModifiers modifier, int delay)
+    { 
+        Q_ASSERT_X(dynamic_cast<HbAutoTestMainWindow *>(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow");
+        keyEvent(QTest::Click, widget, key, modifier, delay); 
+    }
+    
+void HbAutoTest::keyPress(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier, int delay)
+    { 
+        Q_ASSERT_X(dynamic_cast<HbAutoTestMainWindow *>(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow");
+        keyEvent(QTest::Press, widget, key, modifier, delay); 
+    }
+    
+void HbAutoTest::keyRelease(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier, int delay)
+    { 
+        Q_ASSERT_X(dynamic_cast<HbAutoTestMainWindow *>(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow");
+        keyEvent(QTest::Release, widget, key, modifier, delay); }
+    
+void HbAutoTest::keyClick(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier, int delay)
+    { 
+        Q_ASSERT_X(dynamic_cast<HbAutoTestMainWindow *>(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow");
+        keyEvent(QTest::Click, widget, key, modifier, delay); 
+    }
+
+Qt::Key HbAutoTest::asciiToKey(char ascii)
+{
+    switch ((unsigned char)ascii) {
+    case 0x08: return Qt::Key_Backspace;
+    case 0x09: return Qt::Key_Tab;
+    case 0x0b: return Qt::Key_Backtab;
+    case 0x0d: return Qt::Key_Return;
+    case 0x1b: return Qt::Key_Escape;
+    case 0x20: return Qt::Key_Space;
+    case 0x21: return Qt::Key_Exclam;
+    case 0x22: return Qt::Key_QuoteDbl;
+    case 0x23: return Qt::Key_NumberSign;
+    case 0x24: return Qt::Key_Dollar;
+    case 0x25: return Qt::Key_Percent;
+    case 0x26: return Qt::Key_Ampersand;
+    case 0x27: return Qt::Key_Apostrophe;
+    case 0x28: return Qt::Key_ParenLeft;
+    case 0x29: return Qt::Key_ParenRight;
+    case 0x2a: return Qt::Key_Asterisk;
+    case 0x2b: return Qt::Key_Plus;
+    case 0x2c: return Qt::Key_Comma;
+    case 0x2d: return Qt::Key_Minus;
+    case 0x2e: return Qt::Key_Period;
+    case 0x2f: return Qt::Key_Slash;
+    case 0x30: return Qt::Key_0;
+    case 0x31: return Qt::Key_1;
+    case 0x32: return Qt::Key_2;
+    case 0x33: return Qt::Key_3;
+    case 0x34: return Qt::Key_4;
+    case 0x35: return Qt::Key_5;
+    case 0x36: return Qt::Key_6;
+    case 0x37: return Qt::Key_7;
+    case 0x38: return Qt::Key_8;
+    case 0x39: return Qt::Key_9;
+    case 0x3a: return Qt::Key_Colon;
+    case 0x3b: return Qt::Key_Semicolon;
+    case 0x3c: return Qt::Key_Less;
+    case 0x3d: return Qt::Key_Equal;
+    case 0x3e: return Qt::Key_Greater;
+    case 0x3f: return Qt::Key_Question;
+    case 0x40: return Qt::Key_At;
+    case 0x41: return Qt::Key_A;
+    case 0x42: return Qt::Key_B;
+    case 0x43: return Qt::Key_C;
+    case 0x44: return Qt::Key_D;
+    case 0x45: return Qt::Key_E;
+    case 0x46: return Qt::Key_F;
+    case 0x47: return Qt::Key_G;
+    case 0x48: return Qt::Key_H;
+    case 0x49: return Qt::Key_I;
+    case 0x4a: return Qt::Key_J;
+    case 0x4b: return Qt::Key_K;
+    case 0x4c: return Qt::Key_L;
+    case 0x4d: return Qt::Key_M;
+    case 0x4e: return Qt::Key_N;
+    case 0x4f: return Qt::Key_O;
+    case 0x50: return Qt::Key_P;
+    case 0x51: return Qt::Key_Q;
+    case 0x52: return Qt::Key_R;
+    case 0x53: return Qt::Key_S;
+    case 0x54: return Qt::Key_T;
+    case 0x55: return Qt::Key_U;
+    case 0x56: return Qt::Key_V;
+    case 0x57: return Qt::Key_W;
+    case 0x58: return Qt::Key_X;
+    case 0x59: return Qt::Key_Y;
+    case 0x5a: return Qt::Key_Z;
+    case 0x5b: return Qt::Key_BracketLeft;
+    case 0x5c: return Qt::Key_Backslash;
+    case 0x5d: return Qt::Key_BracketRight;
+    case 0x5e: return Qt::Key_AsciiCircum;
+    case 0x5f: return Qt::Key_Underscore;
+    case 0x60: return Qt::Key_QuoteLeft;
+    case 0x61: return Qt::Key_A;
+    case 0x62: return Qt::Key_B;
+    case 0x63: return Qt::Key_C;
+    case 0x64: return Qt::Key_D;
+    case 0x65: return Qt::Key_E;
+    case 0x66: return Qt::Key_F;
+    case 0x67: return Qt::Key_G;
+    case 0x68: return Qt::Key_H;
+    case 0x69: return Qt::Key_I;
+    case 0x6a: return Qt::Key_J;
+    case 0x6b: return Qt::Key_K;
+    case 0x6c: return Qt::Key_L;
+    case 0x6d: return Qt::Key_M;
+    case 0x6e: return Qt::Key_N;
+    case 0x6f: return Qt::Key_O;
+    case 0x70: return Qt::Key_P;
+    case 0x71: return Qt::Key_Q;
+    case 0x72: return Qt::Key_R;
+    case 0x73: return Qt::Key_S;
+    case 0x74: return Qt::Key_T;
+    case 0x75: return Qt::Key_U;
+    case 0x76: return Qt::Key_V;
+    case 0x77: return Qt::Key_W;
+    case 0x78: return Qt::Key_X;
+    case 0x79: return Qt::Key_Y;
+    case 0x7a: return Qt::Key_Z;
+    case 0x7b: return Qt::Key_BraceLeft;
+    case 0x7c: return Qt::Key_Bar;
+    case 0x7d: return Qt::Key_BraceRight;
+    case 0x7e: return Qt::Key_AsciiTilde;
+
+    // Latin 1 codes adapted from X: keysymdef.h,v 1.21 94/08/28 16:17:06
+    case 0xa0: return Qt::Key_nobreakspace;
+    case 0xa1: return Qt::Key_exclamdown;
+    case 0xa2: return Qt::Key_cent;
+    case 0xa3: return Qt::Key_sterling;
+    case 0xa4: return Qt::Key_currency;
+    case 0xa5: return Qt::Key_yen;
+    case 0xa6: return Qt::Key_brokenbar;
+    case 0xa7: return Qt::Key_section;
+    case 0xa8: return Qt::Key_diaeresis;
+    case 0xa9: return Qt::Key_copyright;
+    case 0xaa: return Qt::Key_ordfeminine;
+    case 0xab: return Qt::Key_guillemotleft;
+    case 0xac: return Qt::Key_notsign;
+    case 0xad: return Qt::Key_hyphen;
+    case 0xae: return Qt::Key_registered;
+    case 0xaf: return Qt::Key_macron;
+    case 0xb0: return Qt::Key_degree;
+    case 0xb1: return Qt::Key_plusminus;
+    case 0xb2: return Qt::Key_twosuperior;
+    case 0xb3: return Qt::Key_threesuperior;
+    case 0xb4: return Qt::Key_acute;
+    case 0xb5: return Qt::Key_mu;
+    case 0xb6: return Qt::Key_paragraph;
+    case 0xb7: return Qt::Key_periodcentered;
+    case 0xb8: return Qt::Key_cedilla;
+    case 0xb9: return Qt::Key_onesuperior;
+    case 0xba: return Qt::Key_masculine;
+    case 0xbb: return Qt::Key_guillemotright;
+    case 0xbc: return Qt::Key_onequarter;
+    case 0xbd: return Qt::Key_onehalf;
+    case 0xbe: return Qt::Key_threequarters;
+    case 0xbf: return Qt::Key_questiondown;
+    case 0xc0: return Qt::Key_Agrave;
+    case 0xc1: return Qt::Key_Aacute;
+    case 0xc2: return Qt::Key_Acircumflex;
+    case 0xc3: return Qt::Key_Atilde;
+    case 0xc4: return Qt::Key_Adiaeresis;
+    case 0xc5: return Qt::Key_Aring;
+    case 0xc6: return Qt::Key_AE;
+    case 0xc7: return Qt::Key_Ccedilla;
+    case 0xc8: return Qt::Key_Egrave;
+    case 0xc9: return Qt::Key_Eacute;
+    case 0xca: return Qt::Key_Ecircumflex;
+    case 0xcb: return Qt::Key_Ediaeresis;
+    case 0xcc: return Qt::Key_Igrave;
+    case 0xcd: return Qt::Key_Iacute;
+    case 0xce: return Qt::Key_Icircumflex;
+    case 0xcf: return Qt::Key_Idiaeresis;
+    case 0xd0: return Qt::Key_ETH;
+    case 0xd1: return Qt::Key_Ntilde;
+    case 0xd2: return Qt::Key_Ograve;
+    case 0xd3: return Qt::Key_Oacute;
+    case 0xd4: return Qt::Key_Ocircumflex;
+    case 0xd5: return Qt::Key_Otilde;
+    case 0xd6: return Qt::Key_Odiaeresis;
+    case 0xd7: return Qt::Key_multiply;
+    case 0xd8: return Qt::Key_Ooblique;
+    case 0xd9: return Qt::Key_Ugrave;
+    case 0xda: return Qt::Key_Uacute;
+    case 0xdb: return Qt::Key_Ucircumflex;
+    case 0xdc: return Qt::Key_Udiaeresis;
+    case 0xdd: return Qt::Key_Yacute;
+    case 0xde: return Qt::Key_THORN;
+    case 0xdf: return Qt::Key_ssharp;
+    case 0xe5: return Qt::Key_Aring;
+    case 0xe6: return Qt::Key_AE;
+    case 0xf7: return Qt::Key_division;
+    case 0xf8: return Qt::Key_Ooblique;
+    case 0xff: return Qt::Key_ydiaeresis;
+    default: QTEST_ASSERT(false); return Qt::Key(0);
+    }
+}
+
+char HbAutoTest::keyToAscii(Qt::Key key)
+{
+    switch (key) {
+    case Qt::Key_Backspace: return 0x8; //BS
+    case Qt::Key_Tab: return 0x09; // HT
+    case Qt::Key_Backtab: return 0x0b; // VT
+    case Qt::Key_Enter:
+    case Qt::Key_Return: return 0x0d; // CR
+    case Qt::Key_Escape: return 0x1b; // ESC
+    case Qt::Key_Space: return 0x20;        // 7 bit printable ASCII
+    case Qt::Key_Exclam: return 0x21;
+    case Qt::Key_QuoteDbl: return 0x22;
+    case Qt::Key_NumberSign: return 0x23;
+    case Qt::Key_Dollar: return 0x24;
+    case Qt::Key_Percent: return 0x25;
+    case Qt::Key_Ampersand: return 0x26;
+    case Qt::Key_Apostrophe: return 0x27;
+    case Qt::Key_ParenLeft: return 0x28;
+    case Qt::Key_ParenRight: return 0x29;
+    case Qt::Key_Asterisk: return 0x2a;
+    case Qt::Key_Plus: return 0x2b;
+    case Qt::Key_Comma: return 0x2c;
+    case Qt::Key_Minus: return 0x2d;
+    case Qt::Key_Period: return 0x2e;
+    case Qt::Key_Slash: return 0x2f;
+    case Qt::Key_0: return 0x30;
+    case Qt::Key_1: return 0x31;
+    case Qt::Key_2: return 0x32;
+    case Qt::Key_3: return 0x33;
+    case Qt::Key_4: return 0x34;
+    case Qt::Key_5: return 0x35;
+    case Qt::Key_6: return 0x36;
+    case Qt::Key_7: return 0x37;
+    case Qt::Key_8: return 0x38;
+    case Qt::Key_9: return 0x39;
+    case Qt::Key_Colon: return 0x3a;
+    case Qt::Key_Semicolon: return 0x3b;
+    case Qt::Key_Less: return 0x3c;
+    case Qt::Key_Equal: return 0x3d;
+    case Qt::Key_Greater: return 0x3e;
+    case Qt::Key_Question: return 0x3f;
+    case Qt::Key_At: return 0x40;
+    case Qt::Key_A: return 0x61; // 0x41 == 'A', 0x61 == 'a'
+    case Qt::Key_B: return 0x62;
+    case Qt::Key_C: return 0x63;
+    case Qt::Key_D: return 0x64;
+    case Qt::Key_E: return 0x65;
+    case Qt::Key_F: return 0x66;
+    case Qt::Key_G: return 0x67;
+    case Qt::Key_H: return 0x68;
+    case Qt::Key_I: return 0x69;
+    case Qt::Key_J: return 0x6a;
+    case Qt::Key_K: return 0x6b;
+    case Qt::Key_L: return 0x6c;
+    case Qt::Key_M: return 0x6d;
+    case Qt::Key_N: return 0x6e;
+    case Qt::Key_O: return 0x6f;
+    case Qt::Key_P: return 0x70;
+    case Qt::Key_Q: return 0x71;
+    case Qt::Key_R: return 0x72;
+    case Qt::Key_S: return 0x73;
+    case Qt::Key_T: return 0x74;
+    case Qt::Key_U: return 0x75;
+    case Qt::Key_V: return 0x76;
+    case Qt::Key_W: return 0x77;
+    case Qt::Key_X: return 0x78;
+    case Qt::Key_Y: return 0x79;
+    case Qt::Key_Z: return 0x7a;
+    case Qt::Key_BracketLeft: return 0x5b;
+    case Qt::Key_Backslash: return 0x5c;
+    case Qt::Key_BracketRight: return 0x5d;
+    case Qt::Key_AsciiCircum: return 0x5e;
+    case Qt::Key_Underscore: return 0x5f;
+    case Qt::Key_QuoteLeft: return 0x60;
+
+    case Qt::Key_BraceLeft: return 0x7b;
+    case Qt::Key_Bar: return 0x7c;
+    case Qt::Key_BraceRight: return 0x7d;
+    case Qt::Key_AsciiTilde: return 0x7e;
+
+    case Qt::Key_Delete: return 0;
+    case Qt::Key_Insert: return 0; // = 0x1006,
+    case Qt::Key_Pause: return 0; // = 0x1008,
+    case Qt::Key_Print: return 0; // = 0x1009,
+    case Qt::Key_SysReq: return 0; // = 0x100a,
+
+    case Qt::Key_Clear: return 0; // = 0x100b,
+
+    case Qt::Key_Home: return 0; // = 0x1010,        // cursor movement
+    case Qt::Key_End: return 0; // = 0x1011,
+    case Qt::Key_Left: return 0; // = 0x1012,
+    case Qt::Key_Up: return 0; // = 0x1013,
+    case Qt::Key_Right: return 0; // = 0x1014,
+    case Qt::Key_Down: return 0; // = 0x1015,
+    case Qt::Key_PageUp: return 0; // = 0x1016,
+    case Qt::Key_PageDown: return 0; // = 0x1017,
+    case Qt::Key_Shift: return 0; // = 0x1020,        // modifiers
+    case Qt::Key_Control: return 0; // = 0x1021,
+    case Qt::Key_Meta: return 0; // = 0x1022,
+    case Qt::Key_Alt: return 0; // = 0x1023,
+    case Qt::Key_CapsLock: return 0; // = 0x1024,
+    case Qt::Key_NumLock: return 0; // = 0x1025,
+    case Qt::Key_ScrollLock: return 0; // = 0x1026,
+    case Qt::Key_F1: return 0; // = 0x1030,        // function keys
+    case Qt::Key_F2: return 0; // = 0x1031,
+    case Qt::Key_F3: return 0; // = 0x1032,
+    case Qt::Key_F4: return 0; // = 0x1033,
+    case Qt::Key_F5: return 0; // = 0x1034,
+    case Qt::Key_F6: return 0; // = 0x1035,
+    case Qt::Key_F7: return 0; // = 0x1036,
+    case Qt::Key_F8: return 0; // = 0x1037,
+    case Qt::Key_F9: return 0; // = 0x1038,
+    case Qt::Key_F10: return 0; // = 0x1039,
+    case Qt::Key_F11: return 0; // = 0x103a,
+    case Qt::Key_F12: return 0; // = 0x103b,
+    case Qt::Key_F13: return 0; // = 0x103c,
+    case Qt::Key_F14: return 0; // = 0x103d,
+    case Qt::Key_F15: return 0; // = 0x103e,
+    case Qt::Key_F16: return 0; // = 0x103f,
+    case Qt::Key_F17: return 0; // = 0x1040,
+    case Qt::Key_F18: return 0; // = 0x1041,
+    case Qt::Key_F19: return 0; // = 0x1042,
+    case Qt::Key_F20: return 0; // = 0x1043,
+    case Qt::Key_F21: return 0; // = 0x1044,
+    case Qt::Key_F22: return 0; // = 0x1045,
+    case Qt::Key_F23: return 0; // = 0x1046,
+    case Qt::Key_F24: return 0; // = 0x1047,
+    case Qt::Key_F25: return 0; // = 0x1048,        // F25 .. F35 only on X11
+    case Qt::Key_F26: return 0; // = 0x1049,
+    case Qt::Key_F27: return 0; // = 0x104a,
+    case Qt::Key_F28: return 0; // = 0x104b,
+    case Qt::Key_F29: return 0; // = 0x104c,
+    case Qt::Key_F30: return 0; // = 0x104d,
+    case Qt::Key_F31: return 0; // = 0x104e,
+    case Qt::Key_F32: return 0; // = 0x104f,
+    case Qt::Key_F33: return 0; // = 0x1050,
+    case Qt::Key_F34: return 0; // = 0x1051,
+    case Qt::Key_F35: return 0; // = 0x1052,
+    case Qt::Key_Super_L: return 0; // = 0x1053,        // extra keys
+    case Qt::Key_Super_R: return 0; // = 0x1054,
+    case Qt::Key_Menu: return 0; // = 0x1055,
+    case Qt::Key_Hyper_L: return 0; // = 0x1056,
+    case Qt::Key_Hyper_R: return 0; // = 0x1057,
+    case Qt::Key_Help: return 0; // = 0x1058,
+    case Qt::Key_Direction_L: return 0; // = 0x1059,
+    case Qt::Key_Direction_R: return 0; // = 0x1060,
+
+    // Latin 1 codes adapted from X: keysymdef.h,v 1.21 94/08/28 16:17:06
+    case Qt::Key_nobreakspace: return char(0xa0);
+    case Qt::Key_exclamdown: return char(0xa1);
+    case Qt::Key_cent: return char(0xa2);
+    case Qt::Key_sterling: return char(0xa3);
+    case Qt::Key_currency: return char(0xa4);
+    case Qt::Key_yen: return char(0xa5);
+    case Qt::Key_brokenbar: return char(0xa6);
+    case Qt::Key_section: return char(0xa7);
+    case Qt::Key_diaeresis: return char(0xa8);
+    case Qt::Key_copyright: return char(0xa9);
+    case Qt::Key_ordfeminine: return char(0xaa);
+    case Qt::Key_guillemotleft: return char(0xab); // left angle quotation mar
+    case Qt::Key_notsign: return char(0xac);
+    case Qt::Key_hyphen: return char(0xad);
+    case Qt::Key_registered: return char(0xae);
+    case Qt::Key_macron: return char(0xaf);
+    case Qt::Key_degree: return char(0xb0);
+    case Qt::Key_plusminus: return char(0xb1);
+    case Qt::Key_twosuperior: return char(0xb2);
+    case Qt::Key_threesuperior: return char(0xb3);
+    case Qt::Key_acute: return char(0xb4);
+    case Qt::Key_mu: return char(0xb5);
+    case Qt::Key_paragraph: return char(0xb6);
+    case Qt::Key_periodcentered: return char(0xb7);
+    case Qt::Key_cedilla: return char(0xb8);
+    case Qt::Key_onesuperior: return char(0xb9);
+    case Qt::Key_masculine: return char(0xba);
+    case Qt::Key_guillemotright: return char(0xbb); // right angle quotation mar
+    case Qt::Key_onequarter: return char(0xbc);
+    case Qt::Key_onehalf: return char(0xbd);
+    case Qt::Key_threequarters: return char(0xbe);
+    case Qt::Key_questiondown: return char(0xbf);
+    case Qt::Key_Agrave: return char(0xc0);
+    case Qt::Key_Aacute: return char(0xc1);
+    case Qt::Key_Acircumflex: return char(0xc2);
+    case Qt::Key_Atilde: return char(0xc3);
+    case Qt::Key_Adiaeresis: return char(0xc4);
+    case Qt::Key_Aring: return char(0xe5);
+    case Qt::Key_AE: return char(0xe6);
+    case Qt::Key_Ccedilla: return char(0xc7);
+    case Qt::Key_Egrave: return char(0xc8);
+    case Qt::Key_Eacute: return char(0xc9);
+    case Qt::Key_Ecircumflex: return char(0xca);
+    case Qt::Key_Ediaeresis: return char(0xcb);
+    case Qt::Key_Igrave: return char(0xcc);
+    case Qt::Key_Iacute: return char(0xcd);
+    case Qt::Key_Icircumflex: return char(0xce);
+    case Qt::Key_Idiaeresis: return char(0xcf);
+    case Qt::Key_ETH: return char(0xd0);
+    case Qt::Key_Ntilde: return char(0xd1);
+    case Qt::Key_Ograve: return char(0xd2);
+    case Qt::Key_Oacute: return char(0xd3);
+    case Qt::Key_Ocircumflex: return char(0xd4);
+    case Qt::Key_Otilde: return char(0xd5);
+    case Qt::Key_Odiaeresis: return char(0xd6);
+    case Qt::Key_multiply: return char(0xd7);
+    case Qt::Key_Ooblique: return char(0xf8);
+    case Qt::Key_Ugrave: return char(0xd9);
+    case Qt::Key_Uacute: return char(0xda);
+    case Qt::Key_Ucircumflex: return char(0xdb);
+    case Qt::Key_Udiaeresis: return char(0xdc);
+    case Qt::Key_Yacute: return char(0xdd);
+    case Qt::Key_THORN: return char(0xde);
+    case Qt::Key_ssharp: return char(0xdf);
+    case Qt::Key_division: return char(0xf7);
+    case Qt::Key_ydiaeresis: return char(0xff);
+
+    // multimedia/internet keys - ignored by default - see QKeyEvent c'tor
+
+    case Qt::Key_Back : return 0; // = 0x1061,
+    case Qt::Key_Forward : return 0; // = 0x1062,
+    case Qt::Key_Stop : return 0; // = 0x1063,
+    case Qt::Key_Refresh : return 0; // = 0x1064,
+
+    case Qt::Key_VolumeDown: return 0; // = 0x1070,
+    case Qt::Key_VolumeMute : return 0; // = 0x1071,
+    case Qt::Key_VolumeUp: return 0; // = 0x1072,
+    case Qt::Key_BassBoost: return 0; // = 0x1073,
+    case Qt::Key_BassUp: return 0; // = 0x1074,
+    case Qt::Key_BassDown: return 0; // = 0x1075,
+    case Qt::Key_TrebleUp: return 0; // = 0x1076,
+    case Qt::Key_TrebleDown: return 0; // = 0x1077,
+
+    case Qt::Key_MediaPlay : return 0; // = 0x1080,
+    case Qt::Key_MediaStop : return 0; // = 0x1081,
+    case Qt::Key_MediaPrevious : return 0; // = 0x1082,
+    case Qt::Key_MediaNext : return 0; // = 0x1083,
+    case Qt::Key_MediaRecord: return 0; // = 0x1084,
+
+    case Qt::Key_HomePage : return 0; // = 0x1090,
+    case Qt::Key_Favorites : return 0; // = 0x1091,
+    case Qt::Key_Search : return 0; // = 0x1092,
+    case Qt::Key_Standby: return 0; // = 0x1093,
+    case Qt::Key_OpenUrl: return 0; // = 0x1094,
+
+    case Qt::Key_LaunchMail : return 0; // = 0x10a0,
+    case Qt::Key_LaunchMedia: return 0; // = 0x10a1,
+    case Qt::Key_Launch0 : return 0; // = 0x10a2,
+    case Qt::Key_Launch1 : return 0; // = 0x10a3,
+    case Qt::Key_Launch2 : return 0; // = 0x10a4,
+    case Qt::Key_Launch3 : return 0; // = 0x10a5,
+    case Qt::Key_Launch4 : return 0; // = 0x10a6,
+    case Qt::Key_Launch5 : return 0; // = 0x10a7,
+    case Qt::Key_Launch6 : return 0; // = 0x10a8,
+    case Qt::Key_Launch7 : return 0; // = 0x10a9,
+    case Qt::Key_Launch8 : return 0; // = 0x10aa,
+    case Qt::Key_Launch9 : return 0; // = 0x10ab,
+    case Qt::Key_LaunchA : return 0; // = 0x10ac,
+    case Qt::Key_LaunchB : return 0; // = 0x10ad,
+    case Qt::Key_LaunchC : return 0; // = 0x10ae,
+    case Qt::Key_LaunchD : return 0; // = 0x10af,
+    case Qt::Key_LaunchE : return 0; // = 0x10b0,
+    case Qt::Key_LaunchF : return 0; // = 0x10b1,
+
+    default: QTEST_ASSERT(false); return 0;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cpdestinationplugin/tsrc/ut/hbautotest.h	Wed Jun 23 17:49:20 2010 +0100
@@ -0,0 +1,279 @@
+/*
+* 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:
+*
+*/
+
+#ifndef HBAUTOTEST_H
+#define HBAUTOTEST_H
+
+#include <hbnamespace.h>
+#include <hbmainwindow.h>
+#include <QtTest/QtTest>
+
+class HbMainWindow;
+class HbWidget;
+class HbAutoTestMainWindow;
+class HbAutoTest;
+class HbAutoTestMouseEvent; 
+/*
+INSTRUCTIONS:
+The class HbAutoTest is meant to be used with Orbit applications auto testing instead of GUI testing APIs of QTestLib.
+
+The functions of this class is to used similarily to the related QTestLib functions.
+
+Use HbAutoTestMainWindow (defined below) instead of HbMainWindow to enble filtering.
+Filterin filters out UI events that are not sent by function defined in HbAutoTest class.
+
+*/
+
+class HbAutoTestMouseEvent : public QMouseEvent
+{
+public:
+    HbAutoTestMouseEvent(Type type, const QPoint & pos, const QPoint & globalPos, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers ) 
+        : QMouseEvent(type,pos,globalPos,button,buttons,modifiers){}
+};
+
+class HbAutoTestKeyEvent : public QKeyEvent
+{
+public:
+        HbAutoTestKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text = QString(),
+              bool autorep = false, ushort count = 1 ) 
+        : QKeyEvent(type, key, modifiers, text, autorep, count){}
+};
+
+class HbAutoTest 
+{
+public:
+    
+    static void mouseMove (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos = QPointF(), int delay = -1 );
+    static void mousePress (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos = QPointF(), int delay = -1);
+    static void mouseRelease (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos = QPointF(), int delay = -1);
+    static void mouseClick (HbAutoTestMainWindow *window, const HbWidget *widget, QPointF pos = QPointF(), int delay = -1);
+   
+private:
+    static void drag(HbAutoTestMainWindow *window, QPointF targetPoint);
+    static QPointF middlePointOfWidget( const HbWidget* widget);
+
+    static bool pointerPressed;
+    static QPointF pressPoint;
+
+//Key event Part: copy-pasted from QTestLib and modified to support HbAutoTestKeyEvent to enable filtering.
+//see HbAutoTestMainWindow below.
+public:
+    
+    static Qt::Key asciiToKey(char ascii);
+    static char keyToAscii(Qt::Key key);
+
+    static void simulateEvent(QWidget *widget, bool press, int code,
+                              Qt::KeyboardModifiers modifier, QString text, bool repeat, int delay=-1);
+
+    static void sendKeyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key code,
+                             QString text, Qt::KeyboardModifiers modifier, int delay=-1);    
+
+    static void sendKeyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key code,
+                             char ascii, Qt::KeyboardModifiers modifier, int delay=-1);
+
+    static void keyEvent(QTest::KeyAction action, QWidget *widget, char ascii,
+                                Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1);
+ 
+    static void keyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key key,
+                                Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1);
+
+    static void keyClicks(QWidget *widget, const QString &sequence,
+                                 Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1);
+
+    static void keyPress(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1);
+    
+    static void keyRelease(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1);
+    
+    static void keyClick(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1);
+    
+    static void keyPress(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1);
+   
+    static void keyRelease(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1);
+
+    static void keyClick(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1);
+};
+
+class HbTestEvent
+{
+public:
+    virtual void simulate(QWidget *w) = 0;
+    virtual HbTestEvent *clone() const = 0;
+
+    virtual ~HbTestEvent() {}
+};
+
+class HbTestKeyEvent: public HbTestEvent
+{
+public:
+    inline HbTestKeyEvent(QTest::KeyAction action, Qt::Key key, Qt::KeyboardModifiers modifiers, int delay)
+        : _action(action), _delay(delay), _modifiers(modifiers), _ascii(0), _key(key) {}
+    inline HbTestKeyEvent(QTest::KeyAction action, char ascii, Qt::KeyboardModifiers modifiers, int delay)
+        : _action(action), _delay(delay), _modifiers(modifiers),
+          _ascii(ascii), _key(Qt::Key_unknown) {}
+    inline HbTestEvent *clone() const { return new HbTestKeyEvent(*this); }
+
+    inline void simulate(QWidget *w)
+    {
+        if (_ascii == 0)
+            HbAutoTest::keyEvent(_action, w, _key, _modifiers, _delay);
+        else
+            HbAutoTest::keyEvent(_action, w, _ascii, _modifiers, _delay);
+    } 
+
+protected:
+    QTest::KeyAction _action;
+    int _delay;
+    Qt::KeyboardModifiers _modifiers;
+    char _ascii;
+    Qt::Key _key;
+};
+
+class HbTestKeyClicksEvent: public HbTestEvent
+{
+public:
+    inline HbTestKeyClicksEvent(const QString &keys, Qt::KeyboardModifiers modifiers, int delay)
+        : _keys(keys), _modifiers(modifiers), _delay(delay) {}
+    inline HbTestEvent *clone() const { return new HbTestKeyClicksEvent(*this); }
+
+    inline void simulate(QWidget *w)
+    {
+        HbAutoTest::keyClicks(w, _keys, _modifiers, _delay);
+    }
+
+private:
+    QString _keys;
+    Qt::KeyboardModifiers _modifiers;
+    int _delay;
+};
+
+class HbTestDelayEvent: public HbTestEvent
+{
+public:
+    inline HbTestDelayEvent(int msecs): _delay(msecs) {}
+    inline HbTestEvent *clone() const { return new HbTestDelayEvent(*this); }
+
+    inline void simulate(QWidget * /*w*/) { QTest::qWait(_delay); }
+
+private:
+    int _delay;
+};
+
+class HbTestEventList: public QList<HbTestEvent *>
+{
+public:
+    inline HbTestEventList() {}
+    inline HbTestEventList(const HbTestEventList &other): QList<HbTestEvent *>()
+    { for (int i = 0; i < other.count(); ++i) append(other.at(i)->clone()); }
+    inline ~HbTestEventList()
+    { clear(); }
+    inline void clear()
+    { qDeleteAll(*this); QList<HbTestEvent *>::clear(); }
+
+    inline void addKeyClick(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1)
+    { addKeyEvent(QTest::Click, qtKey, modifiers, msecs); }
+    inline void addKeyPress(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1)
+    { addKeyEvent(QTest::Press, qtKey, modifiers, msecs); }
+    inline void addKeyRelease(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1)
+    { addKeyEvent(QTest::Release, qtKey, modifiers, msecs); }
+    inline void addKeyEvent(QTest::KeyAction action, Qt::Key qtKey,
+                            Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1)
+    { append(new HbTestKeyEvent(action, qtKey, modifiers, msecs)); }
+
+    inline void addKeyClick(char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1)
+    { addKeyEvent(QTest::Click, ascii, modifiers, msecs); }
+    inline void addKeyPress(char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1)
+    { addKeyEvent(QTest::Press, ascii, modifiers, msecs); }
+    inline void addKeyRelease(char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1)
+    { addKeyEvent(QTest::Release, ascii, modifiers, msecs); }
+    inline void addKeyClicks(const QString &keys, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1)
+    { append(new HbTestKeyClicksEvent(keys, modifiers, msecs)); }
+    inline void addKeyEvent(QTest::KeyAction action, char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1)
+    { append(new HbTestKeyEvent(action, ascii, modifiers, msecs)); }
+
+    inline void addDelay(int msecs)
+    { append(new HbTestDelayEvent(msecs)); }
+
+    inline void simulate(QWidget *w)
+    {
+        for (int i = 0; i < count(); ++i)
+            at(i)->simulate(w);
+    }
+};
+
+class HbAutoTestMainWindow : public HbMainWindow
+{
+public:
+    HbAutoTestMainWindow() : HbMainWindow() {}
+    
+    void mousePressEvent(QMouseEvent *event)
+    {
+        qDebug(
+            "HbAutoTestMainWindow::mousePressEvent: x(%d) y(%d)",
+            event->x(),
+            event->y());
+         if ( dynamic_cast<HbAutoTestMouseEvent *>(event) ) {
+                HbMainWindow::mousePressEvent(event);
+            } else {
+                ;//Do nothing 
+         }
+    }
+
+    void mouseMoveEvent(QMouseEvent *event)
+    {
+        if ( dynamic_cast<HbAutoTestMouseEvent *>(event) ) {
+                HbMainWindow::mouseMoveEvent(event);
+            } else {
+                ;//Do nothing
+         }
+    }
+
+    void mouseReleaseEvent(QMouseEvent *event)
+    {
+         if ( dynamic_cast<HbAutoTestMouseEvent *>(event) ) {
+                HbMainWindow::mouseReleaseEvent(event);
+            } else {
+                ;//Do nothing  
+         }
+    }
+
+    void keyPressEvent(QKeyEvent *event)
+    {
+        if ( dynamic_cast<HbAutoTestKeyEvent *>(event) ) {
+                HbMainWindow::keyPressEvent(event);
+            } else {
+                ;//Do nothing  
+         }
+    }
+    void keyReleaseEvent(QKeyEvent *event)
+    {
+        if ( dynamic_cast<HbAutoTestKeyEvent *>(event) ) {
+                HbMainWindow::keyReleaseEvent(event);
+            } else {
+                ;//Do nothing  
+         }
+    }
+
+    void mouseDoubleClickEvent(QMouseEvent *event)
+    {
+        Q_UNUSED(event);
+        //Just ignore, not supported in Orbit
+    }
+};
+
+
+Q_DECLARE_METATYPE(HbTestEventList)
+#endif //HBAUTOTEST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cpdestinationplugin/tsrc/ut/testcpdestinationplugin.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -0,0 +1,663 @@
+/*
+* 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:
+* Control Panel WLAN AP plugin unit testing.
+*/
+
+#include <HbApplication>
+#include <HbMainWindow>
+#include <HbView>
+#include <HbDialog>
+#include <HbRadioButtonList>
+#include <HbAction>
+#include <HbDataForm>
+#include <HbDataFormModel>
+#include <HbDataFormModelItem>
+#include <QtTest/QtTest>
+#include <cmmanager_shim.h>
+#include <cmconnectionmethod_shim.h>
+#include <cpplugininterface.h>
+#include <cppluginutility.h>
+#include <cpitemdatahelper.h>
+#include <cpsettingformitemdata.h>
+
+//#include "cmapplsettingsui_p.h"
+//#include "cmradiodialog.h"
+//#include "cpdestinationplugin.h"
+
+#include "hbautotest.h"
+#include "testcpdestinationplugin.h"
+
+// -----------------------------------------------------------------------------
+// STATIC TEST DATA
+// -----------------------------------------------------------------------------
+
+static const QString pluginDir =
+    "\\resource\\qt\\plugins\\controlpanel";
+
+static const QString pluginName = "cpdestinationplugin.dll";
+
+// Time to wait before continuing after an UI step
+static const int waitTime = 10;
+
+static const QString navigationButton = "HbNavigationButton";
+
+// UI coordinates
+static const QPoint destinationGroup(175,30);
+static const QPoint internetDestination(175,100);
+static const QPoint internetFirstAp(175,130);
+static const QPoint internetFirstApMove(175,160);
+static const QPoint internetFirstApDelete(175,210);
+static const QPoint internetFirstApShare(175,260);
+
+static const QPoint deleteDialogOk(100,300);
+
+static const QPoint tbButton(175,550);
+static const QPoint arrangeFirstAp(175,30);
+static const QPoint arrangeDragEnd(175,140);
+
+static const QPoint uncatDestination(175,455);
+static const QPoint uncatAp(175,120);
+static const QPoint uncatMenuMove(175,140);
+static const QPoint uncatMenuDelete(175,180);
+
+static const QPoint destDialogOk(100,370);
+static const QPoint destDialogSecond(100,255);
+static const QPoint destDialogThird(100,315);
+static const QPoint destDialogNewDest(100,345);
+
+static const QPoint addDestination(175,410);
+static const QPoint addDialog(175,235);
+static const QPoint addDialogOk(100,300);
+static const QPoint newDestinationRename(175,445);
+static const QPoint newDestinationDelete(175,490);
+
+static const QPoint addDialogKb(175,155);
+static const QPoint addDialogOkKb(100,225);
+
+static const QPoint secondDestination(175,195);
+static const QPoint thirdDestination(175,275);
+static const QPoint fourthDestination(175,355);
+
+
+
+#if 0
+// Destination list item for Connection Method selection
+static const QString dedicatedAccessPoint = "Dedicated access point";
+
+static const QStringList allDestinations = QStringList() <<
+    "Internet" <<
+    "My Snap" <<
+    dedicatedAccessPoint;
+
+static const QStringList allConnectionMethods = QStringList()
+    << "Home WLAN"
+    << "packet data 1"
+    << "packet data 2"
+    << "packet data 3"
+    << "Streaming"
+    << "WLAN IAP 1"
+    << "WLAN IAP 2"
+    << "WLAN IAP 3";
+
+static const QStringList gprsConnectionMethods = QStringList()
+    << "packet data 1"
+    << "packet data 2"
+    << "packet data 3"
+    << "Streaming";
+
+static const QStringList wlanConnectionMethods = QStringList()
+    << "Home WLAN"
+    << "WLAN IAP 1"
+    << "WLAN IAP 2"
+    << "WLAN IAP 3";
+#endif
+
+// -----------------------------------------------------------------------------
+// FRAMEWORK FUNCTIONS
+// -----------------------------------------------------------------------------
+
+/**
+ * Test main function. Runs all test cases.
+ */
+#ifndef TESTCMAPPLSETTINGSUI_NO_OUTPUT_REDIRECT
+int main(int argc, char *argv[])
+{
+    HbApplication app(argc, argv);
+    app.setApplicationName("TestCpDestinationPlugin");
+    
+    char *pass[3];  
+    pass[0] = argv[0];
+    pass[1] = "-o"; 
+    pass[2] = "c:\\data\\TestCpDestinationPlugin.txt";
+ 
+    TestCpDestinationPlugin tc;
+    int res = QTest::qExec(&tc, 3, pass);
+ 
+    return res;
+}
+#else
+QTEST_MAIN(TestCpDestinationPlugin)
+#endif
+
+/**
+ * This function is be called before the first test case is executed.
+ */
+void TestCpDestinationPlugin::initTestCase()
+{
+    mMainWindow = new HbAutoTestMainWindow;
+    mMainWindow->show();
+    
+    // Load plugin
+    QDir dir(pluginDir);
+    QPluginLoader loader(dir.absoluteFilePath(pluginName));
+    mPlugin = QSharedPointer<CpPluginInterface>
+        (qobject_cast<CpPluginInterface *>(loader.instance()));
+    //QVERIFY(mPlugin != NULL);
+
+    
+    // Create destinations view
+    subCreateSettingsView();
+    
+    HbAutoTest::mouseClick(mMainWindow, mView, destinationGroup, waitTime);
+    QTest::qWait(200);
+}
+
+/**
+ * This function is be called after the last test case was executed.
+ */
+void TestCpDestinationPlugin::cleanupTestCase()
+{
+    delete mMainWindow;
+    mMainWindow = 0;
+}
+
+/**
+ * This function is be called before each test case is executed.
+ */
+void TestCpDestinationPlugin::init()
+{
+    // Expand settings group
+   // mTestView->mForm->setExpanded(
+   //     mTestView->mModel->indexFromItem(mTestView->mApSettingsGroupItem),
+    //    true);
+}
+
+/**
+ * This function is be called after each test case is executed.
+ */
+void TestCpDestinationPlugin::cleanup()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// TEST CASES
+// -----------------------------------------------------------------------------
+void TestCpDestinationPlugin::tcArrangeAps()
+{   
+    // Open Internet destination
+    HbAutoTest::mouseClick(mMainWindow, mView, internetDestination, waitTime);
+    QTest::qWait(500);
+    
+    // Activate arrange mode
+    HbAutoTest::mouseClick(mMainWindow, mView, tbButton, waitTime);
+    QTest::qWait(500);
+    
+    // Drag
+    HbAutoTest::mousePress(mMainWindow, mView, arrangeFirstAp, waitTime);
+    QTest::qWait(300);
+    HbAutoTest::mouseMove(mMainWindow, mView, arrangeDragEnd, waitTime);
+    QTest::qWait(300);
+    HbAutoTest::mouseRelease(mMainWindow, mView, arrangeDragEnd, waitTime);
+    
+    HbAutoTest::mouseClick(mMainWindow, mView, arrangeDragEnd, waitTime);
+    QTest::qWait(500);
+    
+    // Cancel
+    subClickWidget(navigationButton);
+    QTest::qWait(500);
+    
+    // Activate arrange mode again
+    HbAutoTest::mouseClick(mMainWindow, mView, tbButton, waitTime);
+    QTest::qWait(500);
+    
+    // Drag
+    HbAutoTest::mousePress(mMainWindow, mView, arrangeFirstAp, waitTime);
+    QTest::qWait(300);
+    HbAutoTest::mouseMove(mMainWindow, mView, arrangeDragEnd, waitTime);
+    QTest::qWait(300);
+    // HbAutoTest::mouseRelease(mMainWindow, mView, arrangeDragEnd, waitTime);
+    
+    HbAutoTest::mouseClick(mMainWindow, mView, arrangeDragEnd, waitTime);
+    QTest::qWait(500);
+    
+    // OK
+    HbAutoTest::mouseClick(mMainWindow, mView, tbButton, waitTime);
+    QTest::qWait(500);
+    
+    // Back to main view
+    subClickWidget(navigationButton);
+    QTest::qWait(500);
+    
+}
+
+void TestCpDestinationPlugin::tcMoveAp()
+{   
+    // Open uncategorised aps
+    HbAutoTest::mouseClick(mMainWindow, mView, uncatDestination, waitTime);
+    QTest::qWait(500);
+    
+    // Activate context menu
+    HbAutoTest::mouseClick(mMainWindow, mView, uncatAp, 700);
+    QTest::qWait(50);
+    
+    // Select move
+    HbAutoTest::mouseClick(mMainWindow, mView, uncatMenuMove, waitTime);
+    QTest::qWait(300);
+    
+    // Select ok
+    HbAutoTest::mouseClick(mMainWindow, mView, destDialogOk, waitTime);
+    QTest::qWait(2000);
+    
+    // Back to destination view
+    subClickWidget(navigationButton);
+    QTest::qWait(500);
+}
+
+void TestCpDestinationPlugin::tcShareDeleteAp()
+{
+    // Open Internet destination
+    HbAutoTest::mouseClick(mMainWindow, mView, internetDestination, waitTime);
+    QTest::qWait(500);
+      
+    // Activate context menu
+    HbAutoTest::mouseClick(mMainWindow, mView, internetFirstAp, 700);
+    QTest::qWait(50);
+      
+    // Select share
+    HbAutoTest::mouseClick(mMainWindow, mView, internetFirstApShare, waitTime);
+    QTest::qWait(300);
+      
+    // Select ok
+    HbAutoTest::mouseClick(mMainWindow, mView, destDialogOk, waitTime);
+    QTest::qWait(2000);
+    
+    // Activate context menu
+    HbAutoTest::mouseClick(mMainWindow, mView, internetFirstAp, 700);
+    QTest::qWait(50);
+          
+    // Select share
+    HbAutoTest::mouseClick(mMainWindow, mView, internetFirstApDelete, waitTime);
+    QTest::qWait(300);
+          
+    // Select ok
+    HbAutoTest::mouseClick(mMainWindow, mView, deleteDialogOk, waitTime);
+    QTest::qWait(2000);
+      
+    // Back to destination view
+    subClickWidget(navigationButton);
+    QTest::qWait(500);
+}
+
+void TestCpDestinationPlugin::tcAddDestination()
+{
+    // Add Destination
+    HbAutoTest::mouseClick(mMainWindow, mView, addDestination, waitTime);
+    QTest::qWait(500);
+      
+    // Click OK -> Error note
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
+    QTest::qWait(500);
+    
+    // Click OK -> errorNote disappears
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
+    QTest::qWait(500);
+    
+    // Activate keyboard
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialog, waitTime);
+    QTest::qWait(500);
+        
+    // Activate line-edit
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogKb, waitTime);
+    QTest::qWait(500);
+        
+    // Input text
+    HbAutoTest::keyClicks(mMainWindow, "Internet", 0, waitTime);
+    QTest::qWait(2000);
+          
+    // Select ok
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogOkKb, waitTime);
+    QTest::qWait(500);
+        
+    // Select ok again -> Error note
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
+    QTest::qWait(500);
+        
+    // Click OK -> errorNote disappears
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
+    QTest::qWait(500);
+    
+    // Activate keyboard
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialog, waitTime);
+    QTest::qWait(500);
+    
+    // Activate line-edit
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogKb, waitTime);
+    QTest::qWait(500);
+    
+    // Input text
+    HbAutoTest::keyClicks(mMainWindow, "foo", 0, waitTime);
+    QTest::qWait(2000);
+      
+    // Select ok
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogOkKb, waitTime);
+    QTest::qWait(500);
+    
+    // Select ok again
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
+    QTest::qWait(500);
+}
+
+void TestCpDestinationPlugin::tcDestinationRename()
+{
+    // Open context menu
+    HbAutoTest::mouseClick(mMainWindow, mView, addDestination, 700);
+    QTest::qWait(50);
+      
+    // Click OK -> Error note
+    HbAutoTest::mouseClick(mMainWindow, mView, newDestinationRename, waitTime);
+    QTest::qWait(300);
+    
+    // Click OK -> error note shown
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
+    QTest::qWait(300);
+    
+    // Click OK -> errorNote disappears
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
+    QTest::qWait(500);
+    
+    // Activate keyboard
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialog, waitTime);
+    QTest::qWait(500);
+    
+    // Activate line-edit
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogKb, waitTime);
+    QTest::qWait(500);
+    
+    // Input text
+    HbAutoTest::keyClicks(mMainWindow, "Internet", 0, waitTime);
+    QTest::qWait(2000);
+      
+    // Select ok
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogOkKb, waitTime);
+    QTest::qWait(500);
+    
+    // Select ok again -> Error note
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
+    QTest::qWait(500);
+    
+    // Click OK -> errorNote disappears
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
+    QTest::qWait(500);
+        
+    // Activate keyboard
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialog, waitTime);
+    QTest::qWait(500);
+        
+    // Activate line-edit
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogKb, waitTime);
+    QTest::qWait(500);
+        
+    // Input text
+    HbAutoTest::keyClicks(mMainWindow, "bar", 0, waitTime);
+    QTest::qWait(2000);
+          
+    // Select ok
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogOkKb, waitTime);
+    QTest::qWait(500);
+        
+    // Select ok again
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
+    QTest::qWait(500);
+    
+    // TODO: remove
+    subClickWidget(navigationButton);
+    QTest::qWait(500);
+}
+
+void TestCpDestinationPlugin::tcDestinationDelete()
+{
+    // Open context menu
+    HbAutoTest::mouseClick(mMainWindow, mView, addDestination, 700);
+    QTest::qWait(50);
+      
+    // Click OK -> Error note
+    HbAutoTest::mouseClick(mMainWindow, mView, newDestinationDelete, waitTime);
+    QTest::qWait(300);
+    
+    // Click OK -> error note shown
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
+    QTest::qWait(1000);  
+  
+    // TODO: remove
+    subClickWidget(navigationButton);
+    QTest::qWait(500);
+}
+
+void TestCpDestinationPlugin::tcCreateAndDeleteDestination()
+{
+    // Add Destination
+    HbAutoTest::mouseClick(mMainWindow, mView, addDestination, waitTime);
+    QTest::qWait(500);
+    
+    // Activate keyboard
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialog, waitTime);
+    QTest::qWait(500);
+    
+    // Activate line-edit
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogKb, waitTime);
+    QTest::qWait(500);
+    
+    // Input text
+    HbAutoTest::keyClicks(mMainWindow, "foo", 0, waitTime);
+    QTest::qWait(2000);
+      
+    // Select ok
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogOkKb, waitTime);
+    QTest::qWait(500);
+    
+    // Select ok again
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
+    QTest::qWait(500);
+    
+    // Open Internet destination
+    HbAutoTest::mouseClick(mMainWindow, mView, internetDestination, waitTime);
+    QTest::qWait(500);
+          
+    // Activate context menu
+    HbAutoTest::mouseClick(mMainWindow, mView, internetFirstAp, 700);
+    QTest::qWait(50);
+          
+    // Select move
+    HbAutoTest::mouseClick(mMainWindow, mView, internetFirstApMove, waitTime);
+    QTest::qWait(300);
+    
+    // Select destination
+    HbAutoTest::mouseClick(mMainWindow, mView, destDialogNewDest, waitTime);
+    QTest::qWait(300);
+    
+    // Select ok
+    HbAutoTest::mouseClick(mMainWindow, mView, destDialogOk, waitTime);
+    QTest::qWait(2000);
+    
+    // Back to destination view
+    subClickWidget(navigationButton);
+    QTest::qWait(500);
+    
+    // Open context menu
+    HbAutoTest::mouseClick(mMainWindow, mView, addDestination, 700);
+    QTest::qWait(50);
+      
+    // Click OK -> Error note
+    HbAutoTest::mouseClick(mMainWindow, mView, newDestinationDelete, waitTime);
+    QTest::qWait(300);
+    
+    // Click OK -> error note shown
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
+    QTest::qWait(1000);  
+  
+    // TODO: remove
+    subClickWidget(navigationButton);
+    QTest::qWait(500);
+}
+
+void TestCpDestinationPlugin::tcOpenDestinations()
+{
+    // Open uncategorised aps
+    HbAutoTest::mouseClick(mMainWindow, mView, secondDestination, waitTime);
+    QTest::qWait(500);
+    
+    // Back to destination view
+    subClickWidget(navigationButton);
+    QTest::qWait(500);
+    
+    // Open uncategorised aps
+    HbAutoTest::mouseClick(mMainWindow, mView, thirdDestination, waitTime);
+    QTest::qWait(500);
+    
+    // Back to destination view
+    subClickWidget(navigationButton);
+    QTest::qWait(500);
+    
+    // Open uncategorised aps
+    HbAutoTest::mouseClick(mMainWindow, mView, fourthDestination, waitTime);
+    QTest::qWait(500);
+    
+    // Back to destination view
+    subClickWidget(navigationButton);
+    QTest::qWait(500);
+    
+    // Activate context menu
+    HbAutoTest::mouseClick(mMainWindow, mView, uncatAp, 700);
+    QTest::qWait(50);
+    
+    // TODO: remove
+    subClickWidget(navigationButton);
+    QTest::qWait(500);
+}
+
+void TestCpDestinationPlugin::tcDeleteUncat()
+{   
+    // Open uncategorised aps
+    HbAutoTest::mouseClick(mMainWindow, mView, uncatDestination, waitTime);
+    QTest::qWait(500);
+    
+    // Activate context menu
+    HbAutoTest::mouseClick(mMainWindow, mView, uncatAp, 700);
+    QTest::qWait(50);
+    
+    // Select move
+    HbAutoTest::mouseClick(mMainWindow, mView, uncatMenuDelete, waitTime);
+    QTest::qWait(500);
+    
+    // Select ok
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
+    QTest::qWait(2000);
+    
+    // Back to destination view
+    subClickWidget(navigationButton);
+    QTest::qWait(500);
+}
+
+void TestCpDestinationPlugin::tcMoveProtected()
+{   
+    // Open Internet destination
+    HbAutoTest::mouseClick(mMainWindow, mView, internetDestination, waitTime);
+    QTest::qWait(500);
+          
+    // Activate context menu
+    HbAutoTest::mouseClick(mMainWindow, mView, internetFirstAp, 700);
+    QTest::qWait(50);
+          
+    // Select move
+    HbAutoTest::mouseClick(mMainWindow, mView, internetFirstApMove, waitTime);
+    QTest::qWait(300);
+    
+    // Select destination
+    HbAutoTest::mouseClick(mMainWindow, mView, destDialogSecond, waitTime);
+    QTest::qWait(300);
+    
+    // Select ok
+    HbAutoTest::mouseClick(mMainWindow, mView, destDialogOk, waitTime);
+    QTest::qWait(2000);
+    
+    HbAutoTest::mouseClick(mMainWindow, mView, addDialogOk, waitTime);
+    QTest::qWait(2000);
+    
+    // Back to destination view
+    subClickWidget(navigationButton);
+    QTest::qWait(500);
+}
+
+// -----------------------------------------------------------------------------
+// SUB TEST CASES
+// -----------------------------------------------------------------------------
+
+void TestCpDestinationPlugin::subCreateSettingsView()
+{
+    // Create settings view
+    HbView *view = new HbView();
+    CpItemDataHelper *itemDataHelper = new CpItemDataHelper();
+    itemDataHelper->setParent(view);
+    HbDataForm *form = new HbDataForm();
+    HbDataFormModel *model = new HbDataFormModel;
+    CpPluginUtility::addCpItemPrototype(form);
+    QList<CpSettingFormItemData *> list = mPlugin->createSettingFormItemData(*itemDataHelper);
+    HbDataFormModelItem *modelItem = NULL;
+    modelItem = list[0];
+    model->appendDataFormItem(modelItem);
+    form->setModel(model);
+    model->setParent(form);
+    view->setWidget(form);
+    itemDataHelper->bindToForm(form);
+    
+    // Display the view
+    // TODO: connect aboutToClose() signal
+    mMainWindow->addView(view);
+    mMainWindow->setCurrentView(view); 
+    
+    mView = view;
+}
+
+void TestCpDestinationPlugin::subClickWidget(const QString &name)
+{
+    QList<QGraphicsItem *> itemList = mMainWindow->scene()->items();
+
+    QGraphicsItem *target = 0;
+    foreach (QGraphicsItem* item, itemList) {
+        if (item->isWidget()) {
+            QString widgetClassName(static_cast<QGraphicsWidget*>(item)->metaObject()->className());
+            qDebug() << widgetClassName;
+            
+            if (widgetClassName == name) {
+                target = item;
+                //break;
+            }
+        }
+    }
+
+    Q_ASSERT(target);
+    HbAutoTest::mouseClick(mMainWindow, static_cast<HbWidget *>(target));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cpdestinationplugin/tsrc/ut/testcpdestinationplugin.h	Wed Jun 23 17:49:20 2010 +0100
@@ -0,0 +1,71 @@
+/*
+* 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:
+* Control Panel WLAN AP plugin unit testing.
+*/
+
+#include <QStringList>
+#include <QtTest/QtTest>
+#include <cmmanagerdefines_shim.h>
+
+//#include "cmapplsettingsui.h"
+
+class HbDialog;
+class HbMainWindow;
+class HbAutoTestMainWindow;
+class HbDataFormModelItem;
+class CpBearerApPluginInterface;
+class CpPluginInterface;
+class HbView;
+
+class TestCpDestinationPlugin : public QObject
+{
+    Q_OBJECT
+
+    public slots:
+        // Test framework functions
+        void initTestCase();
+        void cleanupTestCase();
+        void init();
+        void cleanup();
+
+    private slots:
+        // Test cases
+        void tcArrangeAps();
+        void tcMoveAp();
+        void tcShareDeleteAp();
+        void tcAddDestination();
+        void tcDestinationRename();
+        void tcDestinationDelete();
+        void tcCreateAndDeleteDestination();
+        void tcDeleteUncat();
+        void tcOpenDestinations();
+
+    private:
+        // Sub test cases
+        void subCreateSettingsView();
+        void subClickWidget(const QString &name);
+        
+        // Not Run cases
+        void tcMoveProtected();
+        
+
+    private:
+        // Code references
+        
+        // Test data
+        HbAutoTestMainWindow              *mMainWindow;
+        QSharedPointer<CpPluginInterface> mPlugin;
+        HbView                            *mView;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cpdestinationplugin/tsrc/ut/testcpdestinationplugin.pro	Wed Jun 23 17:49:20 2010 +0100
@@ -0,0 +1,46 @@
+#
+# 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:
+# Project file for Control Panel Destination plugin unit tests.
+
+TEMPLATE = app
+
+TARGET = testcpdestinationplugin
+
+CONFIG += hb qtestlib
+
+INCLUDEPATH += . ../../inc
+DEPENDPATH += .
+
+HEADERS += \
+    hbautotest.h \
+    testcpdestinationplugin.h
+SOURCES += \
+    hbautotest.cpp \
+    testcpdestinationplugin.cpp
+
+LIBS += \
+    -lcpdestinationplugin \
+    -lconnection_settings_shim \
+    -lcpframework
+    
+#    -lconnection_settings_shim \
+#    -lcmmanager
+#    -lcommsdat \
+#    -lcommdb \
+#    -lecom
+
+symbian: {
+    TARGET.CAPABILITY = ALL -TCB
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cpdestinationplugin/tsrc/ut/tools/commsdat_restore.bat	Wed Jun 23 17:49:20 2010 +0100
@@ -0,0 +1,17 @@
+@rem
+@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+@rem All rights reserved.
+@rem This component and the accompanying materials are made available
+@rem under the terms of "Eclipse Public License v1.0"
+@rem which accompanies this distribution, and is available
+@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+@rem
+@rem Initial Contributors:
+@rem Nokia Corporation - initial contribution.
+@rem
+@rem Contributors:
+@rem
+@rem Description:
+@rem Script for restoring backup of commsdat.
+
+copy backup\cccccc00.cre \epoc32\winscw\c\private\10202be9\persists\cccccc00.cre
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cpdestinationplugin/tsrc/ut/tools/commsdat_set.bat	Wed Jun 23 17:49:20 2010 +0100
@@ -0,0 +1,19 @@
+@rem
+@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+@rem All rights reserved.
+@rem This component and the accompanying materials are made available
+@rem under the terms of "Eclipse Public License v1.0"
+@rem which accompanies this distribution, and is available
+@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+@rem
+@rem Initial Contributors:
+@rem Nokia Corporation - initial contribution.
+@rem
+@rem Contributors:
+@rem
+@rem Description:
+@rem Script for setting test commsdat.
+
+md backup
+copy \epoc32\winscw\c\private\10202be9\persists\cccccc00.cre backup\
+copy default.cre \epoc32\winscw\c\private\10202be9\persists\cccccc00.cre
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cpdestinationplugin/tsrc/ut/tools/cpdestinationplugin_ctc.bat	Wed Jun 23 17:49:20 2010 +0100
@@ -0,0 +1,92 @@
+::
+:: 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:
+:: Script running Control Panel Destination plugin test cases with CTC analysis.
+
+@echo off
+
+:: -----------------------------------------------------------------------------
+:: Instructions
+:: -----------------------------------------------------------------------------
+:: 
+:: Remember to use the test CommsDat that can be set and restored with the
+:: helper scripts:
+:: - commsdat_set.bat
+:: - commsdat_restore.bat
+
+call .\commsdat_set.bat
+
+::-----------------------------------------------------------------------------
+:: Set the local variables
+::-----------------------------------------------------------------------------
+
+:: Control Panel Destination plugin base directory
+set cpdestinationplugin_dir=..\..\..
+pushd %cpdestinationplugin_dir%
+
+:: CTC instrumentation excludes
+set ctc_excludes=-C EXCLUDE=* -C NO_EXCLUDE=src\*.cpp -C SKIP_FUNCTION_NAME=CpAddDestinationEntryItemData::createSettingView,CpDestinationEntryItemData::showErrorNote,CpIapItem::showErrorNote
+
+::-----------------------------------------------------------------------------
+:: Remove old coverage data
+::-----------------------------------------------------------------------------
+
+echo Cleaning up...
+del MON.* ctcerr.txt profile.txt
+rd /s /q CTCHTML
+echo ...done
+
+::-----------------------------------------------------------------------------
+:: Build & instrument code
+::-----------------------------------------------------------------------------
+
+echo Building code and instrumenting..
+call del MON.* ctcerr.txt profile.txt
+call make distclean
+call qmake
+call ctcwrap -i d -2comp %ctc_excludes% sbs -c winscw_udeb
+echo ...done
+
+::-----------------------------------------------------------------------------
+:: Build test code
+::-----------------------------------------------------------------------------
+
+echo Building test code...
+call cd tsrc\ut
+call make distclean
+call qmake
+call sbs -c winscw_udeb
+echo ...done
+
+::-----------------------------------------------------------------------------
+:: Execute the tests
+::-----------------------------------------------------------------------------
+
+echo Running tests..
+cd ..\..
+call \epoc32\release\winscw\udeb\testcpdestinationplugin.exe
+echo ...done
+
+::-----------------------------------------------------------------------------
+:: Create coverage results
+::-----------------------------------------------------------------------------
+
+echo Creating results...
+call ctcpost -p profile.txt
+call ctc2html -i profile.txt
+echo ...done
+
+call .\commsdat_restore.bat
+
+popd
Binary file cmmanager/cpdestinationplugin/tsrc/ut/tools/default.cre has changed
--- a/cmmanager/cpipsettingsplugin/inc/cpipsettingsplugin.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cpipsettingsplugin/inc/cpipsettingsplugin.h	Wed Jun 23 17:49:20 2010 +0100
@@ -12,6 +12,7 @@
 * Contributors:
 *
 * Description:  
+* Control Panel "Network Settings" plugin header file.
 *   
 */
 
@@ -20,12 +21,13 @@
 
 // System includes
 #include <QObject>
+#include <QSharedPointer>
 #include <cpplugininterface.h>
 
 // User includes
 
 // Forward declarations
-class QTranslator;
+class HbTranslator;
 
 // External data types
 
@@ -51,11 +53,13 @@
 protected slots:
 
 private:
+    Q_DISABLE_COPY(CpIpSettingsPlugin)
 
 private slots:
     
 private: // data
-    QTranslator *mTranslator;
+    //! Translator instance
+    QSharedPointer<HbTranslator> mTranslator;
 };
 
 #endif // CPIPSETTINGSPLUGIN_H
--- a/cmmanager/cpipsettingsplugin/inc/cpipsettingsview.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cpipsettingsplugin/inc/cpipsettingsview.h	Wed Jun 23 17:49:20 2010 +0100
@@ -47,6 +47,7 @@
 protected slots:
 
 private:
+    Q_DISABLE_COPY(CpIpSettingsView)
 
 private slots:
     
--- a/cmmanager/cpipsettingsplugin/src/cpipsettingsplugin.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cpipsettingsplugin/src/cpipsettingsplugin.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -12,13 +12,12 @@
 * Contributors:
 *
 * Description:  
+* Control Panel "Network Settings" plugin implementation.
 *
 */
 
 // System includes
-#include <QApplication>
-#include <QLocale>
-#include <QTranslator>
+#include <HbTranslator>
 #include <cpsettingformentryitemdataimpl.h>
 
 // User includes
@@ -42,14 +41,9 @@
 /*!
     Constructor.
 */
-CpIpSettingsPlugin::CpIpSettingsPlugin()
+CpIpSettingsPlugin::CpIpSettingsPlugin() :
+    mTranslator(new HbTranslator("cpipsettingsplugin"))
 {
-    // Install localization
-    QString lang = QLocale::system().name();
-    QString path = "z:/resource/qt/translations/";
-    mTranslator = new QTranslator(this);
-    mTranslator->load(path + "cpipsettingsplugin_" + lang);
-    qApp->installTranslator(mTranslator);
 }
 
 /*!
--- a/cmmanager/cppacketdataapplugin/cppacketdataapplugin.pro	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cppacketdataapplugin/cppacketdataapplugin.pro	Wed Jun 23 17:49:20 2010 +0100
@@ -20,6 +20,12 @@
 DEPENDPATH += .
 INCLUDEPATH += .
 
+# Temporary solution to fix tracecompiler
+# When tracecompiler is fixed, this can be removed
+symbian: {
+    MMP_RULES += "USERINCLUDE traces"
+}
+
 CONFIG += hb plugin
 
 MOC_DIR = moc
@@ -37,6 +43,9 @@
            src/cppacketdataapview.cpp \
            src/cppacketdataapadvancedview.cpp
 
+# Include plugin utilities
+include(../cppluginutils/cppluginutils.pri)
+
 TRANSLATIONS = cpapplugin.ts
 
 symbian:
--- a/cmmanager/cppacketdataapplugin/inc/cppacketdataapadvancedview.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cppacketdataapplugin/inc/cppacketdataapadvancedview.h	Wed Jun 23 17:49:20 2010 +0100
@@ -20,13 +20,17 @@
 #define CPPACKETDATAAPADVANCEDVIEW_H
 
 // System includes
+#include <QAbstractSocket>
+#include <HbMessageBox>
 #include <cpbasesettingview.h>
+#include <cmmanagerdefines_shim.h>
 
 // User includes
 
 // Forward declarations
 class HbDataForm;
 class HbDataFormModel;
+class HbDataFormModelItem;
 class CmConnectionMethodShim;
 
 // External data types
@@ -53,9 +57,59 @@
 protected slots:
  
 private:
+    Q_DISABLE_COPY(CpPacketDataApAdvancedView)
+
+    //! Network type
+    enum NetworkType {
+        NetworkTypeIpv4 = 0,
+        NetworkTypeIpv6
+    };
+
+    //! IPv6 DNS type
+    enum Ipv6DnsType {
+        Ipv6DnsTypeAutomatic = 0,
+        Ipv6DnsTypeWellKnown,
+        Ipv6DnsTypeUserDefined
+    };
+    
     void createAdvancedSettings();
+    void createIpGroup();
+    void updateIpGroup();
+    void createIpv4SettingItems();
+    void deleteIpv4SettingItems();
+    void createIpv6SettingItems();
+    void deleteIpv6SettingItems();
+    void createProxyGroup();
+    void updateProxyGroup();
+    NetworkType getNetworkType();
+    QString getIpAddress(CMManagerShim::ConnectionMethodAttribute attribute);
+    Ipv6DnsType getIpv6DnsType();
+    void enableIpv4AddressFields(int state);
+    void enableIpv4DnsFields(int state);
+    void enableIpv6DnsFields(int selectionIndex);
+    bool validateAndSaveIpAddress(
+        HbDataFormModelItem *item,
+        CMManagerShim::ConnectionMethodAttribute attribute,
+        QAbstractSocket::NetworkLayerProtocol protocol);
+    void showMessageBox(
+        HbMessageBox::MessageBoxType type,
+        const QString &text);
+    bool tryUpdate();
+    void handleUpdateError();
     
 private slots:
+    void setEditorPreferences(const QModelIndex index);
+    void changeNetworkType(int type);
+    void changeIpv4AddressMode(int state);
+    void changeIpv4Address();
+    void changeIpv4DnsMode(int state);
+    void changeIpv4PrimaryDnsAddress();
+    void changeIpv4SecondaryDnsAddress();
+    void changeIpv6DnsMode(int selectionIndex);
+    void changeIpv6PrimaryDnsAddress();
+    void changeIpv6SecondaryDnsAddress();
+    void changeProxyServer();
+    void changeProxyPort();
     
 private: // data
     //! Dataform
@@ -64,6 +118,38 @@
     HbDataFormModel *mModel;
     //! Connection Settings Shim connection method pointer
     CmConnectionMethodShim *mCmConnectionMethod;
+    //! "IP settings" group
+    HbDataFormModelItem *mIpGroup;
+    //! "Network type" (IPv4/IPv6) setting item
+    HbDataFormModelItem *mNetworkType;
+    //! "Automatic" setting item for phone IP address
+    HbDataFormModelItem *mIpv4Automatic;
+    //! "Phone IP address" setting item
+    HbDataFormModelItem *mIpv4Address;
+    //! "Automatic" setting item for IPv4 DNS addresses
+    HbDataFormModelItem *mIpv4DnsAutomatic;
+    //! "Primary name server" setting item
+    HbDataFormModelItem *mIpv4DnsAddress1;
+    //! "Secondary name server" setting item
+    HbDataFormModelItem *mIpv4DnsAddress2;
+    //! "Automatic" setting item for IPv6 DNS addresses
+    HbDataFormModelItem *mIpv6DnsAutomatic;
+    //! "Primary name server" setting item
+    HbDataFormModelItem *mIpv6DnsAddress1;
+    //! "Secondary name server" setting item
+    HbDataFormModelItem *mIpv6DnsAddress2;
+    //! "Proxy settings" group
+    HbDataFormModelItem *mProxyGroup;
+    //! "Proxy server address" setting item
+    HbDataFormModelItem *mProxyServer;
+    //! "Proxy port number" setting item
+    HbDataFormModelItem *mProxyPort;
+    //! Message box for info notes
+    QSharedPointer<HbMessageBox> mMessageBox;
+    //! Flag for IPv6 support
+    bool mIpv6Supported;
+    //! Current network type (IPv4/IPv6)
+    NetworkType mCurrentNetworkType;
 };
 
 #endif // CPPACKETDATAAPADVANCEDVIEW_H
--- a/cmmanager/cppacketdataapplugin/inc/cppacketdataapplugin.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cppacketdataapplugin/inc/cppacketdataapplugin.h	Wed Jun 23 17:49:20 2010 +0100
@@ -21,12 +21,13 @@
 
 // System includes
 #include <QObject>
+#include <QSharedPointer>
 #include <cpbearerapplugininterface.h>
 
 // User includes
 
 // Forward declarations
-class QTranslator;
+class HbTranslator;
 class CmManagerShim;
 class CmConnectionMethodShim;
 
@@ -56,12 +57,13 @@
 protected slots:
 
 private:
+    Q_DISABLE_COPY(CpPacketDataApPlugin)
 
 private slots:
     
 private: // data
     //! Translator instance
-    QTranslator *mTranslator;
+    QSharedPointer<HbTranslator> mTranslator;
     //! CM Manager Shim instance
     CmManagerShim *mCmManager;
     //! CM Connection Method Shim instance
--- a/cmmanager/cppacketdataapplugin/inc/cppacketdataapview.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cppacketdataapplugin/inc/cppacketdataapview.h	Wed Jun 23 17:49:20 2010 +0100
@@ -59,6 +59,8 @@
 protected slots:
  
 private:
+    Q_DISABLE_COPY(CpPacketDataApView)
+    
     void createAccessPointSettingsGroup();
     void updateAccessPointSettingsGroup();
     void showMessageBox(
--- a/cmmanager/cppacketdataapplugin/src/cppacketdataapadvancedview.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cppacketdataapplugin/src/cppacketdataapadvancedview.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -17,14 +17,31 @@
 */
 
 // System includes
+#include <QHostAddress>
+#include <HbCheckBox>
+#include <HbLineEdit>
+#include <HbDataFormViewItem>
+#include <HbWidget>
+#include <HbEditorInterface>
+#include <HbUrlFilter>
+#include <HbInputDialog>
 #include <HbDataForm>
 #include <HbDataFormModel>
+#include <cmconnectionmethod_shim.h>
+#include <cmmanagerdefines_shim.h>
 #include <cpsettingformitemdata.h>
-#include <cmconnectionmethod_shim.h>
+#include <etelpckt.h>
 
 // User includes
+#include "cpipv4filter.h"
+#include "cpipv6filter.h"
 #include "cppacketdataapadvancedview.h"
 
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cppacketdataapadvancedviewTraces.h"
+#endif
+
 /*!
     \class CpPacketDataApAdvancedView
     \brief Implements the advanced settings view for packet data bearer
@@ -48,16 +65,39 @@
         CpBaseSettingView(0, parent),
         mForm(0),
         mModel(0),
-        mCmConnectionMethod(cmConnectionMethod)
+        mCmConnectionMethod(cmConnectionMethod),
+        mIpGroup(0),
+        mNetworkType(0),
+        mIpv4Automatic(0),
+        mIpv4Address(0),
+        mIpv4DnsAutomatic(0),
+        mIpv4DnsAddress1(0),
+        mIpv4DnsAddress2(0),
+        mIpv6DnsAutomatic(0),
+        mIpv6DnsAddress1(0),
+        mIpv6DnsAddress2(0),
+        mProxyGroup(0),
+        mProxyServer(0),
+        mProxyPort(0),
+        mMessageBox(0),
+        mIpv6Supported(false),
+        mCurrentNetworkType(NetworkTypeIpv4)
 {
-    // Construct packet data AP settings UI
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CPPACKETDATAAPADVANCEDVIEW_ENTRY);
+    
+    // Construct packet data AP advanced settings UI
     mForm = new HbDataForm();
     this->setWidget(mForm);
     mModel = new HbDataFormModel(mForm);
     mForm->setModel(mModel);
-    
+
+    mIpv6Supported = mCmConnectionMethod->getBoolAttribute(
+        CMManagerShim::CmIPv6Supported);
+        
     // Add advanced settings groups
     createAdvancedSettings();
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CPPACKETDATAAPADVANCEDVIEW_EXIT);
 }
 
 /*!
@@ -65,12 +105,1104 @@
 */
 CpPacketDataApAdvancedView::~CpPacketDataApAdvancedView()
 {
+    OstTraceFunctionEntry0(DUP1_CPPACKETDATAAPADVANCEDVIEW_CPPACKETDATAAPADVANCEDVIEW_ENTRY);
+    
+    OstTraceFunctionExit0(DUP1_CPPACKETDATAAPADVANCEDVIEW_CPPACKETDATAAPADVANCEDVIEW_EXIT);
+}
+
+/*!
+    Creates all advanced settings groups.
+*/
+void CpPacketDataApAdvancedView::createAdvancedSettings()
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CREATEADVANCEDSETTINGS_ENTRY);
+    
+    // Create settings groups
+    createIpGroup();
+    createProxyGroup();
+    
+    // Read values and update UI
+    updateIpGroup();
+    updateProxyGroup();
+    
+    // Connect signal to initialize settings item widgets
+    bool status = connect(
+        mForm,
+        SIGNAL(itemShown(const QModelIndex)),
+        this,
+        SLOT(setEditorPreferences(const QModelIndex)));
+    Q_ASSERT(status);
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CREATEADVANCEDSETTINGS_EXIT);
+}
+
+/*!
+    Creates the IP settings group.
+*/
+void CpPacketDataApAdvancedView::createIpGroup()
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CREATEIPGROUP_ENTRY);
+    
+    // IP settings group
+    mIpGroup = new CpSettingFormItemData(
+        HbDataFormModelItem::GroupItem,
+        hbTrId("txt_occ_subhead_ip_settings"));
+    mModel->appendDataFormItem(mIpGroup);
+    
+    if (mIpv6Supported) {
+        // IPv6 supported
+        // Network type
+        mNetworkType = new CpSettingFormItemData(
+            HbDataFormModelItem::ComboBoxItem,
+            hbTrId("txt_occ_setlabel_network_type"));
+        QStringList networkTypeList;
+        networkTypeList
+            << hbTrId("txt_occ_setlabel_network_type_val_ipv4")
+            << hbTrId("txt_occ_setlabel_network_type_val_ipv6");
+        mNetworkType->setContentWidgetData("items", networkTypeList);
+        mForm->addConnection(
+            mNetworkType,
+            SIGNAL(currentIndexChanged(int)),
+            this,
+            SLOT(changeNetworkType(int)));
+        mIpGroup->appendChild(mNetworkType);
+        
+        mCurrentNetworkType = getNetworkType();
+        if (mCurrentNetworkType == NetworkTypeIpv4) {
+            // IPv4
+            createIpv4SettingItems();
+        } else {
+            // IPv6
+            createIpv6SettingItems();
+        }
+    } else {
+        // IPv6 not supported, create IPv4 settings items
+        createIpv4SettingItems();
+    }
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CREATEIPGROUP_EXIT);
+}
+
+/*!
+    Reads attribute values and updates the IP settings group.
+*/
+void CpPacketDataApAdvancedView::updateIpGroup()
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_UPDATEIPGROUP_ENTRY);
+    
+    // Network type
+    if (mNetworkType) {
+        // Every time update is called we check if network type (IPv4/IPv6)
+        // has changed and update items on UI if necessary.
+    
+        // Get network type from CommsDat
+        NetworkType newNetworkType = getNetworkType();
+        if (newNetworkType != mCurrentNetworkType) {
+            // Network type has changed, update UI
+            if (newNetworkType == NetworkTypeIpv6) {
+                // IPv4 -> IPv6
+                deleteIpv4SettingItems();
+                createIpv6SettingItems();
+            } else {
+                // IPv6 -> IPv4
+                deleteIpv6SettingItems();
+                createIpv4SettingItems();
+            }
+            mCurrentNetworkType = newNetworkType;
+        }
+        mNetworkType->setContentWidgetData("currentIndex", newNetworkType);
+    }
+    
+    // Phone IP address (IPv4)
+    // "Automatic" checkbox
+    if (mIpv4Automatic) {
+        bool ipAddressFromServer = mCmConnectionMethod->getBoolAttribute(
+            CMManagerShim::PacketDataIPAddrFromServer);
+        Qt::CheckState state = Qt::Unchecked;
+        if (ipAddressFromServer) {
+            state = Qt::Checked;
+        }
+        mIpv4Automatic->setContentWidgetData("checkState", state);
+
+        // Enable/disable user defined IP address fields
+        enableIpv4AddressFields(state);
+    }
+
+    // Phone IP address (IPv4)
+    if (mIpv4Address) {
+        QString string = getIpAddress(CMManagerShim::CmIPAddress);
+        mIpv4Address->setContentWidgetData("text", string);
+    }
+    
+    // IPv4 DNS addresses
+    // "Automatic" checkbox
+    if (mIpv4DnsAutomatic) {
+        Qt::CheckState state = Qt::Unchecked;
+        if (mCmConnectionMethod->getBoolAttribute(
+            CMManagerShim::CmIPDNSAddrFromServer)) {
+            state = Qt::Checked;
+        }
+        mIpv4DnsAutomatic->setContentWidgetData("checkState", state);
+
+        // Enable/disable user defined DNS address fields
+        enableIpv4DnsFields(state);
+    }
+    
+    // IPv4 primary DNS address
+    if (mIpv4DnsAddress1) {
+        QString string = getIpAddress(CMManagerShim::CmIPNameServer1);
+        mIpv4DnsAddress1->setContentWidgetData("text", string);
+    }
+    
+    // IPv4 secondary DNS address
+    if (mIpv4DnsAddress2) {
+        QString string = getIpAddress(CMManagerShim::CmIPNameServer2);
+        mIpv4DnsAddress2->setContentWidgetData("text", string);
+    }
+    
+    // IPv6 DNS addresses
+    // Automatic/well-known/user defined combobox
+    if (mIpv6DnsAutomatic) {
+        uint type = getIpv6DnsType();
+        mIpv6DnsAutomatic->setContentWidgetData("currentIndex", type);
+
+        // Enable/disable user defined DNS address fields
+        enableIpv6DnsFields(type);
+    }
+    
+    // IPv6 primary DNS address
+    if (mIpv6DnsAddress1) {
+        QString string = getIpAddress(CMManagerShim::CmIP6NameServer1);
+        mIpv6DnsAddress1->setContentWidgetData("text", string);
+    }
+    
+    // IPv6 secondary DNS address
+    if (mIpv6DnsAddress2) {
+        QString string = getIpAddress(CMManagerShim::CmIP6NameServer2);
+        mIpv6DnsAddress2->setContentWidgetData("text", string);
+    }
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_UPDATEIPGROUP_EXIT);
+}
+
+/*!
+    Creates the IPv4 setting items.
+*/
+void CpPacketDataApAdvancedView::createIpv4SettingItems()
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CREATEIPV4SETTINGITEMS_ENTRY);
+
+    // Phone IP address
+    // "Automatic" checkbox
+    mIpv4Automatic = new CpSettingFormItemData(
+        HbDataFormModelItem::CheckBoxItem,
+        hbTrId("txt_occ_setlabel_phone_ip_address"));
+    mIpv4Automatic->setContentWidgetData(
+        "text",
+        hbTrId("txt_occ_setlabel_val_automatic"));
+    mForm->addConnection(
+        mIpv4Automatic,
+        SIGNAL(stateChanged(int)),
+        this,
+        SLOT(changeIpv4AddressMode(int)));
+    mIpGroup->appendChild(mIpv4Automatic);
+    
+    // Phone IP address
+    mIpv4Address = new CpSettingFormItemData(
+        HbDataFormModelItem::TextItem,
+        hbTrId("txt_occ_setlabel_phone_ip_address"));
+    mForm->addConnection(
+        mIpv4Address,
+        SIGNAL(editingFinished()),
+        this,
+        SLOT(changeIpv4Address()));
+    mIpGroup->appendChild(mIpv4Address);
+    
+    // DNS addresses
+    // "Automatic" checkbox
+    mIpv4DnsAutomatic = new CpSettingFormItemData(
+        HbDataFormModelItem::CheckBoxItem,
+        hbTrId("txt_occ_setlabel_dns_addresses"));
+    mIpv4DnsAutomatic->setContentWidgetData(
+        "text",
+        hbTrId("txt_occ_setlabel_val_automatic"));
+    mForm->addConnection(
+        mIpv4DnsAutomatic,
+        SIGNAL(stateChanged(int)), 
+        this,
+        SLOT(changeIpv4DnsMode(int)));
+    mIpGroup->appendChild(mIpv4DnsAutomatic);
+    
+    // Primary DNS address
+    mIpv4DnsAddress1 = new CpSettingFormItemData(
+        HbDataFormModelItem::TextItem,
+        hbTrId("txt_occ_setlabel_primary_name_server"));
+    mForm->addConnection(
+        mIpv4DnsAddress1,
+        SIGNAL(editingFinished()), 
+        this,
+        SLOT(changeIpv4PrimaryDnsAddress()));
+    mIpGroup->appendChild(mIpv4DnsAddress1);
+    
+    // Secondary DNS address
+    mIpv4DnsAddress2 = new CpSettingFormItemData(
+        HbDataFormModelItem::TextItem,
+        hbTrId("txt_occ_setlabel_secondary_name_server"));
+    mForm->addConnection(
+        mIpv4DnsAddress2,
+        SIGNAL(editingFinished()), 
+        this,
+        SLOT(changeIpv4SecondaryDnsAddress()));
+    mIpGroup->appendChild(mIpv4DnsAddress2);
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CREATEIPV4SETTINGITEMS_EXIT);
+}
+
+/*!
+    Deletes the IPv4 setting items.
+*/
+void CpPacketDataApAdvancedView::deleteIpv4SettingItems()
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_DELETEIPV4SETTINGITEMS_ENTRY);
+
+    // Phone IP address
+    // "Automatic" checkbox
+    if (mIpv4Automatic) {
+        mIpGroup->removeChild(mIpGroup->indexOf(mIpv4Automatic));
+        mIpv4Automatic = NULL;
+    }
+    
+    // Phone IP address
+    if (mIpv4Address) {
+        mIpGroup->removeChild(mIpGroup->indexOf(mIpv4Address));
+        mIpv4Address = NULL;
+    }
+    
+    // DNS addresses
+    // "Automatic" checkbox
+    if (mIpv4DnsAutomatic) {
+        mIpGroup->removeChild(mIpGroup->indexOf(mIpv4DnsAutomatic));
+        mIpv4DnsAutomatic = NULL;
+    }
+    
+    // Primary DNS address
+    if (mIpv4DnsAddress1) {
+        mIpGroup->removeChild(mIpGroup->indexOf(mIpv4DnsAddress1));
+        mIpv4DnsAddress1 = NULL;
+    }
+    
+    // Secondary DNS address
+    if (mIpv4DnsAddress2) {
+        mIpGroup->removeChild(mIpGroup->indexOf(mIpv4DnsAddress2));
+        mIpv4DnsAddress2 = NULL;
+    }
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_DELETEIPV4SETTINGITEMS_EXIT);
+}
+
+/*!
+    Creates the IPv6 setting items.
+*/
+void CpPacketDataApAdvancedView::createIpv6SettingItems()
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CREATEIPV6SETTINGITEMS_ENTRY);
+    
+    // DNS addresses
+    // Automatic/well-known/user defined combobox
+    mIpv6DnsAutomatic = new CpSettingFormItemData(
+        HbDataFormModelItem::ComboBoxItem,
+        hbTrId("txt_occ_setlabel_dns_addresses"));
+    QStringList dnsModeList;
+    // Order of the list must match the Ipv6DnsType enum
+    dnsModeList
+        << hbTrId("txt_occ_setlabel_val_automatic")
+        << hbTrId("txt_occ_setlabel_dns_addresses_val_wellknown")
+        << hbTrId("txt_occ_setlabel_dns_addresses_val_user_defined");
+    mIpv6DnsAutomatic->setContentWidgetData("items", dnsModeList);
+    mForm->addConnection(
+        mIpv6DnsAutomatic,
+        SIGNAL(currentIndexChanged(int)),
+        this,
+        SLOT(changeIpv6DnsMode(int)));
+    mIpGroup->appendChild(mIpv6DnsAutomatic);
+    
+    // Primary DNS address
+    mIpv6DnsAddress1 = new CpSettingFormItemData(
+        HbDataFormModelItem::TextItem,
+        hbTrId("txt_occ_setlabel_primary_name_server"));
+    mForm->addConnection(
+        mIpv6DnsAddress1,
+        SIGNAL(editingFinished()),
+        this,
+        SLOT(changeIpv6PrimaryDnsAddress()));
+    mIpGroup->appendChild(mIpv6DnsAddress1);
+    
+    // Secondary DNS address
+    mIpv6DnsAddress2 = new CpSettingFormItemData(
+        HbDataFormModelItem::TextItem,
+        hbTrId("txt_occ_setlabel_secondary_name_server"));
+    mForm->addConnection(
+        mIpv6DnsAddress2,
+        SIGNAL(editingFinished()),
+        this,
+        SLOT(changeIpv6SecondaryDnsAddress()));  
+    mIpGroup->appendChild(mIpv6DnsAddress2);
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CREATEIPV6SETTINGITEMS_EXIT);
+}
+
+/*!
+    Deletes the IPv6 setting items.
+*/
+void CpPacketDataApAdvancedView::deleteIpv6SettingItems()
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_DELETEIPV6SETTINGITEMS_ENTRY);
+    
+    // DNS addresses
+    // Automatic/well-known/user defined combobox
+    if (mIpv6DnsAutomatic) {
+        mIpGroup->removeChild(mIpGroup->indexOf(mIpv6DnsAutomatic));
+        mIpv6DnsAutomatic = NULL;
+    }
+    
+    // Primary DNS address
+    if (mIpv6DnsAddress1) {
+        mIpGroup->removeChild(mIpGroup->indexOf(mIpv6DnsAddress1));
+        mIpv6DnsAddress1 = NULL;
+    }
+    
+    // Secondary DNS address
+    if (mIpv6DnsAddress2) {
+        mIpGroup->removeChild(mIpGroup->indexOf(mIpv6DnsAddress2));
+        mIpv6DnsAddress2 = NULL;
+    }
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_DELETEIPV6SETTINGITEMS_EXIT);
+}
+
+/*!
+    Creates the proxy settings group.
+*/
+void CpPacketDataApAdvancedView::createProxyGroup()
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CREATEPROXYGROUP_ENTRY);
+    
+    // Proxy settings group
+    mProxyGroup = new CpSettingFormItemData(
+        HbDataFormModelItem::GroupItem, 
+        hbTrId("txt_occ_subhead_proxy_settings"));
+    mModel->appendDataFormItem(mProxyGroup);
+    
+    // Proxy server address
+    mProxyServer = new CpSettingFormItemData(
+        HbDataFormModelItem::TextItem,
+        hbTrId("txt_occ_setlabel_proxy_server_address"));
+    mForm->addConnection(
+        mProxyServer,
+        SIGNAL(editingFinished()),
+        this,
+        SLOT(changeProxyServer()));
+    mProxyGroup->appendChild(mProxyServer);
+    
+    // Proxy port number
+    mProxyPort = new CpSettingFormItemData(
+        HbDataFormModelItem::TextItem,
+        hbTrId("txt_occ_setlabel_proxy_port_number"));
+    mForm->addConnection(
+        mProxyPort,
+        SIGNAL(editingFinished()),
+        this,
+        SLOT(changeProxyPort()));
+    mProxyGroup->appendChild(mProxyPort);
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CREATEPROXYGROUP_EXIT);
+}
+
+/*!
+    Reads attribute values and updates the proxy settings group.
+*/
+void CpPacketDataApAdvancedView::updateProxyGroup()
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_UPDATEPROXYGROUP_ENTRY);
+    
+    // Proxy server address
+    QString serverAddress = mCmConnectionMethod->getStringAttribute(
+        CMManagerShim::CmProxyServerName);
+    mProxyServer->setContentWidgetData("text", serverAddress);
+    
+    // Proxy port number
+    uint portNumber = mCmConnectionMethod->getIntAttribute(
+        CMManagerShim::CmProxyPortNumber);
+    if (portNumber > 0) {
+        mProxyPort->setContentWidgetData("text", QVariant(portNumber));
+    } else {
+        mProxyPort->setContentWidgetData("text", "");
+    }
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_UPDATEPROXYGROUP_EXIT);
+}
+
+/*!
+    Reads network type (IPv4/IPv6) from CommsDat.
+*/
+CpPacketDataApAdvancedView::NetworkType CpPacketDataApAdvancedView::getNetworkType()
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_GETNETWORKTYPE_ENTRY);
+
+    uint networkType = mCmConnectionMethod->getIntAttribute(
+        CMManagerShim::PacketDataPDPType);
+    
+    if (networkType == RPacketContext::EPdpTypeIPv6) {
+        OstTraceFunctionExit0(DUP1_CPPACKETDATAAPADVANCEDVIEW_GETNETWORKTYPE_EXIT);
+        return NetworkTypeIpv6;
+    }
+
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_GETNETWORKTYPE_EXIT);
+    return NetworkTypeIpv4;
+}
+
+/*!
+    Reads an IP address from CommsDat with given attribute. If string is
+    empty, a zero address (0.0.0.0 or 0:0:0:0:0:0:0:0) is returned.
+*/
+QString CpPacketDataApAdvancedView::getIpAddress(
+    CMManagerShim::ConnectionMethodAttribute attribute)
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_GETIPADDRESS_ENTRY);
+    
+    QString ipAddress = mCmConnectionMethod->getStringAttribute(attribute);
+    
+    if (ipAddress.isEmpty()) {
+        // String is empty, return a zero address instead
+        switch (attribute) {
+            case CMManagerShim::CmIPAddress:
+            case CMManagerShim::CmIPNameServer1:
+            case CMManagerShim::CmIPNameServer2:
+                // IPv4 address
+                ipAddress = CMManagerShim::UnspecifiedIpv4Address; 
+                break;
+            
+            case CMManagerShim::CmIP6NameServer1:
+            case CMManagerShim::CmIP6NameServer2:
+                // IPv6 address
+                ipAddress = CMManagerShim::DynamicIpv6Address;
+                break;
+        }
+    }
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_GETIPADDRESS_EXIT);
+    return ipAddress;
+}
+
+/*!
+    Resolves IPv6 DNS address type.
+*/
+CpPacketDataApAdvancedView::Ipv6DnsType CpPacketDataApAdvancedView::getIpv6DnsType()
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_GETIPV6DNSTYPE_ENTRY);
+    
+    // Read "DNS address from server" flag
+    bool dnsAddressFromServer = mCmConnectionMethod->getBoolAttribute(
+        CMManagerShim::CmIP6DNSAddrFromServer);
+    
+    // Read IPv6 DNS addresses from CommsDat
+    QString primaryAddress = mCmConnectionMethod->getStringAttribute(
+        CMManagerShim::CmIP6NameServer1);
+    QString secondaryAddress = mCmConnectionMethod->getStringAttribute(
+        CMManagerShim::CmIP6NameServer2);
+
+    // Resolve IPv6 DNS address type
+    Ipv6DnsType type = Ipv6DnsTypeUserDefined;
+    if (dnsAddressFromServer) {
+        // Automatic
+        type = Ipv6DnsTypeAutomatic;
+    } else if (primaryAddress.toLower() == CMManagerShim::KnownIpv6NameServer1
+        && secondaryAddress.toLower() == CMManagerShim::KnownIpv6NameServer2) {
+        // Well-known IPv6 DNS addresses
+        type = Ipv6DnsTypeWellKnown;
+    }
+
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_GETIPV6DNSTYPE_EXIT);
+    return type;
+}
+
+/*!
+    Sets IPv4 address field enabled/disabled.
+*/
+void CpPacketDataApAdvancedView::enableIpv4AddressFields(int state)
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_ENABLEIPV4ADDRESSFIELDS_ENTRY);
+    
+    if (state == Qt::Checked) {
+        // Automatic, disable text field
+        if (mIpv4Address) {
+            mIpv4Address->setEnabled(false);
+        }
+    } else {
+        // User defined, enable text field
+        if (mIpv4Address) {
+            mIpv4Address->setEnabled(true);
+        }
+    }
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_ENABLEIPV4ADDRESSFIELDS_EXIT);
 }
 
 /*!
-    Adds settings items to the model.
+    Sets IPv4 DNS address fields enabled/disabled.
+*/
+void CpPacketDataApAdvancedView::enableIpv4DnsFields(int state)
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_ENABLEIPV4DNSFIELDS_ENTRY);
+    
+    if (state == Qt::Checked) {
+        // Automatic, disable text fields
+        if (mIpv4DnsAddress1) {
+            mIpv4DnsAddress1->setEnabled(false);
+        }
+        if (mIpv4DnsAddress2) {
+            mIpv4DnsAddress2->setEnabled(false);
+        }
+    } else {
+        // User defined, enable text fields
+        if (mIpv4DnsAddress1) {
+            mIpv4DnsAddress1->setEnabled(true);
+        }
+        if (mIpv4DnsAddress2) {
+            mIpv4DnsAddress2->setEnabled(true);
+        }
+    }
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_ENABLEIPV4DNSFIELDS_EXIT);
+}
+
+/*!
+    Sets IPv6 DNS address fields enabled/disabled.
+*/
+void CpPacketDataApAdvancedView::enableIpv6DnsFields(int selectionIndex)
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_ENABLEIPV6DNSFIELDS_ENTRY);
+    
+    // Check combobox value
+    if (selectionIndex == Ipv6DnsTypeUserDefined) {
+        // User-defined, enable text fields
+        if (mIpv6DnsAddress1) {
+            mIpv6DnsAddress1->setEnabled(true);
+        }
+        if (mIpv6DnsAddress2) {
+            mIpv6DnsAddress2->setEnabled(true);
+        }
+    } else {
+        // Automatic or well-known, disable text fields
+        if (mIpv6DnsAddress1) {
+            mIpv6DnsAddress1->setEnabled(false);
+        }
+        if (mIpv6DnsAddress2) {
+            mIpv6DnsAddress2->setEnabled(false);
+        }
+    }
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_ENABLEIPV6DNSFIELDS_EXIT);
+}
+
+/*!
+    Validates an IP address and saves it to CommsDat in case it was a valid
+    address or an empty string. In case the address is not valid, an error
+    note is shown to the user and previous setting is restored to the UI.
+*/
+bool CpPacketDataApAdvancedView::validateAndSaveIpAddress(
+    HbDataFormModelItem *item,
+    CMManagerShim::ConnectionMethodAttribute attribute,
+    QAbstractSocket::NetworkLayerProtocol protocol)
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_VALIDATEANDSAVEIPADDRESS_ENTRY);
+    
+    bool success = false;
+    
+    // Check address
+    QString address = item->contentWidgetData("text").toString();
+    QHostAddress hostAddress;
+    if (hostAddress.setAddress(address)
+        && hostAddress.protocol() == protocol) {
+        // Proper address, convert to lower case (IPv6)
+        address = hostAddress.toString().toLower();
+    } else if (address.isEmpty()) {
+        // Empty string, replace with 0.0.0.0 or 0:0:0:0:0:0:0:0
+        if (protocol == QAbstractSocket::IPv4Protocol) {
+            address = CMManagerShim::UnspecifiedIpv4Address;
+        } else {
+            address = CMManagerShim::DynamicIpv6Address;
+        }
+    } else {
+        // Invalid address
+        address.clear();
+    }
+
+    if (!address.isEmpty()) {
+        // Save to CommsDat
+        mCmConnectionMethod->setStringAttribute(attribute, address);
+        if (tryUpdate()) {
+            success = true;
+            item->setContentWidgetData("text", address);
+        }
+    } else {
+        // Inform user of invalid name
+        showMessageBox(
+            HbMessageBox::MessageTypeInformation,
+            hbTrId("txt_occ_info_invalid_input"));
+        // Restore previous setting
+        address = getIpAddress(attribute);
+        item->setContentWidgetData("text", address);
+    }
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_VALIDATEANDSAVEIPADDRESS_EXIT);
+    return success;
+}
+
+/*!
+    Shows message box with "OK" button using given text.
+*/
+void CpPacketDataApAdvancedView::showMessageBox(
+    HbMessageBox::MessageBoxType type,
+    const QString &text)
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_SHOWMESSAGEBOX_ENTRY);
+    
+    // Create a message box
+    mMessageBox = QSharedPointer<HbMessageBox>(new HbMessageBox(type));
+    mMessageBox->setText(text);
+    mMessageBox->setModal(true);
+    mMessageBox->setTimeout(HbPopup::NoTimeout);
+    mMessageBox->open();
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_SHOWMESSAGEBOX_EXIT);
+}
+
+/*!
+    Tries to update connection method changes to CommsDat.
+    Returns "true" if success, "false" if some error happened. 
+*/
+bool CpPacketDataApAdvancedView::tryUpdate()
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_TRYUPDATE_ENTRY);
+    
+    // Try update
+    try {
+        mCmConnectionMethod->update();
+    }
+    catch (const std::exception&) {
+        // Handle error
+        handleUpdateError();
+        
+        OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_TRYUPDATE_EXIT);
+        return false;
+    }
+
+    OstTraceFunctionExit0(DUP1_CPPACKETDATAAPADVANCEDVIEW_TRYUPDATE_EXIT);
+    return true;
+}
+
+/*!
+    Handles failed CommsDat update.
+ */
+void CpPacketDataApAdvancedView::handleUpdateError()
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_HANDLEUPDATEERROR_ENTRY);
+    
+    // Show error note to user
+    showMessageBox(
+        HbMessageBox::MessageTypeWarning,
+        hbTrId("txt_occ_info_unable_to_save_setting"));
+    // Reload settings from CommsDat and update UI
+    try {
+        mCmConnectionMethod->refresh();
+    }
+    catch (const std::exception&) {
+        // Ignore error from refresh. Most likely this will not happen, but
+        // if it does, there isn't very much we can do.
+        OstTrace0(
+            TRACE_ERROR,
+            CPPACKETDATAAPPADVANCEDVIEW_HANDLEUPDATEERROR,
+            "Refresh failed");
+    };
+    updateIpGroup();
+    updateProxyGroup();
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_HANDLEUPDATEERROR_EXIT);
+}
+
+/*!
+    Initializes all settings groups.
+*/
+void CpPacketDataApAdvancedView::setEditorPreferences(const QModelIndex index)
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_SETEDITORPREFERENCES_ENTRY);
+    
+    HbDataFormViewItem *viewItem = qobject_cast<HbDataFormViewItem *>
+        (mForm->itemByIndex(index));
+    HbDataFormModelItem *modelItem = mModel->itemFromIndex(index);
+
+    if (modelItem == mIpv4Address
+        || modelItem == mIpv4DnsAddress1
+        || modelItem == mIpv4DnsAddress2
+        || modelItem == mIpv6DnsAddress1
+        || modelItem == mIpv6DnsAddress2
+        || modelItem == mProxyServer
+        || modelItem == mProxyPort) {
+        // HbLineEdit items, get editor and editor interface
+        HbLineEdit *edit = qobject_cast<HbLineEdit *>
+            (viewItem->dataItemContentWidget());
+        HbEditorInterface editorInterface(edit);
+
+        if (modelItem == mIpv4Address
+            || modelItem == mIpv4DnsAddress1
+            || modelItem == mIpv4DnsAddress2) {
+                // IPv4 IP address
+                editorInterface.setMode(HbInputModeNumeric);
+                editorInterface.setFilter(CpIpv4Filter::instance());
+                edit->setMaxLength(CMManagerShim::CmIP4AddressLength);
+        } else if (modelItem == mIpv6DnsAddress1
+            || modelItem == mIpv6DnsAddress2) {
+                // IPv6 IP address
+                editorInterface.setInputConstraints(
+                    HbEditorConstraintLatinAlphabetOnly);
+                editorInterface.setFilter(CpIpv6Filter::instance());
+                edit->setInputMethodHints(
+                    Qt::ImhNoPredictiveText
+                    | Qt::ImhPreferLowercase);
+                edit->setMaxLength(CMManagerShim::CmIP6NameServerLength);
+        } else if (modelItem == mProxyServer) {                
+                // Proxy server address
+                editorInterface.setMode(HbInputModeNone);
+                editorInterface.setInputConstraints(
+                    HbEditorConstraintLatinAlphabetOnly);
+                editorInterface.setFilter(HbUrlFilter::instance());
+                editorInterface.setEditorClass(HbInputEditorClassUrl);
+                editorInterface.setDigitType(HbDigitTypeNone);
+                edit->setInputMethodHints(
+                    Qt::ImhNoPredictiveText
+                    | Qt::ImhPreferLowercase);
+                edit->setMaxLength(CMManagerShim::CmProxyServerNameLength);
+        } else { /* mProxyPort */                
+                // Proxy port number
+                editorInterface.setMode(HbInputModeNumeric);
+                edit->setInputMethodHints(Qt::ImhDigitsOnly);
+                edit->setMaxLength(CMManagerShim::CmProxyPortNumberLength);
+        }
+    }
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_SETEDITORPREFERENCES_EXIT);
+}
+
+/*!
+    Handles change to network type (IPv4/IPv6).
+*/
+void CpPacketDataApAdvancedView::changeNetworkType(int type)
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGENETWORKTYPE_ENTRY);
+
+    // Save network type to CommsDat
+    int pdpType;
+    if (type == NetworkTypeIpv6) {
+        pdpType = RPacketContext::EPdpTypeIPv6;
+    } else {
+        pdpType = RPacketContext::EPdpTypeIPv4;
+    }
+    mCmConnectionMethod->setIntAttribute(
+        CMManagerShim::PacketDataPDPType,
+        pdpType);
+    if (tryUpdate())
+        {
+        // This will handle updating the UI with correct setting items 
+        updateIpGroup();
+        }
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGENETWORKTYPE_EXIT);
+}
+
+/*!
+    Handles change to IPv4 address mode (automatic/user defined).
 */
-void CpPacketDataApAdvancedView::createAdvancedSettings()
+void CpPacketDataApAdvancedView::changeIpv4AddressMode(int state)
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV4ADDRESSMODE_ENTRY);
+    
+    bool ipv4AddressFromServer;
+    if (state == Qt::Checked) {
+        ipv4AddressFromServer = true;
+    } else {
+        ipv4AddressFromServer = false;
+    }
+    
+    if (!ipv4AddressFromServer
+        && getIpAddress(CMManagerShim::CmIPAddress) ==
+            CMManagerShim::UnspecifiedIpv4Address) {
+        // User defined IP address selected, but no valid address is stored.
+        // Just enable the UI IP editors, because CMManager will update the
+        // "IP address from server" flag by itself when a valid IP address
+        // is stored.
+        enableIpv4AddressFields(state);
+    } else {
+        // Save setting to CommsDat
+        mCmConnectionMethod->setBoolAttribute(
+            CMManagerShim::CmIPAddrFromServer,
+            ipv4AddressFromServer);
+        if (tryUpdate()) {
+            enableIpv4AddressFields(state);
+        }
+    }
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV4ADDRESSMODE_EXIT);
+}
+
+/*!
+    Saves IPv4 address to CommsDat.
+*/
+void CpPacketDataApAdvancedView::changeIpv4Address()
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV4ADDRESS_ENTRY);
+    
+    if (validateAndSaveIpAddress(
+        mIpv4Address,
+        CMManagerShim::CmIPAddress,
+        QAbstractSocket::IPv4Protocol)) {
+        // In case the IP address is empty or 0.0.0.0, CMManager changes the
+        // "IP address from server" flag to true. We need to refresh the UI to
+        // make sure we are in sync.
+        updateIpGroup();
+    }
+
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV4ADDRESS_EXIT);
+}
+
+/*!
+    Handles change to IPv4 DNS mode (automatic/user defined).
+*/
+void CpPacketDataApAdvancedView::changeIpv4DnsMode(int state)
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV4DNSMODE_ENTRY);
+    
+    bool dnsAddressFromServer;
+    if (state == Qt::Checked) {
+        dnsAddressFromServer = true;
+    } else {
+        dnsAddressFromServer = false;
+    }
+    // Save setting to CommsDat
+    mCmConnectionMethod->setBoolAttribute(
+        CMManagerShim::CmIPDNSAddrFromServer,
+        dnsAddressFromServer);
+    if (tryUpdate()) {
+        enableIpv4DnsFields(state);
+    }
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV4DNSMODE_EXIT);
+}
+
+/*!
+    Saves IPv4 primary DNS address to CommsDat.
+*/
+void CpPacketDataApAdvancedView::changeIpv4PrimaryDnsAddress()
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV4PRIMARYDNSADDRESS_ENTRY);
+    
+    if (validateAndSaveIpAddress(
+        mIpv4DnsAddress1,
+        CMManagerShim::CmIPNameServer1,
+        QAbstractSocket::IPv4Protocol)) {
+        // Address saved successfully, update "DNS address from server" flag
+        mCmConnectionMethod->setBoolAttribute(
+            CMManagerShim::CmIPDNSAddrFromServer,
+            false);
+        if (tryUpdate()) {
+            // In case primary DNS address is empty or 0.0.0.0, CMManager will
+            // check secondary DNS address and in case it is a valid address,
+            // move it to the primary DNS address. We need to refresh the
+            // UI to make sure we are in sync. If tryUpdate() fails it does
+            // the refresh automatically, so only success case is handled
+            // here.
+            updateIpGroup();            
+        }
+    }
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV4PRIMARYDNSADDRESS_EXIT);
+}
+
+/*!
+    Saves IPv4 secondary DNS address to CommsDat.
+*/
+void CpPacketDataApAdvancedView::changeIpv4SecondaryDnsAddress()
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV4SECONDARYDNSADDRESS_ENTRY);
+    
+    if (validateAndSaveIpAddress(
+        mIpv4DnsAddress2,
+        CMManagerShim::CmIPNameServer2,
+        QAbstractSocket::IPv4Protocol)) {
+        // Address saved successfully, update "DNS address from server" flag
+        mCmConnectionMethod->setBoolAttribute(
+            CMManagerShim::CmIPDNSAddrFromServer,
+            false);
+        if (tryUpdate()) {
+            // In case primary DNS address is empty or 0.0.0.0, CMManager will
+            // write the address there instead of secondary DNS address, so we
+            // need to refresh the UI to make sure we are in sync. If
+            // tryUpdate() fails it does the refresh automatically, so only
+            // success case is handled here.
+            updateIpGroup();
+        }
+    }
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV4SECONDARYDNSADDRESS_EXIT);
+}
+
+/*!
+    Handles change to IPv6 DNS mode (automatic/well-known/user defined).
+*/
+void CpPacketDataApAdvancedView::changeIpv6DnsMode(int state)
 {
-    // TODO: Implement the advanced settings view.
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV6DNSMODE_ENTRY);
+    
+    // Update "DNS address from server" flag
+    if (state == Ipv6DnsTypeAutomatic) {
+        // Automatic
+        mCmConnectionMethod->setBoolAttribute(
+            CMManagerShim::CmIP6DNSAddrFromServer,
+            true);
+    } else {
+        // User defined or well-known address
+        mCmConnectionMethod->setBoolAttribute(
+            CMManagerShim::CmIP6DNSAddrFromServer,
+            false);
+        
+        if (state == Ipv6DnsTypeWellKnown) {
+            // Well-known address, set DNS addresses and update UI
+            mCmConnectionMethod->setStringAttribute(
+                CMManagerShim::CmIP6NameServer1,
+                CMManagerShim::KnownIpv6NameServer1);
+            mIpv6DnsAddress1->setContentWidgetData(
+                "text",
+                CMManagerShim::KnownIpv6NameServer1);
+            mCmConnectionMethod->setStringAttribute(
+                CMManagerShim::CmIP6NameServer2,
+                CMManagerShim::KnownIpv6NameServer2);
+            mIpv6DnsAddress2->setContentWidgetData(
+                "text",
+                CMManagerShim::KnownIpv6NameServer2);        
+        }
+    }
+
+    if (tryUpdate()) {
+        enableIpv6DnsFields(state);
+    }
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV6DNSMODE_EXIT);
+}
+
+/*!
+    Saves IPv6 primary DNS address to CommsDat.
+*/
+void CpPacketDataApAdvancedView::changeIpv6PrimaryDnsAddress()
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV6PRIMARYDNSADDRESS_ENTRY);
+    
+    if (validateAndSaveIpAddress(
+        mIpv6DnsAddress1,
+        CMManagerShim::CmIP6NameServer1,
+        QAbstractSocket::IPv6Protocol)) {
+        // Address saved successfully, update "DNS address from server" flag
+        mCmConnectionMethod->setBoolAttribute(
+            CMManagerShim::CmIP6DNSAddrFromServer,
+            false);
+        if (tryUpdate()) {
+            // In case primary DNS address is empty or 0:0:0:0:0:0:0:0,
+            // CMManager will check secondary DNS address and in case it is a
+            // valid address, move it to the primary DNS address. We need to
+            // refresh the UI to make sure we are in sync. If tryUpdate()
+            // fails it does the refresh automatically, so only success case
+            // is handled here.
+            updateIpGroup();            
+        }
+    }
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV6PRIMARYDNSADDRESS_EXIT);
 }
+
+/*!
+    Saves IPv6 secondary DNS address to CommsDat.
+*/
+void CpPacketDataApAdvancedView::changeIpv6SecondaryDnsAddress()
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV6SECONDARYDNSADDRESS_ENTRY);
+    
+    if (validateAndSaveIpAddress(
+        mIpv6DnsAddress2,
+        CMManagerShim::CmIP6NameServer2,
+        QAbstractSocket::IPv6Protocol)) {
+        // Address saved successfully, update "DNS address from server" flag
+        mCmConnectionMethod->setBoolAttribute(
+            CMManagerShim::CmIP6DNSAddrFromServer,
+            false);
+        if (tryUpdate()) {
+            // In case primary DNS address is empty or 0:0:0:0:0:0:0:0,
+            // CMManager will write the address there instead of secondary DNS
+            // address, so we need to refresh the UI to make sure we are in
+            // sync. If tryUpdate() fails it does the refresh automatically,
+            // so only success case is handled here.
+            updateIpGroup();
+        }
+    }
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV6SECONDARYDNSADDRESS_EXIT);
+}
+
+/*!
+    Saves proxy server address to CommsDat.
+*/
+void CpPacketDataApAdvancedView::changeProxyServer()
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGEPROXYSERVER_ENTRY);
+    
+    QString proxyServer = mProxyServer->contentWidgetData("text").toString();
+    mCmConnectionMethod->setStringAttribute(
+        CMManagerShim::CmProxyServerName,
+        proxyServer);
+    (void)tryUpdate();
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGEPROXYSERVER_EXIT);
+}
+
+/*!
+    Saves proxy port to CommsDat.
+*/
+void CpPacketDataApAdvancedView::changeProxyPort()
+{
+    OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGEPROXYPORT_ENTRY);
+    
+    uint proxyPort = mProxyPort->contentWidgetData("text").toInt();
+    if (proxyPort <= 65535) {
+        if (proxyPort == 0) {
+            // Don't show zero
+            mProxyPort->setContentWidgetData("text", "");
+        }
+        mCmConnectionMethod->setIntAttribute(
+            CMManagerShim::CmProxyPortNumber,
+            proxyPort);
+        (void)tryUpdate();
+    } else {
+        // Inform user of invalid value
+        showMessageBox(
+            HbMessageBox::MessageTypeInformation,
+            hbTrId("txt_occ_info_invalid_input"));
+        // Restore previous setting
+        proxyPort = mCmConnectionMethod->getIntAttribute(
+            CMManagerShim::CmProxyPortNumber);
+        if (proxyPort > 0) {
+            mProxyPort->setContentWidgetData("text", QVariant(proxyPort));
+        } else {
+            mProxyPort->setContentWidgetData("text", "");
+        }
+    }
+    
+    OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGEPROXYPORT_EXIT);
+}
--- a/cmmanager/cppacketdataapplugin/src/cppacketdataapplugin.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cppacketdataapplugin/src/cppacketdataapplugin.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -17,9 +17,7 @@
 */
 
 // System includes
-#include <QString>
-#include <QTranslator>
-#include <QCoreApplication>
+#include <HbTranslator>
 #include <cmmanager_shim.h>
 #include <cmconnectionmethod_shim.h>
 
@@ -49,19 +47,12 @@
     Constructor.
 */
 CpPacketDataApPlugin::CpPacketDataApPlugin() :
-    mTranslator(0),
+    mTranslator(new HbTranslator("cpapplugin")),
     mCmManager(0),
     mCmConnectionMethod(0)
 {
     OstTraceFunctionEntry0(CPPACKETDATAAPPLUGIN_CPPACKETDATAAPPLUGIN_ENTRY);
  
-    // Install localization
-    QString lang = QLocale::system().name();
-    QString path = "z:/resource/qt/translations/";
-    mTranslator = new QTranslator(this);
-    mTranslator->load(path + "cpapplugin_" + lang);
-    qApp->installTranslator(mTranslator);
-    
     OstTraceFunctionExit0(CPPACKETDATAAPPLUGIN_CPPACKETDATAAPPLUGIN_EXIT);
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cppluginutils/cppluginutils.pri	Wed Jun 23 17:49:20 2010 +0100
@@ -0,0 +1,22 @@
+#
+# 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:
+# Project info include file for Control Panel plugin utilities.
+#
+
+# Sources
+HEADERS += $$PWD/inc/cpipv4filter.h \
+           $$PWD/inc/cpipv6filter.h
+SOURCES += $$PWD/src/cpipv4filter.cpp \
+           $$PWD/src/cpipv6filter.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cppluginutils/inc/cpipv4filter.h	Wed Jun 23 17:49:20 2010 +0100
@@ -0,0 +1,59 @@
+/*
+* 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:
+* IPv4 input filter header file.
+*
+*/
+
+#ifndef CPIPV4FILTER_H
+#define CPIPV4FILTER_H
+
+// System includes
+#include <HbInputFilter>
+
+// User includes
+
+// Forward declarations
+
+// External data types
+
+// Constants
+
+// Class declaration
+class CpIpv4Filter : public HbInputFilter
+{
+public:
+    static CpIpv4Filter* instance();
+    virtual ~CpIpv4Filter();
+    virtual bool filter(QChar aChar);
+
+signals:
+
+public slots:
+
+protected:
+
+protected slots:
+
+private:
+    Q_DISABLE_COPY(CpIpv4Filter)
+
+    CpIpv4Filter();
+
+private slots:
+    
+private: // data
+};
+
+#endif // CPIPV4FILTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cppluginutils/inc/cpipv6filter.h	Wed Jun 23 17:49:20 2010 +0100
@@ -0,0 +1,59 @@
+/*
+* 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:
+* IPv6 input filter header file.
+*
+*/
+
+#ifndef CPIPV6FILTER_H
+#define CPIPV6FILTER_H
+
+// System includes
+#include <HbInputFilter>
+
+// User includes
+
+// Forward declarations
+
+// External data types
+
+// Constants
+
+// Class declaration
+class CpIpv6Filter : public HbInputFilter
+{
+public:
+    static CpIpv6Filter* instance();
+    virtual ~CpIpv6Filter();
+    virtual bool filter(QChar aChar);
+
+signals:
+
+public slots:
+
+protected:
+
+protected slots:
+
+private:
+    Q_DISABLE_COPY(CpIpv6Filter)
+
+    CpIpv6Filter();
+
+private slots:
+    
+private: // data
+};
+
+#endif // CPIPV6FILTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cppluginutils/src/cpipv4filter.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -0,0 +1,74 @@
+/*
+* 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:
+* IPv4 input filter implementation.
+*
+*/
+
+// System includes
+#include <HbInputFilter>
+
+// User includes
+#include "cpipv4filter.h"
+
+/*!
+    \class CpIpv4Filter
+    \brief IPv4 input filter implementation.
+*/
+
+// External function prototypes
+
+// Local constants
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+/*!
+    Returns static instance of the class.
+*/
+CpIpv4Filter* CpIpv4Filter::instance()
+{
+    static CpIpv4Filter myInstance;
+    return &myInstance;
+}
+
+/*!
+    Constructor.
+*/
+CpIpv4Filter::CpIpv4Filter()
+{
+}
+
+/*!
+    Destructor.
+*/
+CpIpv4Filter::~CpIpv4Filter()
+{
+}
+
+/*!
+    Returns true if given character is valid for an IPv4 address.
+*/
+bool CpIpv4Filter::filter(QChar aChar)
+{
+    if (aChar >= '0' && aChar <= '9') {
+        return true;
+    }
+    if (aChar == '.') {
+        return true;
+    }
+
+    return false;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cppluginutils/src/cpipv6filter.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -0,0 +1,76 @@
+/*
+* 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:
+* IPv6 input filter implementation.
+*
+*/
+
+// System includes
+#include <HbInputFilter>
+
+// User includes
+#include "cpipv6filter.h"
+
+/*!
+    \class CpIpv6Filter
+    \brief IPv6 input filter implementation.
+*/
+
+// External function prototypes
+
+// Local constants
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+/*!
+    Returns static instance of the class.
+*/
+CpIpv6Filter* CpIpv6Filter::instance()
+{
+    static CpIpv6Filter myInstance;
+    return &myInstance;
+}
+
+/*!
+    Constructor.
+*/
+CpIpv6Filter::CpIpv6Filter()
+{
+}
+
+/*!
+    Destructor.
+*/
+CpIpv6Filter::~CpIpv6Filter()
+{
+}
+
+/*!
+    Returns true if given character is valid for an IPv6 address.
+*/
+bool CpIpv6Filter::filter(QChar aChar)
+{
+    if ((aChar >= 'a' && aChar <= 'f')
+        || (aChar >= 'A' && aChar <= 'F')
+        || (aChar >= '0' && aChar <= '9')) {
+        return true;
+    }
+    if (aChar == ':' || aChar == '.') {
+        return true;
+    }
+
+    return false;
+}
--- a/cmmanager/cpwlanapplugin/cpwlanapplugin.pro	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cpwlanapplugin/cpwlanapplugin.pro	Wed Jun 23 17:49:20 2010 +0100
@@ -20,6 +20,12 @@
 DEPENDPATH += .
 INCLUDEPATH += .
 
+# Temporary solution to fix tracecompiler
+# When tracecompiler is fixed, this can be removed
+symbian: {
+    MMP_RULES += "USERINCLUDE traces"
+}
+
 CONFIG += hb plugin
 
 MOC_DIR = moc
@@ -37,6 +43,9 @@
            src/cpwlanapview.cpp \
            src/cpwlanapadvancedview.cpp
 
+# Include plugin utilities
+include(../cppluginutils/cppluginutils.pri)
+
 symbian:
 {
 TARGET.EPOCALLOWDLLDATA = 1
--- a/cmmanager/cpwlanapplugin/inc/cpwlanapadvancedview.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cpwlanapplugin/inc/cpwlanapadvancedview.h	Wed Jun 23 17:49:20 2010 +0100
@@ -20,13 +20,18 @@
 #define CPWLANAPADVANCEDVIEW_H
 
 // System includes
+#include <QAbstractSocket>
+#include <HbMessageBox>
 #include <cpbasesettingview.h>
+#include <cmmanagerdefines_shim.h>
 
 // User includes
 
 // Forward declarations
 class HbDataForm;
 class HbDataFormModel;
+class HbDataFormModelItem;
+class HbValidator;
 class CmConnectionMethodShim;
 
 // External data types
@@ -53,10 +58,52 @@
 protected slots:
  
 private:
+    Q_DISABLE_COPY(CpWlanApAdvancedView)
+   
+    //! IPv6 DNS type
+    enum Ipv6DnsType {
+        Ipv6DnsTypeAutomatic = 0,
+        Ipv6DnsTypeWellKnown,
+        Ipv6DnsTypeUserDefined
+    };
+
     void createAdvancedSettings();
+    void createIpv4Group();
+    void updateIpv4Group();
+    void createIpv6Group();
+    void updateIpv6Group();
+    void createProxyGroup();
+    void updateProxyGroup();
+    QString getIpAddress(CMManagerShim::ConnectionMethodAttribute attribute);
+    Ipv6DnsType getIpv6DnsType();
+    void enableIpv4AddressFields(int state);
+    void enableIpv4DnsFields(int state);
+    void enableIpv6DnsFields(int selectionIndex);
+    bool validateAndSaveIpAddress(
+        HbDataFormModelItem *item,
+        CMManagerShim::ConnectionMethodAttribute attribute,
+        QAbstractSocket::NetworkLayerProtocol protocol);
+    void showMessageBox(
+        HbMessageBox::MessageBoxType type,
+        const QString &text);
+    bool tryUpdate();
+    void handleUpdateError();
     
 private slots:
-    
+    void setEditorPreferences(const QModelIndex index);
+    void changeIpv4AddressMode(int state);
+    void changeIpv4Address();
+    void changeIpv4SubnetMask();
+    void changeIpv4Gateway();
+    void changeIpv4DnsMode(int state);
+    void changeIpv4PrimaryDnsAddress();
+    void changeIpv4SecondaryDnsAddress();
+    void changeIpv6DnsMode(int selectionIndex);
+    void changeIpv6PrimaryDnsAddress();
+    void changeIpv6SecondaryDnsAddress();
+    void changeProxyServer();
+    void changeProxyPort();
+
 private: // data
     //! Dataform
     HbDataForm *mForm;
@@ -64,6 +111,43 @@
     HbDataFormModel *mModel;
     //! Connection Settings Shim connection method pointer
     CmConnectionMethodShim *mCmConnectionMethod;
+    //! "IPv4 settings" group
+    HbDataFormModelItem *mIpv4Group;
+    //! "Automatic" setting item for phone IP address
+    HbDataFormModelItem *mIpv4Automatic;
+    //! "Phone IP address" setting item
+    HbDataFormModelItem *mIpv4Address;
+    //! "Subnet mask" setting item
+    HbDataFormModelItem *mIpv4SubnetMask;
+    //! "Default gateway" setting item
+    HbDataFormModelItem *mIpv4Gateway;
+    //! "Automatic" setting item for IPv4 DNS addresses
+    HbDataFormModelItem *mIpv4DnsAutomatic;
+    //! "Primary name server" setting item
+    HbDataFormModelItem *mIpv4DnsAddress1;
+    //! "Secondary name server" setting item
+    HbDataFormModelItem *mIpv4DnsAddress2;
+    //! "IPv6 settings" group
+    HbDataFormModelItem *mIpv6Group;
+    //! "Automatic" setting item for IPv6 DNS addresses
+    HbDataFormModelItem *mIpv6DnsAutomatic;
+    //! "Primary name server" setting item
+    HbDataFormModelItem *mIpv6DnsAddress1;
+    //! "Secondary name server" setting item
+    HbDataFormModelItem *mIpv6DnsAddress2;
+    //! "Proxy settings" group
+    HbDataFormModelItem *mProxyGroup;
+    //! "Proxy server address" setting item
+    HbDataFormModelItem *mProxyServer;
+    //! "Proxy port number" setting item
+    HbDataFormModelItem *mProxyPort;
+    //! Message box for info notes
+    QSharedPointer<HbMessageBox> mMessageBox;
+    //! Flag for IPv6 support
+    bool mIpv6Supported;
+    
+    // Friend classes
+    friend class TestCpWlanApPlugin;
 };
 
 #endif // CPWLANAPADVANCEDVIEW_H
--- a/cmmanager/cpwlanapplugin/inc/cpwlanapplugin.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cpwlanapplugin/inc/cpwlanapplugin.h	Wed Jun 23 17:49:20 2010 +0100
@@ -21,12 +21,13 @@
 
 // System includes
 #include <QObject>
+#include <QSharedPointer>
 #include <cpbearerapplugininterface.h>
 
 // User includes
 
 // Forward declarations
-class QTranslator;
+class HbTranslator;
 class CmManagerShim;
 class CmConnectionMethodShim;
 
@@ -56,12 +57,13 @@
 protected slots:
 
 private:
+    Q_DISABLE_COPY(CpWlanApPlugin)
 
 private slots:
     
 private: // data
     //! Translator instance
-    QTranslator *mTranslator;
+    QSharedPointer<HbTranslator> mTranslator;
     //! CM Manager Shim instance
     CmManagerShim *mCmManager;
     //! CM Connection Method Shim instance
--- a/cmmanager/cpwlanapplugin/inc/cpwlanapview.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cpwlanapplugin/inc/cpwlanapview.h	Wed Jun 23 17:49:20 2010 +0100
@@ -24,6 +24,7 @@
 #include <QMap>
 #include <HbMessageBox>
 #include <cpbasesettingview.h>
+#include <cmconnectionmethod_shim.h>
 
 // User includes
 
@@ -60,21 +61,29 @@
 protected slots:
  
 private:
+    Q_DISABLE_COPY(CpWlanApView)
+
     void createAccessPointSettingsGroup();
     void updateAccessPointSettingsGroup();
-    void loadSecurityPlugins();
+    void loadSecurityPlugins(
+        CMManagerShim::WlanConnMode networkMode);
     void updateSecurityGroup(int index);
     void showMessageBox(
         HbMessageBox::MessageBoxType type,
         const QString &text);
     bool tryUpdate();
     void handleUpdateError();
-       
+    void updateAdHocChannelItem(
+        CMManagerShim::WlanConnMode networkMode);
+    void updateSecurityModeItem(
+        CMManagerShim::WlanConnMode networkMode);
+    
 private slots:
     void connectionNameChanged();
     void wlanNetworkNameChanged();
     void networkStatusChanged(int index);
     void networkModeChanged(int index);
+    void adHocChannelChanged(int index);
     void securityModeChanged(int index);
     void homepageChanged();
     void menuActionTriggered(HbAction *action);
@@ -82,6 +91,10 @@
     void setEditorPreferences(const QModelIndex modelIndex);
     
 private: // data
+    // WLAN ad-hoc channel minimum and maximum values 
+    static const uint WlanAdHocChannelMinValue = 1;
+    static const uint WlanAdHocChannelMaxValue = 11;
+    
     //! Dataform
     HbDataForm *mForm;
     //! Dataform model
@@ -98,6 +111,8 @@
     HbDataFormModelItem *mNetworkStatusItem;
     //! "Network mode" setting item
     HbDataFormModelItem *mNetworkModeItem;
+    //! "Ad-hoc channel" setting item
+    HbDataFormModelItem *mAdHocChannelItem;
     //! "Security mode" setting item
     HbDataFormModelItem *mSecurityModeItem;
     //! "Homepage" setting item
--- a/cmmanager/cpwlanapplugin/src/cpwlanapadvancedview.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cpwlanapplugin/src/cpwlanapadvancedview.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -11,20 +11,36 @@
 *
 * Contributors:
 *
-* Description:
+* Description:  
 * Control Panel WLAN AP advanced settings view implementation.
 *
 */
 
 // System includes
+#include <QHostAddress>
+#include <HbCheckBox>
+#include <HbLineEdit>
+#include <HbDataFormViewItem>
+#include <HbWidget>
+#include <HbEditorInterface>
+#include <HbUrlFilter>
+#include <HbInputDialog>
 #include <HbDataForm>
 #include <HbDataFormModel>
 #include <cmconnectionmethod_shim.h>
+#include <cmmanagerdefines_shim.h>
 #include <cpsettingformitemdata.h>
 
 // User includes
+#include "cpipv4filter.h"
+#include "cpipv6filter.h"
 #include "cpwlanapadvancedview.h"
 
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cpwlanapadvancedviewTraces.h"
+#endif
+
 /*!
     \class CpWlanApAdvancedView
     \brief This class implements the WLAN AP Control Panel advanced
@@ -48,16 +64,40 @@
         CpBaseSettingView(0, parent),
         mForm(0),
         mModel(0),
-        mCmConnectionMethod(cmConnectionMethod)
+        mCmConnectionMethod(cmConnectionMethod),
+        mIpv4Group(0),
+        mIpv4Automatic(0),
+        mIpv4Address(0),
+        mIpv4SubnetMask(0),
+        mIpv4Gateway(0),
+        mIpv4DnsAutomatic(0),
+        mIpv4DnsAddress1(0),
+        mIpv4DnsAddress2(0),
+        mIpv6Group(0),
+        mIpv6DnsAutomatic(0),
+        mIpv6DnsAddress1(0),
+        mIpv6DnsAddress2(0),
+        mProxyGroup(0),
+        mProxyServer(0),
+        mProxyPort(0),
+        mMessageBox(0),
+        mIpv6Supported(false)
 {
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_CPWLANAPADVANCEDVIEW_ENTRY);
+    
     // Construct WLAN AP advanced settings UI
     mForm = new HbDataForm();
     this->setWidget(mForm);
     mModel = new HbDataFormModel(mForm);
     mForm->setModel(mModel);
 
+    mIpv6Supported = mCmConnectionMethod->getBoolAttribute(
+        CMManagerShim::CmIPv6Supported);
+        
     // Add advanced settings groups
     createAdvancedSettings();
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_CPWLANAPADVANCEDVIEW_EXIT);
 }
 
 /*!
@@ -65,6 +105,9 @@
 */
 CpWlanApAdvancedView::~CpWlanApAdvancedView()
 {
+    OstTraceFunctionEntry0(DUP1_CPWLANAPADVANCEDVIEW_CPWLANAPADVANCEDVIEW_ENTRY);
+    
+    OstTraceFunctionExit0(DUP1_CPWLANAPADVANCEDVIEW_CPWLANAPADVANCEDVIEW_EXIT);
 }
 
 /*!
@@ -72,5 +115,973 @@
 */
 void CpWlanApAdvancedView::createAdvancedSettings()
 {
-    // TODO: Implement the advanced settings view.
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_CREATEADVANCEDSETTINGS_ENTRY);
+    
+    // Create settings groups
+    createIpv4Group();
+    if (mIpv6Supported) {
+        createIpv6Group();
+    }
+    createProxyGroup();
+    
+    // Read values and update UI
+    updateIpv4Group();
+    if (mIpv6Supported) {
+        updateIpv6Group();
+    }
+    updateProxyGroup();
+    
+    // Connect signal to initialize settings item widgets
+    bool status = connect(
+        mForm,
+        SIGNAL(itemShown(const QModelIndex)),
+        this,
+        SLOT(setEditorPreferences(const QModelIndex)));
+    Q_ASSERT(status);
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_CREATEADVANCEDSETTINGS_EXIT);
+}
+
+/*!
+    Creates the IPv4 settings group.
+*/
+void CpWlanApAdvancedView::createIpv4Group()
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_CREATEIPV4GROUP_ENTRY);
+    
+    // IPv4 settings group
+    mIpv4Group = new CpSettingFormItemData(
+        HbDataFormModelItem::GroupItem,
+        hbTrId("txt_occ_subhead_ipv4_settings"));
+    mModel->appendDataFormItem(mIpv4Group);
+    
+    // Phone IP address
+    // "Automatic" checkbox
+    mIpv4Automatic = new CpSettingFormItemData(
+        HbDataFormModelItem::CheckBoxItem,
+        hbTrId("txt_occ_setlabel_phone_ip_address"));
+    mIpv4Automatic->setContentWidgetData(
+        "text",
+        hbTrId("txt_occ_setlabel_val_automatic"));
+    mForm->addConnection(
+        mIpv4Automatic,
+        SIGNAL(stateChanged(int)),
+        this,
+        SLOT(changeIpv4AddressMode(int)));
+    mIpv4Group->appendChild(mIpv4Automatic);
+    
+    // Phone IP address
+    mIpv4Address = new CpSettingFormItemData(
+        HbDataFormModelItem::TextItem,
+        hbTrId("txt_occ_setlabel_phone_ip_address"));
+    mForm->addConnection(
+        mIpv4Address,
+        SIGNAL(editingFinished()),
+        this,
+        SLOT(changeIpv4Address()));
+    mIpv4Group->appendChild(mIpv4Address);
+    
+    // Subnet mask
+    mIpv4SubnetMask = new CpSettingFormItemData(
+        HbDataFormModelItem::TextItem,
+        hbTrId("txt_occ_setlabel_subnet_mask"));
+    mForm->addConnection(
+        mIpv4SubnetMask,
+        SIGNAL(editingFinished()),
+        this,
+        SLOT(changeIpv4SubnetMask()));
+    mIpv4Group->appendChild(mIpv4SubnetMask);
+    
+    // Gateway
+    mIpv4Gateway = new CpSettingFormItemData(
+        HbDataFormModelItem::TextItem,
+        hbTrId("txt_occ_setlabel_default_gateway"));
+    mForm->addConnection(
+        mIpv4Gateway,
+        SIGNAL(editingFinished()),
+        this,
+        SLOT(changeIpv4Gateway()));
+    mIpv4Group->appendChild(mIpv4Gateway);
+    
+    // DNS addresses
+    // "Automatic" checkbox
+    mIpv4DnsAutomatic = new CpSettingFormItemData(
+        HbDataFormModelItem::CheckBoxItem,
+        hbTrId("txt_occ_setlabel_dns_addresses"));
+    mIpv4DnsAutomatic->setContentWidgetData(
+        "text",
+        hbTrId("txt_occ_setlabel_val_automatic"));
+    mForm->addConnection(
+        mIpv4DnsAutomatic,
+        SIGNAL(stateChanged(int)), 
+        this,
+        SLOT(changeIpv4DnsMode(int)));
+    mIpv4Group->appendChild(mIpv4DnsAutomatic);
+    
+    // Primary DNS address
+    mIpv4DnsAddress1 = new CpSettingFormItemData(
+        HbDataFormModelItem::TextItem,
+        hbTrId("txt_occ_setlabel_primary_name_server"));
+    mForm->addConnection(
+        mIpv4DnsAddress1,
+        SIGNAL(editingFinished()), 
+        this,
+        SLOT(changeIpv4PrimaryDnsAddress()));
+    mIpv4Group->appendChild(mIpv4DnsAddress1);
+    
+    // Secondary DNS address
+    mIpv4DnsAddress2 = new CpSettingFormItemData(
+        HbDataFormModelItem::TextItem,
+        hbTrId("txt_occ_setlabel_secondary_name_server"));
+    mForm->addConnection(
+        mIpv4DnsAddress2,
+        SIGNAL(editingFinished()), 
+        this,
+        SLOT(changeIpv4SecondaryDnsAddress()));
+    mIpv4Group->appendChild(mIpv4DnsAddress2);
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_CREATEIPV4GROUP_EXIT);
+}
+
+/*!
+    Reads attribute values and updates the IPv4 settings group.
+*/
+void CpWlanApAdvancedView::updateIpv4Group()
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_UPDATEIPV4GROUP_ENTRY);
+    
+    // Phone IP address
+    // "Automatic" checkbox
+    bool ipAddressFromServer = mCmConnectionMethod->getBoolAttribute(
+        CMManagerShim::CmIPAddrFromServer);
+    Qt::CheckState state = Qt::Unchecked;
+    if (ipAddressFromServer) {
+        state = Qt::Checked;
+    }
+    mIpv4Automatic->setContentWidgetData("checkState", state);
+
+    // Enable/disable user defined IP address fields
+    enableIpv4AddressFields(state);
+    
+    // Phone IP address
+    QString string = getIpAddress(CMManagerShim::CmIPAddress);
+    mIpv4Address->setContentWidgetData("text", string);
+    
+    // Subnet mask
+    string = getIpAddress(CMManagerShim::CmIPNetmask);
+    mIpv4SubnetMask->setContentWidgetData("text", string);
+    
+    // Gateway
+    string = getIpAddress(CMManagerShim::CmIPGateway);
+    mIpv4Gateway->setContentWidgetData("text", string);
+    
+    // DNS addresses
+    // "Automatic" checkbox
+    state = Qt::Unchecked;
+    if (mCmConnectionMethod->getBoolAttribute(
+        CMManagerShim::CmIPDNSAddrFromServer)) {
+        state = Qt::Checked;
+    }
+    mIpv4DnsAutomatic->setContentWidgetData("checkState", state);
+
+    // Enable/disable user defined DNS address fields
+    enableIpv4DnsFields(state);
+    
+    // Primary DNS address
+    string = getIpAddress(CMManagerShim::CmIPNameServer1);
+    mIpv4DnsAddress1->setContentWidgetData("text", string);
+    
+    // Secondary DNS address
+    string = getIpAddress(CMManagerShim::CmIPNameServer2);
+    mIpv4DnsAddress2->setContentWidgetData("text", string);
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_UPDATEIPV4GROUP_EXIT);
+}
+
+/*!
+    Creates the IPv6 settings group.
+*/
+void CpWlanApAdvancedView::createIpv6Group()
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_CREATEIPV6GROUP_ENTRY);
+    
+    // IPv6 settings group
+    mIpv6Group = new CpSettingFormItemData(
+        HbDataFormModelItem::GroupItem, 
+        hbTrId("txt_occ_subhead_ipv6_settings"));
+    mModel->appendDataFormItem(mIpv6Group);
+    
+    // DNS addresses
+    // Automatic/well-known/user defined combobox
+    mIpv6DnsAutomatic = new CpSettingFormItemData(
+        HbDataFormModelItem::ComboBoxItem,
+        hbTrId("txt_occ_setlabel_dns_addresses"));
+    QStringList dnsModeList;
+    // Order of the list must match the Ipv6DnsType enum
+    dnsModeList
+        << hbTrId("txt_occ_setlabel_val_automatic")
+        << hbTrId("txt_occ_setlabel_dns_addresses_val_wellknown")
+        << hbTrId("txt_occ_setlabel_dns_addresses_val_user_defined");
+    mIpv6DnsAutomatic->setContentWidgetData("items", dnsModeList);
+    mForm->addConnection(
+        mIpv6DnsAutomatic,
+        SIGNAL(currentIndexChanged(int)),
+        this,
+        SLOT(changeIpv6DnsMode(int)));
+    mIpv6Group->appendChild(mIpv6DnsAutomatic);
+    
+    // Primary DNS address
+    mIpv6DnsAddress1 = new CpSettingFormItemData(
+        HbDataFormModelItem::TextItem,
+        hbTrId("txt_occ_setlabel_primary_name_server"));
+    mForm->addConnection(
+        mIpv6DnsAddress1,
+        SIGNAL(editingFinished()),
+        this,
+        SLOT(changeIpv6PrimaryDnsAddress()));
+    mIpv6Group->appendChild(mIpv6DnsAddress1);
+    
+    // Secondary DNS address
+    mIpv6DnsAddress2 = new CpSettingFormItemData(
+        HbDataFormModelItem::TextItem,
+        hbTrId("txt_occ_setlabel_secondary_name_server"));
+    mForm->addConnection(
+        mIpv6DnsAddress2,
+        SIGNAL(editingFinished()),
+        this,
+        SLOT(changeIpv6SecondaryDnsAddress()));  
+    mIpv6Group->appendChild(mIpv6DnsAddress2);
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_CREATEIPV6GROUP_EXIT);
+}
+
+/*!
+    Reads attribute values and updates the IPv6 settings group.
+*/
+void CpWlanApAdvancedView::updateIpv6Group()
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_UPDATEIPV6GROUP_ENTRY);
+    
+    // DNS addresses
+    // Automatic/well-known/user defined combobox
+    uint type = getIpv6DnsType();
+    mIpv6DnsAutomatic->setContentWidgetData("currentIndex", type);
+
+    // Enable/disable user defined DNS address fields
+    enableIpv6DnsFields(type);
+    
+    // Primary DNS address
+    QString string = getIpAddress(CMManagerShim::CmIP6NameServer1);
+    mIpv6DnsAddress1->setContentWidgetData("text", string);
+    
+    // Secondary DNS address
+    string = getIpAddress(CMManagerShim::CmIP6NameServer2);
+    mIpv6DnsAddress2->setContentWidgetData("text", string);
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_UPDATEIPV6GROUP_EXIT);
+}
+
+/*!
+    Creates the proxy settings group.
+*/
+void CpWlanApAdvancedView::createProxyGroup()
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_CREATEPROXYGROUP_ENTRY);
+    
+    // Proxy settings group
+    mProxyGroup = new CpSettingFormItemData(
+        HbDataFormModelItem::GroupItem, 
+        hbTrId("txt_occ_subhead_proxy_settings"));
+    mModel->appendDataFormItem(mProxyGroup);
+    
+    // Proxy server address
+    mProxyServer = new CpSettingFormItemData(
+        HbDataFormModelItem::TextItem,
+        hbTrId("txt_occ_setlabel_proxy_server_address"));
+    mForm->addConnection(
+        mProxyServer,
+        SIGNAL(editingFinished()),
+        this,
+        SLOT(changeProxyServer()));
+    mProxyGroup->appendChild(mProxyServer);
+    
+    // Proxy port number
+    mProxyPort = new CpSettingFormItemData(
+        HbDataFormModelItem::TextItem,
+        hbTrId("txt_occ_setlabel_proxy_port_number"));
+    mForm->addConnection(
+        mProxyPort,
+        SIGNAL(editingFinished()),
+        this,
+        SLOT(changeProxyPort()));
+    mProxyGroup->appendChild(mProxyPort);
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_CREATEPROXYGROUP_EXIT);
+}
+
+/*!
+    Reads attribute values and updates the proxy settings group.
+*/
+void CpWlanApAdvancedView::updateProxyGroup()
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_UPDATEPROXYGROUP_ENTRY);
+    
+    // Proxy server address
+    QString serverAddress = mCmConnectionMethod->getStringAttribute(
+        CMManagerShim::CmProxyServerName);
+    mProxyServer->setContentWidgetData("text", serverAddress);
+    
+    // Proxy port number
+    uint portNumber = mCmConnectionMethod->getIntAttribute(
+        CMManagerShim::CmProxyPortNumber);
+    if (portNumber > 0) {
+        mProxyPort->setContentWidgetData("text", QVariant(portNumber));
+    } else {
+        mProxyPort->setContentWidgetData("text", "");
+    }
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_UPDATEPROXYGROUP_EXIT);
+}
+
+/*!
+    Reads an IP address from CommsDat with given attribute. If string is
+    empty, a zero address (0.0.0.0 or 0:0:0:0:0:0:0:0) is returned.
+*/
+QString CpWlanApAdvancedView::getIpAddress(
+    CMManagerShim::ConnectionMethodAttribute attribute)
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_GETIPADDRESS_ENTRY);
+    
+    QString ipAddress = mCmConnectionMethod->getStringAttribute(attribute);
+    
+    if (ipAddress.isEmpty()) {
+        // String is empty, return a zero address instead
+        switch (attribute) {
+        case CMManagerShim::CmIP6NameServer1:
+        case CMManagerShim::CmIP6NameServer2:
+            // IPv6 address
+            ipAddress = CMManagerShim::DynamicIpv6Address;
+            break;
+        default:
+            // IPv4 address
+            ipAddress = CMManagerShim::UnspecifiedIpv4Address; 
+            break;
+        }
+    }
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_GETIPADDRESS_EXIT);
+    return ipAddress;
+}
+
+/*!
+    Resolves IPv6 DNS address type.
+*/
+CpWlanApAdvancedView::Ipv6DnsType CpWlanApAdvancedView::getIpv6DnsType()
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_GETIPV6DNSTYPE_ENTRY);
+    
+    // Read "DNS address from server" flag
+    bool dnsAddressFromServer = mCmConnectionMethod->getBoolAttribute(
+        CMManagerShim::CmIP6DNSAddrFromServer);
+    
+    // Read IPv6 DNS addresses from CommsDat
+    QString primaryAddress = mCmConnectionMethod->getStringAttribute(
+        CMManagerShim::CmIP6NameServer1);
+    QString secondaryAddress = mCmConnectionMethod->getStringAttribute(
+        CMManagerShim::CmIP6NameServer2);
+
+    // Resolve IPv6 DNS address type
+    Ipv6DnsType type = Ipv6DnsTypeUserDefined;
+    if (dnsAddressFromServer) {
+        // Automatic
+        type = Ipv6DnsTypeAutomatic;
+    } else if (primaryAddress.toLower() == CMManagerShim::KnownIpv6NameServer1
+        && secondaryAddress.toLower() == CMManagerShim::KnownIpv6NameServer2) {
+        // Well-known IPv6 DNS addresses
+        type = Ipv6DnsTypeWellKnown;
+    }
+
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_GETIPV6DNSTYPE_EXIT);
+    return type;
+}
+
+/*!
+    Sets IPv4 address field enabled/disabled.
+*/
+void CpWlanApAdvancedView::enableIpv4AddressFields(int state)
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_ENABLEIPV4ADDRESSFIELDS_ENTRY);
+    
+    if (state == Qt::Checked) {
+        // Automatic, disable text field
+        mIpv4Address->setEnabled(false);
+        mIpv4SubnetMask->setEnabled(false);
+        mIpv4Gateway->setEnabled(false);
+    } else {
+        // Manual, enable text field
+        mIpv4Address->setEnabled(true);
+        mIpv4SubnetMask->setEnabled(true);
+        mIpv4Gateway->setEnabled(true);
+    }
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_ENABLEIPV4ADDRESSFIELDS_EXIT);
+}
+
+/*!
+    Sets IPv4 DNS address fields enabled/disabled.
+*/
+void CpWlanApAdvancedView::enableIpv4DnsFields(int state)
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_ENABLEIPV4DNSFIELDS_ENTRY);
+    
+    if (state == Qt::Checked) {
+        // Automatic, disable text fields
+        mIpv4DnsAddress1->setEnabled(false);
+        mIpv4DnsAddress2->setEnabled(false);
+    } else {
+        // Manual, enable text fields
+        mIpv4DnsAddress1->setEnabled(true);
+        mIpv4DnsAddress2->setEnabled(true);
+    }
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_ENABLEIPV4DNSFIELDS_EXIT);
+}
+
+/*!
+    Sets IPv6 DNS address fields enabled/disabled.
+*/
+void CpWlanApAdvancedView::enableIpv6DnsFields(int selectionIndex)
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_ENABLEIPV6DNSFIELDS_ENTRY);
+    
+    // Check combobox value
+    if (selectionIndex == Ipv6DnsTypeUserDefined) {
+        // User-defined, enable text fields
+        mIpv6DnsAddress1->setEnabled(true);
+        mIpv6DnsAddress2->setEnabled(true);
+    } else {
+        // Automatic or well-known, disable text fields
+        mIpv6DnsAddress1->setEnabled(false);
+        mIpv6DnsAddress2->setEnabled(false);
+    }
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_ENABLEIPV6DNSFIELDS_EXIT);
 }
+
+/*!
+    Validates an IP address and saves it to CommsDat in case it was a valid
+    address or an empty string. In case the address is not valid, an error
+    note is shown to the user and previous setting is restored to the UI.
+*/
+bool CpWlanApAdvancedView::validateAndSaveIpAddress(
+    HbDataFormModelItem *item,
+    CMManagerShim::ConnectionMethodAttribute attribute,
+    QAbstractSocket::NetworkLayerProtocol protocol)
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_VALIDATEANDSAVEIPADDRESS_ENTRY);
+    
+    bool success = false;
+    
+    // Check address
+    QString address = item->contentWidgetData("text").toString();
+    QHostAddress hostAddress;
+    if (hostAddress.setAddress(address)
+        && hostAddress.protocol() == protocol) {
+        // Proper address, convert to lower case (IPv6)
+        address = hostAddress.toString().toLower();
+    } else if (address.isEmpty()) {
+        // Empty string, replace with 0.0.0.0 or 0:0:0:0:0:0:0:0
+        if (protocol == QAbstractSocket::IPv4Protocol) {
+            address = CMManagerShim::UnspecifiedIpv4Address;
+        } else {
+            address = CMManagerShim::DynamicIpv6Address;
+        }
+    } else {
+        // Invalid address
+        address.clear();
+    }
+
+    if (!address.isEmpty()) {
+        // Save to CommsDat
+        mCmConnectionMethod->setStringAttribute(attribute, address);
+        if (tryUpdate()) {
+            success = true;
+            item->setContentWidgetData("text", address);
+        }
+    } else {
+        // Inform user of invalid name
+        showMessageBox(
+            HbMessageBox::MessageTypeInformation,
+            hbTrId("txt_occ_info_invalid_input"));
+        // Restore previous setting
+        address = getIpAddress(attribute);
+        item->setContentWidgetData("text", address);
+    }
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_VALIDATEANDSAVEIPADDRESS_EXIT);
+    return success;
+}
+
+/*!
+    Shows message box with "OK" button using given text.
+*/
+void CpWlanApAdvancedView::showMessageBox(
+    HbMessageBox::MessageBoxType type,
+    const QString &text)
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_SHOWMESSAGEBOX_ENTRY);
+    
+    // Create a message box
+    mMessageBox = QSharedPointer<HbMessageBox>(new HbMessageBox(type));
+    mMessageBox->setText(text);
+    mMessageBox->setModal(true);
+    mMessageBox->setTimeout(HbPopup::NoTimeout);
+    mMessageBox->setDismissPolicy(HbPopup::NoDismiss);
+    mMessageBox->open();
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_SHOWMESSAGEBOX_EXIT);
+}
+
+/*!
+    Tries to update connection method changes to CommsDat.
+    Returns "true" if success, "false" if some error happened. 
+*/
+bool CpWlanApAdvancedView::tryUpdate()
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_TRYUPDATE_ENTRY);
+    
+    // Try update
+    bool success = true;
+    try {
+        mCmConnectionMethod->update();
+    }
+    catch (const std::exception&) {
+        // Handle error
+        handleUpdateError();
+        
+        success = false;
+    }
+
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_TRYUPDATE_EXIT);
+    return success;
+}
+
+/*!
+    Handles failed CommsDat update.
+ */
+void CpWlanApAdvancedView::handleUpdateError()
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_HANDLEUPDATEERROR_ENTRY);
+    
+    // Show error note to user
+    showMessageBox(
+        HbMessageBox::MessageTypeWarning,
+        hbTrId("txt_occ_info_unable_to_save_setting"));
+    // Reload settings from CommsDat and update UI
+    try {
+        mCmConnectionMethod->refresh();
+    }
+    catch (const std::exception&) {
+        // Ignore error from refresh. Most likely this will not happen, but
+        // if it does, there isn't very much we can do.
+        OstTrace0(
+            TRACE_ERROR,
+            CPWLANAPPADVANCEDVIEW_HANDLEUPDATEERROR,
+            "Refresh failed");
+    };
+    updateIpv4Group();
+    if (mIpv6Supported) {
+        updateIpv6Group();
+    }
+    updateProxyGroup();
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_HANDLEUPDATEERROR_EXIT);
+}
+
+/*!
+    Initializes all settings groups.
+*/
+void CpWlanApAdvancedView::setEditorPreferences(const QModelIndex index)
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_SETEDITORPREFERENCES_ENTRY);
+    
+    HbDataFormViewItem *viewItem = qobject_cast<HbDataFormViewItem *>
+        (mForm->itemByIndex(index));
+    HbDataFormModelItem *modelItem = mModel->itemFromIndex(index);
+
+    if (modelItem == mIpv4Address
+        || modelItem == mIpv4SubnetMask
+        || modelItem == mIpv4Gateway
+        || modelItem == mIpv4DnsAddress1
+        || modelItem == mIpv4DnsAddress2
+        || modelItem == mIpv6DnsAddress1
+        || modelItem == mIpv6DnsAddress2
+        || modelItem == mProxyServer
+        || modelItem == mProxyPort) {
+        // HbLineEdit items, get editor and editor interface
+        HbLineEdit *edit = qobject_cast<HbLineEdit *>
+            (viewItem->dataItemContentWidget());
+        HbEditorInterface editorInterface(edit);
+
+        if (modelItem == mIpv4Address
+            || modelItem == mIpv4SubnetMask
+            || modelItem == mIpv4Gateway
+            || modelItem == mIpv4DnsAddress1
+            || modelItem == mIpv4DnsAddress2) {
+            // IPv4 IP address
+            editorInterface.setMode(HbInputModeNumeric);
+            editorInterface.setFilter(CpIpv4Filter::instance());
+            edit->setMaxLength(CMManagerShim::CmIP4AddressLength);
+        } else if (modelItem == mIpv6DnsAddress1
+            || modelItem == mIpv6DnsAddress2) {
+            // IPv6 IP address
+            editorInterface.setInputConstraints(
+                HbEditorConstraintLatinAlphabetOnly);
+            editorInterface.setFilter(CpIpv6Filter::instance());
+            edit->setInputMethodHints(
+                Qt::ImhNoPredictiveText
+                | Qt::ImhPreferLowercase);
+            edit->setMaxLength(CMManagerShim::CmIP6NameServerLength);
+        } else if (modelItem == mProxyServer) {                
+            // Proxy server address
+            editorInterface.setMode(HbInputModeNone);
+            editorInterface.setInputConstraints(
+                HbEditorConstraintLatinAlphabetOnly);
+            editorInterface.setFilter(HbUrlFilter::instance());
+            editorInterface.setEditorClass(HbInputEditorClassUrl);
+            editorInterface.setDigitType(HbDigitTypeNone);
+            edit->setInputMethodHints(
+                Qt::ImhNoPredictiveText
+                | Qt::ImhPreferLowercase);
+            edit->setMaxLength(CMManagerShim::CmProxyServerNameLength);
+        } else { /* mProxyPort */                
+            // Proxy port number
+            editorInterface.setMode(HbInputModeNumeric);
+            edit->setInputMethodHints(Qt::ImhDigitsOnly);
+            edit->setMaxLength(CMManagerShim::CmProxyPortNumberLength);
+        }
+    }
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_SETEDITORPREFERENCES_EXIT);
+}
+
+/*!
+    Handles change to IPv4 address mode (automatic/user defined).
+*/
+void CpWlanApAdvancedView::changeIpv4AddressMode(int state)
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_CHANGEIPV4ADDRESSMODE_ENTRY);
+    
+    bool ipv4AddressFromServer;
+    if (state == Qt::Checked) {
+        ipv4AddressFromServer = true;
+    } else {
+        ipv4AddressFromServer = false;
+    }
+    
+    if (!ipv4AddressFromServer
+        && getIpAddress(CMManagerShim::CmIPAddress) ==
+            CMManagerShim::UnspecifiedIpv4Address) {
+        // User defined IP address selected, but no valid address is stored.
+        // Just enable the UI IP editors, because CMManager will update the
+        // "IP address from server" flag by itself when a valid IP address
+        // is stored.
+        enableIpv4AddressFields(state);
+    } else {
+        // Save setting to CommsDat
+        mCmConnectionMethod->setBoolAttribute(
+            CMManagerShim::CmIPAddrFromServer,
+            ipv4AddressFromServer);
+        if (tryUpdate()) {
+            enableIpv4AddressFields(state);
+        }
+    }
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_CHANGEIPV4ADDRESSMODE_EXIT);
+}
+
+/*!
+    Saves IPv4 address to CommsDat.
+*/
+void CpWlanApAdvancedView::changeIpv4Address()
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_CHANGEIPV4ADDRESS_ENTRY);
+    
+    if (validateAndSaveIpAddress(
+        mIpv4Address,
+        CMManagerShim::CmIPAddress,
+        QAbstractSocket::IPv4Protocol)) {
+        // In case the IP address is empty or 0.0.0.0, CMManager changes the
+        // "IP address from server" flag to true. We need to refresh the UI to
+        // make sure we are in sync.
+        updateIpv4Group();
+    }
+
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_CHANGEIPV4ADDRESS_EXIT);
+}
+
+/*!
+    Saves IPv4 subnet mask to CommsDat.
+*/
+void CpWlanApAdvancedView::changeIpv4SubnetMask()
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_CHANGEIPV4SUBNETMASK_ENTRY);
+    
+    (void)validateAndSaveIpAddress(
+        mIpv4SubnetMask,
+        CMManagerShim::CmIPNetmask,
+        QAbstractSocket::IPv4Protocol);
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_CHANGEIPV4SUBNETMASK_EXIT);
+}
+
+/*!
+    Saves IPv4 gateway to CommsDat.
+*/
+void CpWlanApAdvancedView::changeIpv4Gateway()
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_CHANGEIPV4GATEWAY_ENTRY);
+    
+    (void)validateAndSaveIpAddress(
+        mIpv4Gateway,
+        CMManagerShim::CmIPGateway,
+        QAbstractSocket::IPv4Protocol);
+
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_CHANGEIPV4GATEWAY_EXIT);
+}
+
+/*!
+    Handles change to IPv4 DNS mode (automatic/user defined).
+*/
+void CpWlanApAdvancedView::changeIpv4DnsMode(int state)
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_CHANGEIPV4DNSMODE_ENTRY);
+    
+    bool dnsAddressFromServer;
+    if (state == Qt::Checked) {
+        dnsAddressFromServer = true;
+    } else {
+        dnsAddressFromServer = false;
+    }
+    // Save setting to CommsDat
+    mCmConnectionMethod->setBoolAttribute(
+        CMManagerShim::CmIPDNSAddrFromServer,
+        dnsAddressFromServer);
+    if (tryUpdate()) {
+        enableIpv4DnsFields(state);
+    }
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_CHANGEIPV4DNSMODE_EXIT);
+}
+
+/*!
+    Saves IPv4 primary DNS address to CommsDat.
+*/
+void CpWlanApAdvancedView::changeIpv4PrimaryDnsAddress()
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_CHANGEIPV4PRIMARYDNSADDRESS_ENTRY);
+    
+    if (validateAndSaveIpAddress(
+        mIpv4DnsAddress1,
+        CMManagerShim::CmIPNameServer1,
+        QAbstractSocket::IPv4Protocol)) {
+        // Address saved successfully, update "DNS address from server" flag
+        mCmConnectionMethod->setBoolAttribute(
+            CMManagerShim::CmIPDNSAddrFromServer,
+            false);
+        if (tryUpdate()) {
+            // In case primary DNS address is empty or 0.0.0.0, CMManager will
+            // check secondary DNS address and in case it is a valid address,
+            // move it to the primary DNS address. We need to refresh the
+            // UI to make sure we are in sync. If tryUpdate() fails it does
+            // the refresh automatically, so only success case is handled
+            // here.
+            updateIpv4Group();            
+        }
+    }
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_CHANGEIPV4PRIMARYDNSADDRESS_EXIT);
+}
+
+/*!
+    Saves IPv4 secondary DNS address to CommsDat.
+*/
+void CpWlanApAdvancedView::changeIpv4SecondaryDnsAddress()
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_CHANGEIPV4SECONDARYDNSADDRESS_ENTRY);
+    
+    if (validateAndSaveIpAddress(
+        mIpv4DnsAddress2,
+        CMManagerShim::CmIPNameServer2,
+        QAbstractSocket::IPv4Protocol)) {
+        // Address saved successfully, update "DNS address from server" flag
+        mCmConnectionMethod->setBoolAttribute(
+            CMManagerShim::CmIPDNSAddrFromServer,
+            false);
+        if (tryUpdate()) {
+            // In case primary DNS address is empty or 0.0.0.0, CMManager will
+            // write the address there instead of secondary DNS address, so we
+            // need to refresh the UI to make sure we are in sync. If
+            // tryUpdate() fails it does the refresh automatically, so only
+            // success case is handled here.
+            updateIpv4Group();
+        }
+    }
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_CHANGEIPV4SECONDARYDNSADDRESS_EXIT);
+}
+
+/*!
+    Handles change to IPv6 DNS mode (automatic/well-known/user defined).
+*/
+void CpWlanApAdvancedView::changeIpv6DnsMode(int state)
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_CHANGEIPV6DNSMODE_ENTRY);
+    
+    // Update "DNS address from server" flag
+    if (state == Ipv6DnsTypeAutomatic) {
+        // Automatic
+        mCmConnectionMethod->setBoolAttribute(
+            CMManagerShim::CmIP6DNSAddrFromServer,
+            true);
+    } else {
+        // User defined or well-known address
+        mCmConnectionMethod->setBoolAttribute(
+            CMManagerShim::CmIP6DNSAddrFromServer,
+            false);
+        
+        if (state == Ipv6DnsTypeWellKnown) {
+            // Well-known address, set DNS addresses and update UI
+            mCmConnectionMethod->setStringAttribute(
+                CMManagerShim::CmIP6NameServer1,
+                CMManagerShim::KnownIpv6NameServer1);
+            mIpv6DnsAddress1->setContentWidgetData(
+                "text",
+                CMManagerShim::KnownIpv6NameServer1);
+            mCmConnectionMethod->setStringAttribute(
+                CMManagerShim::CmIP6NameServer2,
+                CMManagerShim::KnownIpv6NameServer2);
+            mIpv6DnsAddress2->setContentWidgetData(
+                "text",
+                CMManagerShim::KnownIpv6NameServer2);        
+        }
+    }
+
+    if (tryUpdate()) {
+        enableIpv6DnsFields(state);
+    }
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_CHANGEIPV6DNSMODE_EXIT);
+}
+
+/*!
+    Saves IPv6 primary DNS address to CommsDat.
+*/
+void CpWlanApAdvancedView::changeIpv6PrimaryDnsAddress()
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_CHANGEIPV6PRIMARYDNSADDRESS_ENTRY);
+    
+    if (validateAndSaveIpAddress(
+        mIpv6DnsAddress1,
+        CMManagerShim::CmIP6NameServer1,
+        QAbstractSocket::IPv6Protocol)) {
+        // Address saved successfully, update "DNS address from server" flag
+        mCmConnectionMethod->setBoolAttribute(
+            CMManagerShim::CmIP6DNSAddrFromServer,
+            false);
+        if (tryUpdate()) {
+            // In case primary DNS address is empty or 0:0:0:0:0:0:0:0,
+            // CMManager will check secondary DNS address and in case it is a
+            // valid address, move it to the primary DNS address. We need to
+            // refresh the UI to make sure we are in sync. If tryUpdate()
+            // fails it does the refresh automatically, so only success case
+            // is handled here.
+            updateIpv6Group();            
+        }
+    }
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_CHANGEIPV6PRIMARYDNSADDRESS_EXIT);
+}
+
+/*!
+    Saves IPv6 secondary DNS address to CommsDat.
+*/
+void CpWlanApAdvancedView::changeIpv6SecondaryDnsAddress()
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_CHANGEIPV6SECONDARYDNSADDRESS_ENTRY);
+    
+    if (validateAndSaveIpAddress(
+        mIpv6DnsAddress2,
+        CMManagerShim::CmIP6NameServer2,
+        QAbstractSocket::IPv6Protocol)) {
+        // Address saved successfully, update "DNS address from server" flag
+        mCmConnectionMethod->setBoolAttribute(
+            CMManagerShim::CmIP6DNSAddrFromServer,
+            false);
+        if (tryUpdate()) {
+            // In case primary DNS address is empty or 0:0:0:0:0:0:0:0,
+            // CMManager will write the address there instead of secondary DNS
+            // address, so we need to refresh the UI to make sure we are in
+            // sync. If tryUpdate() fails it does the refresh automatically,
+            // so only success case is handled here.
+            updateIpv6Group();
+        }
+    }
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_CHANGEIPV6SECONDARYDNSADDRESS_EXIT);
+}
+
+/*!
+    Saves proxy server address to CommsDat.
+*/
+void CpWlanApAdvancedView::changeProxyServer()
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_CHANGEPROXYSERVER_ENTRY);
+    
+    QString proxyServer = mProxyServer->contentWidgetData("text").toString();
+    mCmConnectionMethod->setStringAttribute(
+        CMManagerShim::CmProxyServerName,
+        proxyServer);
+    if (tryUpdate()) {
+        // If proxy server name is empty, CMManager will also clear the
+        // proxy port. Therefore UI needs to be updated.
+        updateProxyGroup();
+    }
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_CHANGEPROXYSERVER_EXIT);
+}
+
+/*!
+    Saves proxy port to CommsDat.
+*/
+void CpWlanApAdvancedView::changeProxyPort()
+{
+    OstTraceFunctionEntry0(CPWLANAPADVANCEDVIEW_CHANGEPROXYPORT_ENTRY);
+    
+    uint proxyPort = mProxyPort->contentWidgetData("text").toInt();
+    if (proxyPort <= 65535) {
+        if (proxyPort == 0) {
+            // Don't show zero
+            mProxyPort->setContentWidgetData("text", "");
+        }
+        mCmConnectionMethod->setIntAttribute(
+            CMManagerShim::CmProxyPortNumber,
+            proxyPort);
+        (void)tryUpdate();
+    } else {
+        // Inform user of invalid value
+        showMessageBox(
+            HbMessageBox::MessageTypeInformation,
+            hbTrId("txt_occ_info_invalid_input"));
+        // Restore previous setting
+        proxyPort = mCmConnectionMethod->getIntAttribute(
+            CMManagerShim::CmProxyPortNumber);
+        if (proxyPort > 0) {
+            mProxyPort->setContentWidgetData("text", QVariant(proxyPort));
+        } else {
+            mProxyPort->setContentWidgetData("text", "");
+        }
+    }
+    
+    OstTraceFunctionExit0(CPWLANAPADVANCEDVIEW_CHANGEPROXYPORT_EXIT);
+}
--- a/cmmanager/cpwlanapplugin/src/cpwlanapplugin.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cpwlanapplugin/src/cpwlanapplugin.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -17,7 +17,7 @@
 */
 
 // System includes
-#include <QtCore>
+#include <HbTranslator>
 #include <cmmanager_shim.h>
 #include <cmconnectionmethod_shim.h>
 
@@ -46,19 +46,12 @@
     Constructor.
 */
 CpWlanApPlugin::CpWlanApPlugin() :
-    mTranslator(0),
+    mTranslator(new HbTranslator("cpapplugin")),
     mCmManager(0),
     mCmConnectionMethod(0)
 {
     OstTraceFunctionEntry0(CPWLANAPPLUGIN_CPWLANAPPLUGIN_ENTRY);
 
-    // Install localization
-    QString lang = QLocale::system().name();
-    QString path = "z:/resource/qt/translations/";
-    mTranslator = new QTranslator(this);
-    mTranslator->load(path + "cpapplugin_" + lang);
-    qApp->installTranslator(mTranslator);
-    
     OstTraceFunctionExit0(CPWLANAPPLUGIN_CPWLANAPPLUGIN_EXIT);
 }
 
--- a/cmmanager/cpwlanapplugin/src/cpwlanapview.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cpwlanapplugin/src/cpwlanapview.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -32,6 +32,7 @@
 #include <HbPopup>
 #include <HbMessageBox>
 #include <HbAction>
+#include <HbStringUtil>
 #include <wlanmgmtcommon.h>
 #include <cpitemdatahelper.h>
 #include <cpsettingformitemdata.h>
@@ -79,6 +80,7 @@
         mWlanNetworkNameItem(0),
         mNetworkStatusItem(0),
         mNetworkModeItem(0),
+        mAdHocChannelItem(0),
         mSecurityModeItem(0),
         mHomepageItem(0),
         mSecuritySettingsGroupItem(0),
@@ -221,28 +223,15 @@
         SLOT(networkModeChanged(int)));
     mApSettingsGroupItem->appendChild(mNetworkModeItem);
     
+    // Ad-hoc channel
+    // Added dynamically according to set network mode
+    
     // Security mode
     mSecurityModeItem = new CpSettingFormItemData(
         HbDataFormModelItem::ComboBoxItem,
         hbTrId("txt_occ_setlabel_wlan_security_mode"));
-    // Load WLAN security plugins and construct map
-    mSecurityModeMap.insert(0, NULL); // open mode
-    // Load all security plugins and construct map
-    loadSecurityPlugins();
-    // Add items to combobox
-    QStringList securityModeItems;
-    foreach (CpWlanSecurityPluginInterface *plugin, mSecurityModeMap) {
-        if (plugin) {
-            // Add security mode from plugin
-            securityModeItems
-                << hbTrId(plugin->securityModeTextId().toLatin1());
-        } else {
-            // Add open mode
-            securityModeItems
-                << hbTrId("txt_occ_setlabel_wlan_security_mode_val_open");
-        }
-    }
-    mSecurityModeItem->setContentWidgetData("items", securityModeItems);
+    // Security modes added dynamically according to set network mode
+
     // Connect signal and add item to group
     mForm->addConnection(
         mSecurityModeItem,
@@ -296,28 +285,19 @@
         mNetworkStatusMap.key(scanSsid));
     
     // Network mode
-    int networkMode =  mCmConnectionMethod->getIntAttribute(
-        CMManagerShim::WlanConnectionMode);
+    CMManagerShim::WlanConnMode networkMode =
+		static_cast<CMManagerShim::WlanConnMode>
+      	(mCmConnectionMethod->getIntAttribute(
+            CMManagerShim::WlanConnectionMode));
     mNetworkModeItem->setContentWidgetData(
         "currentIndex",
         mNetworkModeMap.key(networkMode));
     
+    // Ad-hoc channel
+    updateAdHocChannelItem(networkMode);
+    
     // Security mode
-    QVariant securityMode = mCmConnectionMethod->getIntAttribute(
-        CMManagerShim::WlanSecurityMode);
-    // Iterate through the map to find correct security plugin and set
-    // mode index
-    int securityModeIndex = 0;
-    QMapIterator<int, CpWlanSecurityPluginInterface *> i(mSecurityModeMap);
-    while (i.hasNext()) {
-        i.next();
-        if (i.value()
-            && i.value()->securityMode() == securityMode.toInt()) {
-            securityModeIndex = i.key();
-        }
-    }
-    mSecurityModeItem->setContentWidgetData("currentIndex",
-        securityModeIndex);
+    updateSecurityModeItem(networkMode);
     
     // Homepage
     QString homepage = mCmConnectionMethod->getStringAttribute(
@@ -330,7 +310,8 @@
 /*!
     Loads all WLAN security plugins.
 */
-void CpWlanApView::loadSecurityPlugins()
+void CpWlanApView::loadSecurityPlugins(
+    CMManagerShim::WlanConnMode networkMode)
 {
     OstTraceFunctionEntry0(CPWLANAPVIEW_LOADSECURITYPLUGINS_ENTRY);
     
@@ -357,12 +338,16 @@
         }
     }
     
-    // Add security plugins to map
+    // Add security plugins to map. If network mode is ad-hoc, only WEP
+    // is allowed.
     int i;
     i = mSecurityModeMap.size();
     foreach (CpWlanSecurityPluginInterface *plugin, plugins) {
-        mSecurityModeMap.insert(i, plugin);
-        i++;
+        if (networkMode != CMManagerShim::Adhoc
+            || plugin->securityMode() == CMManagerShim::WlanSecModeWep) {
+            mSecurityModeMap.insert(i, plugin);
+            i++;
+        }
     }
     
     OstTraceFunctionExit0(CPWLANAPVIEW_LOADSECURITYPLUGINS_EXIT);
@@ -473,6 +458,132 @@
 }
 
 /*!
+    Updates Ad-hoc channel item. Setting item is shown if network mode is
+    ad-hoc, otherwise it is not shown.
+ */
+void CpWlanApView::updateAdHocChannelItem(
+    CMManagerShim::WlanConnMode networkMode)
+{
+    if (networkMode == CMManagerShim::Infra) {
+        // Infrastructure
+        if (mAdHocChannelItem) {
+            mApSettingsGroupItem->removeChild(
+                mApSettingsGroupItem->indexOf(mAdHocChannelItem));
+            mAdHocChannelItem = NULL;
+        }
+    } else {
+        // Ad-hoc
+        if (!mAdHocChannelItem) {
+            // Ad-hoc channel item not shown, add it
+            mAdHocChannelItem = new CpSettingFormItemData(
+                HbDataFormModelItem::ComboBoxItem,
+                hbTrId("txt_occ_setlabel_adhoc_channel"));
+            // Add items to combobox
+            QStringList adHocChannelItems;
+            adHocChannelItems
+                << hbTrId("txt_occ_setlabel_adhoc_channel_val_automatic");
+            for (int i = WlanAdHocChannelMinValue;
+                i <= WlanAdHocChannelMaxValue;
+                i++) {
+                QString channel;
+                channel.setNum(i);
+                adHocChannelItems << HbStringUtil::convertDigits(channel);
+            }
+            mAdHocChannelItem->setContentWidgetData(
+                "items",
+                adHocChannelItems);
+            // Connect signal and add item to group
+            mForm->addConnection(
+                mAdHocChannelItem,
+                SIGNAL(currentIndexChanged(int)),
+                this,
+                SLOT(adHocChannelChanged(int)));
+            // Add item after the network mode item
+            mApSettingsGroupItem->insertChild(
+                mApSettingsGroupItem->indexOf(mNetworkModeItem) + 1,
+                mAdHocChannelItem);
+        }
+        // Update ad-hoc item
+        int adHocChannelId = mCmConnectionMethod->getIntAttribute(
+            CMManagerShim::WlanChannelID);
+        mAdHocChannelItem->setContentWidgetData(
+            "currentIndex",
+            adHocChannelId);
+    }
+}
+
+/*!
+    Updates security mode item.
+ */
+void CpWlanApView::updateSecurityModeItem(
+    CMManagerShim::WlanConnMode networkMode)
+{
+    // Load WLAN security plugins and construct map
+    mSecurityModeMap.clear();
+    mSecurityModeMap.insert(0, NULL); // open mode
+    loadSecurityPlugins(networkMode);
+    
+    // Add items to combobox
+    QStringList securityModeItems;
+    foreach (CpWlanSecurityPluginInterface *plugin, mSecurityModeMap) {
+        if (plugin) {
+            // Add security mode from plugin
+            securityModeItems
+                << hbTrId(plugin->securityModeTextId().toLatin1());
+        } else {
+            // Add open mode
+            securityModeItems
+                << hbTrId("txt_occ_setlabel_wlan_security_mode_val_open");
+        }
+    }
+    // Remove connection before setting new content, because combobox
+    // will emit currentIndexChanged signal and we don't want that.
+    mForm->removeConnection(
+        mSecurityModeItem,
+        SIGNAL(currentIndexChanged(int)),
+        this,
+        SLOT(securityModeChanged(int)));
+    mSecurityModeItem->setContentWidgetData("items", securityModeItems);
+    mForm->addConnection(
+        mSecurityModeItem,
+        SIGNAL(currentIndexChanged(int)),
+        this,
+        SLOT(securityModeChanged(int)));
+    
+    uint securityMode = mCmConnectionMethod->getIntAttribute(
+        CMManagerShim::WlanSecurityMode);
+    // Iterate through the map to find correct security plugin and set
+    // mode index
+    int securityModeIndex = 0;
+    QMapIterator<int, CpWlanSecurityPluginInterface *> i(mSecurityModeMap);
+    while (i.hasNext()) {
+        i.next();
+        if (i.value()
+            && i.value()->securityMode() == securityMode) {
+            securityModeIndex = i.key();
+        }
+    }
+    mSecurityModeItem->setContentWidgetData("currentIndex",
+        securityModeIndex);
+    
+    if (securityMode != CMManagerShim::WlanSecModeOpen
+        && securityModeIndex == 0) {
+        // Security plugin implementing the selected security mode not found,
+        // set security mode to open also in CommsDat  
+        mCmConnectionMethod->setIntAttribute(
+            CMManagerShim::WlanSecurityMode,
+            CMManagerShim::WlanSecModeOpen);
+        // Try update
+        try {
+            mCmConnectionMethod->update();
+        }
+        catch (const std::exception&) {
+            // Error in update, but can't show error notes at this point
+        }
+    }
+}
+
+/*!
     Stores connection name.
 */
 void CpWlanApView::connectionNameChanged()
@@ -547,7 +658,8 @@
     OstTraceFunctionEntry0(CPWLANAPVIEW_NETWORKSTATUSCHANGED_ENTRY);
     
     // Update to CommsDat
-    mCmConnectionMethod->setBoolAttribute(CMManagerShim::WlanScanSSID,
+    mCmConnectionMethod->setBoolAttribute(
+        CMManagerShim::WlanScanSSID,
         mNetworkStatusMap.value(index));
     (void)tryUpdate();
     
@@ -562,11 +674,36 @@
     OstTraceFunctionEntry0(CPWLANAPVIEW_NETWORKMODECHANGED_ENTRY);
     
     // Update to CommsDat
-    mCmConnectionMethod->setIntAttribute(CMManagerShim::WlanConnectionMode,
+    mCmConnectionMethod->setIntAttribute(
+        CMManagerShim::WlanConnectionMode,
         mNetworkModeMap.value(index));
+    if (tryUpdate()) {
+        // If mode is ad-hoc, ad-hoc channel item must be shown
+        CMManagerShim::WlanConnMode networkMode =
+            static_cast<CMManagerShim::WlanConnMode>
+                (mNetworkModeMap.value(index));
+        updateAdHocChannelItem(networkMode);
+		// Also security mode list may need updating
+        updateSecurityModeItem(networkMode);
+    }
+    
+    OstTraceFunctionExit0(CPWLANAPVIEW_NETWORKMODECHANGED_EXIT);
+}
+
+/*!
+    Stores ad-hoc channel ID.
+*/
+void CpWlanApView::adHocChannelChanged(int index)
+{
+    OstTraceFunctionEntry0(CPWLANAPVIEW_ADHOCCHANNELCHANGED_ENTRY);
+    
+    // Update to CommsDat
+    mCmConnectionMethod->setIntAttribute(
+        CMManagerShim::WlanChannelID,
+        index);
     (void)tryUpdate();
     
-    OstTraceFunctionExit0(CPWLANAPVIEW_NETWORKMODECHANGED_EXIT);
+    OstTraceFunctionExit0(CPWLANAPVIEW_ADHOCCHANNELCHANGED_EXIT);
 }
 
 /*!
@@ -580,10 +717,12 @@
     CpWlanSecurityPluginInterface *plugin = mSecurityModeMap.value(index);
     // Update to CommsDat
     if (plugin) {
-        mCmConnectionMethod->setIntAttribute(CMManagerShim::WlanSecurityMode,
+        mCmConnectionMethod->setIntAttribute(
+            CMManagerShim::WlanSecurityMode,
             plugin->securityMode());
     } else {
-        mCmConnectionMethod->setIntAttribute(CMManagerShim::WlanSecurityMode,
+        mCmConnectionMethod->setIntAttribute(
+            CMManagerShim::WlanSecurityMode,
             CMManagerShim::WlanSecModeOpen);
     }
     (void)tryUpdate();
--- a/cmmanager/cpwlanapplugin/tsrc/ut/hbautotest.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cpwlanapplugin/tsrc/ut/hbautotest.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -48,8 +48,7 @@
             Qt::NoButton, 
             Qt::NoModifier);
             QSpontaneKeyEvent::setSpontaneous(&me);
-            qApp->notify((window->viewport()), &me);
-            QCoreApplication::sendPostedEvents();
+            QCoreApplication::sendEvent(window->viewport(), &me);
             QTest::qWait(1);
     } else {
             HbAutoTestMouseEvent me (
@@ -60,8 +59,7 @@
             Qt::NoButton, 
             Qt::NoModifier);
             QSpontaneKeyEvent::setSpontaneous(&me);
-            qApp->notify((window->viewport()), &me);
-            QCoreApplication::sendPostedEvents();
+            QCoreApplication::sendEvent(window->viewport(), &me);
             QTest::qWait(1);
 
     }
@@ -94,9 +92,7 @@
     Qt::NoModifier);
 
     QSpontaneKeyEvent::setSpontaneous(&me);
-    qApp->notify((window->viewport()), &me);
-    QCoreApplication::sendPostedEvents();
-    QCoreApplication::sendPostedEvents();
+    QCoreApplication::sendEvent(window->viewport(), &me);
     QTest::qWait(1);
 }
 
@@ -123,8 +119,7 @@
     Qt::NoModifier);
 
     QSpontaneKeyEvent::setSpontaneous(&me);
-    qApp->notify((window->viewport()), &me);
-    QCoreApplication::sendPostedEvents();
+    QCoreApplication::sendEvent(window->viewport(), &me);
 
     QTest::qWait(1);
     QTest::qWait(1);
@@ -152,15 +147,12 @@
     Qt::LeftButton, 
     Qt::NoModifier);
     QSpontaneKeyEvent::setSpontaneous(&me);
-    qApp->notify((window->viewport()), &me);
-    QCoreApplication::sendPostedEvents();
-    //QTime currentTime = QTime::currentTime();
-    //qDebug() << currentTime.toString("hh:mm:ss.zzz") << ": Left button down";
-    QTest::qWait(1);
+    QCoreApplication::sendEvent(window->viewport(), &me);
 
     if (delay!=-1) {
         QTest::qWait(delay);
     }
+
     HbAutoTestMouseEvent me2 (
     QEvent::MouseButtonRelease, 
     targetPoint.toPoint(), 
@@ -170,10 +162,7 @@
     Qt::NoModifier);
 
     QSpontaneKeyEvent::setSpontaneous(&me2);
-    qApp->notify((window->viewport()), &me2);
-    QCoreApplication::sendPostedEvents();
-    //currentTime = QTime::currentTime();
-    //qDebug() << currentTime.toString("hh:mm:ss.zzz") << ": Left button up";
+    QCoreApplication::sendEvent(window->viewport(), &me2);
 
     QTest::qWait(1);
     QTest::qWait(1);
@@ -221,8 +210,8 @@
                             Qt::NoModifier);   
 
         QSpontaneKeyEvent::setSpontaneous(&me);
-        qApp->notify((window->viewport()), &me);
-        QCoreApplication::sendPostedEvents();
+        QCoreApplication::sendEvent(window->viewport(), &me);
+        QTest::qWait(1);
     }
 
     QCursor::setPos(window->mapToGlobal(targetPoint.toPoint()));
@@ -235,8 +224,7 @@
                             Qt::LeftButton, 
                             Qt::NoModifier);   
     QSpontaneKeyEvent::setSpontaneous(&me);
-    qApp->notify((window->viewport()), &me);
-    QCoreApplication::sendPostedEvents();
+    QCoreApplication::sendEvent(window->viewport(), &me);
 }
 
 
@@ -255,7 +243,7 @@
 
         HbAutoTestKeyEvent a(press ? QEvent::KeyPress : QEvent::KeyRelease, code, modifier, text, repeat);
         QSpontaneKeyEvent::setSpontaneous(&a);
-        if (!qApp->notify(widget, &a))
+        if (!QCoreApplication::sendEvent(widget, &a))
             QTest::qWarn("Keyboard event not accepted by receiving widget");
     }
 
--- a/cmmanager/cpwlanapplugin/tsrc/ut/testcpwlanapplugin.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cpwlanapplugin/tsrc/ut/testcpwlanapplugin.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -24,12 +24,16 @@
 #include <HbDataForm>
 #include <HbDataFormModel>
 #include <HbDataFormModelItem>
+#include <HbDataFormViewItem>
+#include <HbModelIterator>
+#include <QSharedPointer>
 #include <QtTest/QtTest>
 #include <cpbearerapplugininterface.h>
 #include <cmmanager_shim.h>
 #include <cmconnectionmethod_shim.h>
 
 #include "cpwlanapview.h"
+#include "cpwlanapadvancedview.h"
 
 #include "hbautotest.h"
 #include "testcpwlanapplugin.h"
@@ -55,33 +59,23 @@
 static const int waitTime = 10;
 
 // UI coordinates
-static const QPoint connectionNameLabel(175, 70);
-
-static const QPoint connectionNameLineEdit(330, 110);
-
-static const QPoint wlanNetworkNameLineEdit(330, 190);
+static const QPoint scrollMiddle(350, 280);
+static const QPoint scrollTop(350, 50);
+static const QPoint scrollBottom(350, 520);
 
-static const QPoint networkStatusComboBox(175, 270);
-static const QPoint networkStatusPublic(175, 325);
-static const QPoint networkStatusHidden(175, 375);
-
-static const QPoint networkModeComboBox(175, 365);
-static const QPoint networkModeIntrastructure(175, 415);
-static const QPoint networkModeAdHoc(175, 465);
+// Use positive offset if dropdown opens under the combobox
+static const QPoint comboBoxItemOffset(0, 55);
+// Use negative offset if dropdown opens above the combobox
+static const QPoint comboBoxItemNegativeOffset(0, -50);
 
-static const QPoint securityModeComboBox(175, 460);
-#ifndef WLAN_SECURITY_PLUGINS_AVAILABLE
-static const QPoint securityModeOpen(175, 510);
-#else
-static const QPoint securityModeOpen(175, 260);
-static const QPoint securityModeWep(175, 305);
-static const QPoint securityModeWpaWpa2(175, 355);
-static const QPoint securityModeWpa2(175, 405);
-#endif
+static const QPoint exitEditorOffset(-10, -20);
+
+static const QPoint messageBoxOkButtonOffset(160, 140);
 
-static const QPoint homepageLineEdit(330, 545);
-
-static const QPoint messageBoxOkButton(170, 320);
+// Advanced settings groups
+static const QPoint ipv4Group(160, 10);
+static const QPoint ipv6Group(160, 60);
+static const QPoint proxyGroup(160, 110);
 
 // -----------------------------------------------------------------------------
 // FRAMEWORK FUNCTIONS
@@ -121,8 +115,8 @@
     
     // Load plugin
     QDir dir(pluginDir);
-    QPluginLoader loader(dir.absoluteFilePath(pluginName));
-    mPlugin = qobject_cast<CpBearerApPluginInterface *>(loader.instance());
+    mPluginLoader = new QPluginLoader(dir.absoluteFilePath(pluginName));
+    mPlugin = qobject_cast<CpBearerApPluginInterface *>(mPluginLoader->instance());
     QVERIFY(mPlugin != NULL);
     
     // Verify plugin bearer type
@@ -130,6 +124,8 @@
     
     // Create WLAN settings view (connection method ID given)
     subCreateSettingsView(testApId);
+    
+    subGetUiWidgets();
 }
 
 /**
@@ -139,6 +135,11 @@
 {
     delete mMainWindow;
     mMainWindow = 0;
+    
+    // Force unloading of plugin
+    mPluginLoader->unload();
+    delete mPluginLoader;
+    mPluginLoader = 0;
 }
 
 /**
@@ -168,15 +169,16 @@
     QFETCH(QString, string);
     QFETCH(QString, result);
     
-    HbAutoTest::mouseClick(mMainWindow, mTestView, connectionNameLineEdit);
+    HbAutoTest::mouseClick(mMainWindow, mConnectionNameWidget);
     
     // Erase old string
-    subClearLineEdit(CMManagerShim::CmNameLength);
+    QString text = mTestView->mConnectionNameItem->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
     
     // Enter new string
     HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
 
-    HbAutoTest::mouseClick(mMainWindow, mTestView, connectionNameLabel);
+    HbAutoTest::mouseClick(mMainWindow, mConnectionNameWidget, exitEditorOffset);
 
     // Verify both commsdat and UI widget
     subVerifyString(
@@ -212,15 +214,20 @@
     QString previous = 
         mTestView->mConnectionNameItem->contentWidgetData("text").toString();
     
-    HbAutoTest::mouseClick(mMainWindow, mTestView, connectionNameLineEdit);    
+    HbAutoTest::mouseClick(mMainWindow, mConnectionNameWidget);
+
     // Erase old string
-    subClearLineEdit(CMManagerShim::CmNameLength);
+    QString text = mTestView->mConnectionNameItem->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
     
-    HbAutoTest::mouseClick(mMainWindow, mTestView, connectionNameLabel);
+    HbAutoTest::mouseClick(mMainWindow, mConnectionNameWidget, exitEditorOffset);
 
     QTest::qWait(100);
     // Dismiss messagebox
-    HbAutoTest::mouseClick(mMainWindow, mTestView, messageBoxOkButton);
+    HbAutoTest::mouseClick(
+        mMainWindow,
+        mTestView->mMessageBox.data(),
+        messageBoxOkButtonOffset);
     
     // Verify both commsdat and UI widget
     subVerifyString(
@@ -237,15 +244,16 @@
     QFETCH(QString, string);
     QFETCH(QString, result);
     
-    HbAutoTest::mouseClick(mMainWindow, mTestView, wlanNetworkNameLineEdit);
+    HbAutoTest::mouseClick(mMainWindow, mWlanNetworkNameWidget);
     
     // Erase old string
-    subClearLineEdit(CMManagerShim::WlanSSIDLength);
+    QString text = mTestView->mWlanNetworkNameItem->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
     
     // Enter new string
     HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
 
-    HbAutoTest::mouseClick(mMainWindow, mTestView, connectionNameLabel);
+    HbAutoTest::mouseClick(mMainWindow, mWlanNetworkNameWidget, exitEditorOffset);
 
     // Verify both commsdat and UI widget
     subVerifyString(
@@ -281,16 +289,20 @@
     QString previous = 
         mTestView->mWlanNetworkNameItem->contentWidgetData("text").toString();
     
-    HbAutoTest::mouseClick(mMainWindow, mTestView, wlanNetworkNameLineEdit);
+    HbAutoTest::mouseClick(mMainWindow, mWlanNetworkNameWidget);
     
     // Erase old string
-    subClearLineEdit(CMManagerShim::WlanSSIDLength);
+    QString text = mTestView->mWlanNetworkNameItem->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
     
-    HbAutoTest::mouseClick(mMainWindow, mTestView, connectionNameLabel);
+    HbAutoTest::mouseClick(mMainWindow, mWlanNetworkNameWidget, exitEditorOffset);
 
     QTest::qWait(100);
     // Dismiss messagebox
-    HbAutoTest::mouseClick(mMainWindow, mTestView, messageBoxOkButton);
+    HbAutoTest::mouseClick(
+        mMainWindow,
+        mTestView->mMessageBox.data(),
+        messageBoxOkButtonOffset);
     
     // Verify both commsdat and UI widget
     subVerifyString(
@@ -304,14 +316,17 @@
  */
 void TestCpWlanApPlugin::tcChangeNetworkStatus()
 {
+    QPointF publicPointOffset = comboBoxItemOffset;
+    QPointF hiddenPointOffset = comboBoxItemOffset * 2;
+    
     // Set network status to hidden
-    HbAutoTest::mouseClick(mMainWindow, mTestView, networkStatusComboBox, 100);
-    HbAutoTest::mouseClick(mMainWindow, mTestView, networkStatusHidden, 100);
+    HbAutoTest::mouseClick(mMainWindow, mNetworkStatusWidget);
+    HbAutoTest::mouseClick(mMainWindow, mNetworkStatusWidget, hiddenPointOffset, 100);
     subVerifyNetworkStatus(HiddenStatus);
 
     // Set network status to public
-    HbAutoTest::mouseClick(mMainWindow, mTestView, networkStatusComboBox, 100);
-    HbAutoTest::mouseClick(mMainWindow, mTestView, networkStatusPublic, 100);
+    HbAutoTest::mouseClick(mMainWindow, mNetworkStatusWidget);
+    HbAutoTest::mouseClick(mMainWindow, mNetworkStatusWidget, publicPointOffset, 100);
     subVerifyNetworkStatus(PublicStatus);
 }
 
@@ -320,14 +335,17 @@
  */
 void TestCpWlanApPlugin::tcChangeNetworkMode()
 {
+    QPointF infraPointOffset = comboBoxItemOffset;
+    QPointF adHocPointOffset = comboBoxItemOffset * 2;
+    
     // Set network mode to ad-hoc
-    HbAutoTest::mouseClick(mMainWindow, mTestView, networkModeComboBox, 100);
-    HbAutoTest::mouseClick(mMainWindow, mTestView, networkModeAdHoc, 100);
+    HbAutoTest::mouseClick(mMainWindow, mNetworkModeWidget);
+    HbAutoTest::mouseClick(mMainWindow, mNetworkModeWidget, adHocPointOffset, 100);
     subVerifyUint(CMManagerShim::WlanConnectionMode, CMManagerShim::Adhoc);
 
     // Set network mode to infrastructure
-    HbAutoTest::mouseClick(mMainWindow, mTestView, networkModeComboBox, 100);
-    HbAutoTest::mouseClick(mMainWindow, mTestView, networkModeIntrastructure, 100);
+    HbAutoTest::mouseClick(mMainWindow, mNetworkModeWidget);
+    HbAutoTest::mouseClick(mMainWindow, mNetworkModeWidget, infraPointOffset, 100);
     subVerifyUint(CMManagerShim::WlanConnectionMode, CMManagerShim::Infra);
 }
 
@@ -337,37 +355,52 @@
 void TestCpWlanApPlugin::tcChangeSecurityMode()
 {
 #ifdef WLAN_SECURITY_PLUGINS_AVAILABLE
-    // Ensure security mode is open
-    HbAutoTest::mouseClick(mMainWindow, mTestView, securityModeComboBox, 100);
+    QPointF openPointOffset = comboBoxItemNegativeOffset * 4;
+    QPointF wepPointOffset = comboBoxItemNegativeOffset * 3;
+    QPointF wpaPointOffset = comboBoxItemNegativeOffset * 2;
+    QPointF wpa2PointOffset = comboBoxItemNegativeOffset;
+#else
+    QPointF openPointOffset = comboBoxItemNegativeOffset;
+#endif
+    
+#ifdef WLAN_SECURITY_PLUGINS_AVAILABLE
+    // Set security mode to WEP
+    HbAutoTest::mouseClick(mMainWindow, mSecurityModeWidget);
     QTest::qWait(100);
-    HbAutoTest::mouseClick(mMainWindow, mTestView, securityModeOpen, 100);
-    subVerifyUint(
-        CMManagerShim::WlanSecurityMode,
-        CMManagerShim::WlanSecModeOpen);
-
-    QTest::qWait(1000);
-
-    // Set security mode to WEP
-    HbAutoTest::mouseClick(mMainWindow, mTestView, securityModeComboBox, 100);
-    QTest::qWait(100);
-    HbAutoTest::mouseClick(mMainWindow, mTestView, securityModeWep, 100);
+    HbAutoTest::mouseClick(mMainWindow, mSecurityModeWidget, wepPointOffset, 100);
     subVerifyUint(
         CMManagerShim::WlanSecurityMode,
         CMManagerShim::WlanSecModeWep);
     
     QTest::qWait(1000);
 #endif
-    
     // Set security mode to open
-    HbAutoTest::mouseClick(mMainWindow, mTestView, securityModeComboBox, 100);
+    HbAutoTest::mouseClick(mMainWindow, mSecurityModeWidget);
     QTest::qWait(100);
-    HbAutoTest::mouseClick(mMainWindow, mTestView, securityModeOpen, 100);
+    HbAutoTest::mouseClick(mMainWindow, mSecurityModeWidget, openPointOffset, 100);
     subVerifyUint(
         CMManagerShim::WlanSecurityMode,
         CMManagerShim::WlanSecModeOpen);
 }
 
 /**
+ * Scrolls the tested view to the bottom.
+ */
+void TestCpWlanApPlugin::tcScrollToBottom()
+{
+    subScrollToBottom();
+}
+
+/**
+ * Gets UI widget pointers because homepage view item may have been
+ * created before it was visible on the UI.
+ */
+void TestCpWlanApPlugin::tcGetUiWidgets()
+{
+    subGetUiWidgets();
+}
+
+/**
  * Tests changing of homepage.
  */
 void TestCpWlanApPlugin::tcChangeHomepage()
@@ -375,7 +408,7 @@
     QFETCH(QString, string);
     QFETCH(QString, result);
     
-    HbAutoTest::mouseClick(mMainWindow, mTestView, homepageLineEdit);
+    HbAutoTest::mouseClick(mMainWindow, mHomepageWidget);
     
     // Erase old string
     QString text = mTestView->mHomepageItem->contentWidgetData("text").toString();
@@ -384,7 +417,7 @@
     // Enter new string
     HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
 
-    HbAutoTest::mouseClick(mMainWindow, mTestView, connectionNameLabel);
+    HbAutoTest::mouseClick(mMainWindow, mHomepageWidget, exitEditorOffset);
 
     // Verify both commsdat and UI widget
     subVerifyString(
@@ -401,10 +434,9 @@
     QTest::addColumn<QString>("string");
     QTest::addColumn<QString>("result");
   
-// Doesn't work always, view goes blank sometimes, Orbit bug?
-//    QTest::newRow("long")
-//        << "http://developer.symbian.org/main/documentation/reference/s^3/doc_source/AboutSymbianOSLibrary9.6/index.html"
-//        << "http://developer.symbian.org/main/documentation/reference/s^3/doc_source/AboutSymbianOSLibrary9.6/index.html";
+    QTest::newRow("long")
+        << "http://developer.symbian.org/main/documentation/reference/s^3/doc_source/AboutSymbianOSLibrary9.6/index.html"
+        << "http://developer.symbian.org/main/documentation/reference/s^3/doc_source/AboutSymbianOSLibrary9.6/index.html";
     QTest::newRow("basic") // last one should always fit on one line in UI
         << "http://www.symbian.org/"
         << "http://www.symbian.org/";
@@ -414,9 +446,9 @@
 }
 
 /**
- * Tests advanced settings view (which is currently empty).
+ * Opens advanced settings view.
  */
-void TestCpWlanApPlugin::tcAdvancedSettings()
+void TestCpWlanApPlugin::tcOpenAdvancedSettingsView()
 {
     // Launch advanced settings view
     bool status = connect(
@@ -426,9 +458,781 @@
         SLOT(menuActionTriggered(HbAction *)));
     Q_ASSERT(status);
     emit menuActionTriggered(mTestView->mAdvancedSettingsAction);
+    
+    QTest::qWait(1000);
+    
+    mTestViewAdvanced = static_cast<CpWlanApAdvancedView *>(mMainWindow->currentView());
+}
 
-    QTest::qWait(2000);
+/**
+ * Expands the IPv4 settings group and gets UI widget pointers.
+ */
+void TestCpWlanApPlugin::tcExpandIpv4SettingsAndGetUiWidgets()
+{
+    HbAutoTest::mouseClick(mMainWindow, mTestViewAdvanced, ipv4Group);
+    
+    QTest::qWait(500);
+
+    subGetAdvancedUiWidgets(0);
+}
+
+/**
+ * Tests enabling of automatic phone IP address.
+ */
+void TestCpWlanApPlugin::tcEnableAutomaticIpv4Address()
+{
+    Qt::CheckState state = static_cast<Qt::CheckState>
+        (mTestViewAdvanced->mIpv4Automatic->contentWidgetData("checkState").toInt());
+    if (state == Qt::Checked) {
+        // Disable automatic IP address
+        HbAutoTest::mouseClick(mMainWindow, mIpv4AddressAutomaticWidget);
+    }
+    // Enable automatic IP address
+    HbAutoTest::mouseClick(mMainWindow, mIpv4AddressAutomaticWidget);
+    subVerifyBool(
+        CMManagerShim::CmIPAddrFromServer,
+        true);
+    
+    // Ensure that editing the IP address is not allowed
+    HbAutoTest::mouseClick(mMainWindow, mIpv4AddressWidget);
+    HbAutoTest::mouseClick(mMainWindow, mIpv4SubnetMaskWidget);
+    HbAutoTest::mouseClick(mMainWindow, mIpv4GatewayWidget);
+}
+
+/**
+ * Tests disabling of automatic phone IP address.
+ */
+void TestCpWlanApPlugin::tcEnableUserDefinedIpv4Address()
+{
+    Qt::CheckState state = static_cast<Qt::CheckState>
+        (mTestViewAdvanced->mIpv4Automatic->contentWidgetData("checkState").toInt());
+    if (state == Qt::Checked) {
+        // Disable automatic IP address
+        HbAutoTest::mouseClick(mMainWindow, mIpv4AddressAutomaticWidget);
+    }
+    // Can't verify the setting from CommsDat here, because CMManager will
+    // set it back to true if no valid IP address is yet defined. The flag
+    // is verified in tcChangeIpAddress().
+}
+
+/**
+ * Tests changing of IP address.
+ */
+void TestCpWlanApPlugin::tcChangeIpAddress()
+{
+    QFETCH(QString, string);
+    QFETCH(QString, result);
+    
+    HbAutoTest::mouseClick(mMainWindow, mIpv4AddressWidget);
+    
+    // Erase old string
+    QString text = mTestViewAdvanced->mIpv4Address->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mIpv4AddressWidget, exitEditorOffset);
+
+    // Verify both commsdat and UI widget
+    subVerifyString(
+        CMManagerShim::CmIPAddress,
+        mTestViewAdvanced->mIpv4Address,
+        result);
+    subVerifyBool(
+        CMManagerShim::CmIPAddrFromServer,
+        false);
+}
+
+/**
+ * Test data for IP address change test case.
+ */
+void TestCpWlanApPlugin::tcChangeIpAddress_data()
+{
+    QTest::addColumn<QString>("string");
+    QTest::addColumn<QString>("result");
+  
+    QTest::newRow("too long")
+        << "255.255.255.2551234"
+        << "255.255.255.255";
+    QTest::newRow("normal")
+        << "192.168.0.1"
+        << "192.168.0.1";
+}
+
+/**
+ * Tests changing of subnet mask.
+ */
+void TestCpWlanApPlugin::tcChangeSubnetMask()
+{
+    QFETCH(QString, string);
+    QFETCH(QString, result);
+    
+    HbAutoTest::mouseClick(mMainWindow, mIpv4SubnetMaskWidget);
+    
+    // Erase old string
+    QString text = mTestViewAdvanced->mIpv4SubnetMask->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mIpv4SubnetMaskWidget, exitEditorOffset);
+
+    // Verify both commsdat and UI widget
+    subVerifyString(
+        CMManagerShim::CmIPNetmask,
+        mTestViewAdvanced->mIpv4SubnetMask,
+        result);
+}
+
+/**
+ * Test data for subnet mask change test case.
+ */
+void TestCpWlanApPlugin::tcChangeSubnetMask_data()
+{
+    QTest::addColumn<QString>("string");
+    QTest::addColumn<QString>("result");
+  
+    QTest::newRow("empty")
+        << ""
+        << "0.0.0.0";
+    QTest::newRow("zero")
+        << "0.0.0.0"
+        << "0.0.0.0";
+    QTest::newRow("too long")
+        << "255.255.255.2551234"
+        << "255.255.255.255";
+    QTest::newRow("normal")
+        << "192.168.0.1"
+        << "192.168.0.1";
+}
+
+/**
+ * Tests invalid subnet mask.
+ */
+void TestCpWlanApPlugin::tcInvalidSubnetMask()
+{
+    QString previous = 
+        mTestViewAdvanced->mIpv4SubnetMask->contentWidgetData("text").toString();
+    
+    HbAutoTest::mouseClick(mMainWindow, mIpv4SubnetMaskWidget);
+    
+    // Erase old string
+    QString text = mTestViewAdvanced->mIpv4SubnetMask->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, "999.999.999.999", 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mIpv4SubnetMaskWidget, exitEditorOffset);
+
+    QTest::qWait(100);
+    // Dismiss messagebox
+    HbAutoTest::mouseClick(
+        mMainWindow,
+        mTestViewAdvanced->mMessageBox.data(),
+        messageBoxOkButtonOffset);
+    
+    // Verify both commsdat and UI widget
+    subVerifyString(
+        CMManagerShim::CmIPNetmask,
+        mTestViewAdvanced->mIpv4SubnetMask,
+        previous);
+}
+
+/**
+ * Tests changing of gateway.
+ */
+void TestCpWlanApPlugin::tcChangeGateway()
+{
+    QFETCH(QString, string);
+    QFETCH(QString, result);
+    
+    HbAutoTest::mouseClick(mMainWindow, mIpv4GatewayWidget);
+    
+    // Erase old string
+    QString text = mTestViewAdvanced->mIpv4Gateway->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mIpv4GatewayWidget, exitEditorOffset);
+
+    // Verify both commsdat and UI widget
+    subVerifyString(
+        CMManagerShim::CmIPGateway,
+        mTestViewAdvanced->mIpv4Gateway,
+        result);
+}
+
+/**
+ * Test data for gateway change test case.
+ */
+void TestCpWlanApPlugin::tcChangeGateway_data()
+{
+    QTest::addColumn<QString>("string");
+    QTest::addColumn<QString>("result");
+  
+    QTest::newRow("empty")
+        << ""
+        << "0.0.0.0";
+    QTest::newRow("zero")
+        << "0.0.0.0"
+        << "0.0.0.0";
+    QTest::newRow("too long")
+        << "255.255.255.2551234"
+        << "255.255.255.255";
+    QTest::newRow("normal")
+        << "192.168.0.1"
+        << "192.168.0.1";
+}
+
+/**
+ * Tests invalid gateway address.
+ */
+void TestCpWlanApPlugin::tcInvalidGateway()
+{
+    QString previous = 
+        mTestViewAdvanced->mIpv4Gateway->contentWidgetData("text").toString();
+    
+    HbAutoTest::mouseClick(mMainWindow, mIpv4GatewayWidget);
+    
+    // Erase old string
+    QString text = mTestViewAdvanced->mIpv4Gateway->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, "999.999.999.999", 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mIpv4GatewayWidget, exitEditorOffset);
+
+    QTest::qWait(100);
+    // Dismiss messagebox
+    HbAutoTest::mouseClick(
+        mMainWindow,
+        mTestViewAdvanced->mMessageBox.data(),
+        messageBoxOkButtonOffset);
+    
+    // Verify both commsdat and UI widget
+    subVerifyString(
+        CMManagerShim::CmIPGateway,
+        mTestViewAdvanced->mIpv4Gateway,
+        previous);
+}
+
+/**
+ * Scrolls the tested view to the bottom.
+ */
+void TestCpWlanApPlugin::tcScrollToBottom2()
+{
+    subScrollToBottom();
+}
+
+/**
+ * Tests enabling of automatic IPv4 DNS addresses.
+ */
+void TestCpWlanApPlugin::tcEnableAutomaticIpv4DnsAddress()
+{
+    Qt::CheckState state = static_cast<Qt::CheckState>
+        (mTestViewAdvanced->mIpv4DnsAutomatic->contentWidgetData("checkState").toInt());
+    if (state == Qt::Checked) {
+        // Disable automatic IPv4 DNS address
+        HbAutoTest::mouseClick(mMainWindow, mIpv4DnsAddressAutomaticWidget);
+    }
+    // Enable automatic IPv4 DNS address
+    HbAutoTest::mouseClick(mMainWindow, mIpv4DnsAddressAutomaticWidget);
+    subVerifyBool(
+        CMManagerShim::CmIPDNSAddrFromServer,
+        true);
+    
+    // Ensure that editing the IP address is not allowed
+    HbAutoTest::mouseClick(mMainWindow, mIpv4PrimaryDnsAddressWidget);
+    HbAutoTest::mouseClick(mMainWindow, mIpv4SecondaryDnsAddressWidget);
+}
+
+/**
+ * Tests disabling of automatic IPv4 DNS addresses.
+ */
+void TestCpWlanApPlugin::tcEnableUserDefinedIpv4DnsAddress()
+{
+    Qt::CheckState state = static_cast<Qt::CheckState>
+        (mTestViewAdvanced->mIpv4DnsAutomatic->contentWidgetData("checkState").toInt());
+    if (state == Qt::Checked) {
+        // Disable automatic IPv4 DNS address
+        HbAutoTest::mouseClick(mMainWindow, mIpv4DnsAddressAutomaticWidget);
+    }
+    // Can't verify the setting from CommsDat here, because CMManager will
+    // set it back to true if no valid IP address is yet defined. The flag
+    // is verified in tcChangeIpv4DnsAddress().
+}
+
+/**
+ * Tests changing of IPv4 DNS addresses.
+ */
+void TestCpWlanApPlugin::tcChangeIpv4DnsAddress()
+{
+    QFETCH(QString, string);
+    QFETCH(QString, result);
+    
+    // Primary DNS address
+    HbAutoTest::mouseClick(mMainWindow, mIpv4PrimaryDnsAddressWidget);
+    
+    // Erase old string
+    QString text = mTestViewAdvanced->mIpv4DnsAddress1->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mIpv4PrimaryDnsAddressWidget, exitEditorOffset);
+
+    // Verify both commsdat and UI widget
+    subVerifyString(
+        CMManagerShim::CmIPNameServer1,
+        mTestViewAdvanced->mIpv4DnsAddress1,
+        result);
+    
+    // Secondary DNS address
+    HbAutoTest::mouseClick(mMainWindow, mIpv4SecondaryDnsAddressWidget);
+    
+    // Erase old string
+    text = mTestViewAdvanced->mIpv4DnsAddress2->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mIpv4SecondaryDnsAddressWidget, exitEditorOffset);
+
+    // Verify both commsdat and UI widget
+    subVerifyString(
+        CMManagerShim::CmIPNameServer2,
+        mTestViewAdvanced->mIpv4DnsAddress2,
+        result);
+    
+    // Verify user defined address is in use
+    subVerifyBool(
+        CMManagerShim::CmIPDNSAddrFromServer,
+        false);
+}
+
+/**
+ * Test data for IPv4 DNS address change test case.
+ */
+void TestCpWlanApPlugin::tcChangeIpv4DnsAddress_data()
+{
+    QTest::addColumn<QString>("string");
+    QTest::addColumn<QString>("result");
+  
+    QTest::newRow("too long")
+        << "255.255.255.2551234"
+        << "255.255.255.255";
+    QTest::newRow("normal")
+        << "192.168.0.1"
+        << "192.168.0.1";
+}
+
+/**
+ * Tests invalid IPv4 DNS address.
+ */
+void TestCpWlanApPlugin::tcInvalidIpv4DnsAddress()
+{
+    QString previous = 
+        mTestViewAdvanced->mIpv4DnsAddress1->contentWidgetData("text").toString();
+    
+    HbAutoTest::mouseClick(mMainWindow, mIpv4PrimaryDnsAddressWidget);
+    
+    // Erase old string
+    QString text = mTestViewAdvanced->mIpv4DnsAddress1->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
     
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, "999.999.999.999", 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mIpv4PrimaryDnsAddressWidget, exitEditorOffset);
+
+    QTest::qWait(100);
+    // Dismiss messagebox
+    HbAutoTest::mouseClick(
+        mMainWindow,
+        mTestViewAdvanced->mMessageBox.data(),
+        messageBoxOkButtonOffset);
+    
+    // Verify both commsdat and UI widget
+    subVerifyString(
+        CMManagerShim::CmIPNameServer1,
+        mTestViewAdvanced->mIpv4DnsAddress1,
+        previous);
+}
+
+/**
+ * Scrolls the tested view to the top.
+ */
+void TestCpWlanApPlugin::tcScrollToTop()
+{
+    subScrollToTop();
+}
+
+/**
+ * Collapses the IPv4 settings group.
+ */
+void TestCpWlanApPlugin::tcCollapseIpv4Settings()
+{
+    HbAutoTest::mouseClick(mMainWindow, mTestViewAdvanced, ipv4Group);
+}
+
+/**
+ * Expands the IPv6 settings group and gets UI widget pointers.
+ */
+void TestCpWlanApPlugin::tcExpandIpv6SettingsAndGetUiWidgets()
+{
+    HbAutoTest::mouseClick(mMainWindow, mTestViewAdvanced, ipv6Group);
+
+    QTest::qWait(500);
+    
+    subGetAdvancedUiWidgets(1);
+}
+
+/**
+ * Tests enabling of automatic IPv6 DNS addresses.
+ */
+void TestCpWlanApPlugin::tcEnableAutomaticIpv6DnsAddress()
+{
+    // Enable automatic IPv6 DNS address
+    QPointF automaticPointOffset = comboBoxItemOffset;
+    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget);
+    QTest::qWait(100);
+    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget, automaticPointOffset, 100);
+    QTest::qWait(100);
+    subVerifyBool(
+        CMManagerShim::CmIP6DNSAddrFromServer,
+        true);
+    
+    // Ensure that editing the IP address is not allowed
+    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget);
+    HbAutoTest::mouseClick(mMainWindow, mIpv6SecondaryDnsAddressWidget);
+}
+
+/**
+ * Tests enabling of well-known IPv6 DNS addresses.
+ */
+void TestCpWlanApPlugin::tcEnableWellKnownIpv6DnsAddress()
+{
+    // Enable well-known IPv6 DNS address
+    QPointF wellKnownPointOffset = comboBoxItemOffset * 2;
+    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget);
+    QTest::qWait(100);
+    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget, wellKnownPointOffset, 100);
+    QTest::qWait(100);
+    subVerifyBool(
+        CMManagerShim::CmIP6DNSAddrFromServer,
+        false);
+    subVerifyString(
+        CMManagerShim::CmIP6NameServer1,
+        mTestViewAdvanced->mIpv6DnsAddress1,
+        "fec0:000:0000:ffff::1");
+    subVerifyString(
+        CMManagerShim::CmIP6NameServer2,
+        mTestViewAdvanced->mIpv6DnsAddress2,
+        "fec0:000:0000:ffff::2");
+    
+    // Ensure that editing the IP address is not allowed
+    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget);
+    HbAutoTest::mouseClick(mMainWindow, mIpv6SecondaryDnsAddressWidget);
+}
+
+/**
+ * Tests enabling of user defined IPv6 DNS addresses.
+ */
+void TestCpWlanApPlugin::tcEnableUserDefinedIpv6DnsAddress()
+{
+    // Select user defined IPv6 DNS address
+    QPointF userDefinedPointOffset = comboBoxItemOffset * 3;
+    //QPointF userDefinedPointOffset(0, 160);
+    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget);
+    QTest::qWait(100);
+    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget, userDefinedPointOffset, 100);
+    QTest::qWait(100);
+    // Can't verify the setting from CommsDat here, because CMManager will
+    // set it back to true if no valid IP address is yet defined. The flag
+    // is verified in tcChangeIpv4DnsAddress().
+}
+
+/**
+ * Tests changing of IPv6 DNS addresses.
+ */
+void TestCpWlanApPlugin::tcChangeIpv6DnsAddress()
+{
+    QFETCH(QString, string);
+    QFETCH(QString, result);
+    
+    // Primary DNS address
+    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget);
+    
+    // Erase old string
+    QString text = mTestViewAdvanced->mIpv6DnsAddress1->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget, exitEditorOffset);
+
+    // Verify both commsdat and UI widget
+    subVerifyString(
+        CMManagerShim::CmIP6NameServer1,
+        mTestViewAdvanced->mIpv6DnsAddress1,
+        result);
+    
+    // Secondary DNS address
+    HbAutoTest::mouseClick(mMainWindow, mIpv6SecondaryDnsAddressWidget);
+    
+    // Erase old string
+    text = mTestViewAdvanced->mIpv6DnsAddress2->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mIpv6SecondaryDnsAddressWidget, exitEditorOffset);
+
+    // Verify both commsdat and UI widget
+    subVerifyString(
+        CMManagerShim::CmIP6NameServer2,
+        mTestViewAdvanced->mIpv6DnsAddress2,
+        result);
+    
+    // Verify user defined address is in use
+    subVerifyBool(
+        CMManagerShim::CmIP6DNSAddrFromServer,
+        false);
+}
+
+/**
+ * Test data for IPv6 DNS address change test case.
+ */
+void TestCpWlanApPlugin::tcChangeIpv6DnsAddress_data()
+{
+    QTest::addColumn<QString>("string");
+    QTest::addColumn<QString>("result");
+  
+    QTest::newRow("normal")
+        << "2001:db8:85a3::8a2e:370:7334"
+        << "2001:db8:85a3:0:0:8a2e:370:7334";
+}
+
+/**
+ * Tests invalid IPv6 DNS address.
+ */
+void TestCpWlanApPlugin::tcInvalidIpv6DnsAddress()
+{
+    QString previous = 
+        mTestViewAdvanced->mIpv6DnsAddress1->contentWidgetData("text").toString();
+    
+    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget);
+    
+    // Erase old string
+    QString text = mTestViewAdvanced->mIpv6DnsAddress1->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, "abcdef:fedcba", 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget, exitEditorOffset);
+
+    QTest::qWait(100);
+    // Dismiss messagebox
+    HbAutoTest::mouseClick(
+        mMainWindow,
+        mTestViewAdvanced->mMessageBox.data(),
+        messageBoxOkButtonOffset);
+    
+    // Verify both commsdat and UI widget
+    subVerifyString(
+        CMManagerShim::CmIP6NameServer1,
+        mTestViewAdvanced->mIpv6DnsAddress1,
+        previous);
+}
+
+/**
+ * Collapses the IPv6 settings group.
+ */
+void TestCpWlanApPlugin::tcCollapseIpv6Settings()
+{
+    HbAutoTest::mouseClick(mMainWindow, mTestViewAdvanced, ipv6Group);
+}
+
+/**
+ * Expands the proxy settings group and gets UI widget pointers.
+ */
+void TestCpWlanApPlugin::tcExpandProxySettingsAndGetUiWidgets()
+{
+    HbAutoTest::mouseClick(mMainWindow, mTestViewAdvanced, proxyGroup);
+
+    QTest::qWait(500);
+    
+    subGetAdvancedUiWidgets(2);
+}
+
+/**
+ * Tests changing of proxy server address.
+ */
+void TestCpWlanApPlugin::tcChangeProxyServerAddress()
+{
+    QFETCH(QString, string);
+    QFETCH(QString, result);
+    
+    HbAutoTest::mouseClick(mMainWindow, mProxyServerAddressWidget);
+    
+    // Erase old string
+    QString text = mTestViewAdvanced->mProxyServer->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mProxyServerAddressWidget, exitEditorOffset);
+
+    QTest::qWait(100);
+    
+    // Verify both commsdat and UI widget
+    subVerifyString(
+        CMManagerShim::CmProxyServerName,
+        mTestViewAdvanced->mProxyServer,
+        result);
+    // Verify user defined address flag is set correctly
+    if (result.isEmpty()) {
+        subVerifyBool(
+            CMManagerShim::CmProxyUsageEnabled,
+            false);
+    } else {
+        subVerifyBool(
+            CMManagerShim::CmProxyUsageEnabled,
+            true);
+    }
+}
+
+/**
+ * Test data for proxy server address change test case.
+ */
+void TestCpWlanApPlugin::tcChangeProxyServerAddress_data()
+{
+    QTest::addColumn<QString>("string");
+    QTest::addColumn<QString>("result");
+  
+    QTest::newRow("long")
+        << "http://developer.symbian.org/main/documentation/reference/s^3/doc_source/AboutSymbianOSLibrary9.6/index.html"
+        << "http://developer.symbian.org/main/documentation/reference/s^3/doc_source/AboutSymbianOSLibrary9.6/index.html";
+    QTest::newRow("empty")
+        << ""
+        << "";
+    QTest::newRow("basic") // last one should always fit on one line in UI
+        << "http://www.symbian.org/"
+        << "http://www.symbian.org/";
+}
+
+/**
+ * Tests changing of proxy port number.
+ */
+void TestCpWlanApPlugin::tcChangeProxyPortNumber()
+{
+    QFETCH(QString, string);
+    QFETCH(QString, result);
+    
+    HbAutoTest::mouseClick(mMainWindow, mProxyPortNumberWidget);
+    
+    // Erase old string
+    QString text = mTestViewAdvanced->mProxyPort->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mProxyPortNumberWidget, exitEditorOffset);
+
+    QTest::qWait(100);
+
+    // Verify both commsdat and UI widget
+    subVerifyUint(
+        CMManagerShim::CmProxyPortNumber,
+        result.toInt());
+    QCOMPARE(
+        mTestViewAdvanced->mProxyPort->contentWidgetData("text").toInt(),
+        result.toInt());
+}
+
+/**
+ * Test data for proxy port number change test case.
+ */
+void TestCpWlanApPlugin::tcChangeProxyPortNumber_data()
+{
+    QTest::addColumn<QString>("string");
+    QTest::addColumn<QString>("result");
+  
+    QTest::newRow("basic")
+        << "8080"
+        << "8080";
+    QTest::newRow("too long")
+        << "1234567890"
+        << "12345";
+    QTest::newRow("zero")
+        << "0"
+        << "";
+    QTest::newRow("empty")
+        << ""
+        << "";
+}
+
+/**
+ * Tests invalid proxy port number.
+ */
+void TestCpWlanApPlugin::tcInvalidProxyPortNumber()
+{
+    int previous = 
+        mTestViewAdvanced->mProxyPort->contentWidgetData("text").toInt();
+    
+    HbAutoTest::mouseClick(mMainWindow, mProxyPortNumberWidget);
+    
+    // Erase old string
+    QString text = mTestViewAdvanced->mProxyPort->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, "65536", 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mProxyPortNumberWidget, exitEditorOffset);
+
+    QTest::qWait(100);
+    // Dismiss messagebox
+    HbAutoTest::mouseClick(
+        mMainWindow,
+        mTestViewAdvanced->mMessageBox.data(),
+        messageBoxOkButtonOffset);
+    
+    // Verify both commsdat and UI widget
+    subVerifyUint(
+        CMManagerShim::CmProxyPortNumber,
+        previous);
+    QCOMPARE(
+        mTestViewAdvanced->mProxyPort->contentWidgetData("text").toInt(),
+        previous);
+}
+
+/**
+ * Collapses the proxy settings group.
+ */
+void TestCpWlanApPlugin::tcCollapseProxySettings()
+{
+    HbAutoTest::mouseClick(mMainWindow, mTestViewAdvanced, proxyGroup);
+}
+
+/**
+ * Returns from advanced settings view.
+ */
+void TestCpWlanApPlugin::tcCloseAdvancedSettingsView()
+{
     // Return from advanced settings view
     subClickWidget("HbNavigationButton");
 }
@@ -438,6 +1242,108 @@
 // -----------------------------------------------------------------------------
 
 /**
+ * Gets UI widget pointers.
+ */
+void TestCpWlanApPlugin::subGetUiWidgets()
+{
+    HbModelIterator iterator(mTestView->mModel);
+    
+    // Get "Access point settings" group item
+    QModelIndex apGroupIndex = iterator.index(0);
+    
+    // Get UI widgets
+    mConnectionNameWidget = subGetWidgetByIndex(
+        mTestView->mForm,
+        iterator.index(0, apGroupIndex));
+    mWlanNetworkNameWidget = subGetWidgetByIndex(
+        mTestView->mForm,
+        iterator.index(1, apGroupIndex));
+    mNetworkStatusWidget = subGetWidgetByIndex(
+        mTestView->mForm,
+        iterator.index(2, apGroupIndex));
+    mNetworkModeWidget = subGetWidgetByIndex(
+        mTestView->mForm,
+        iterator.index(3, apGroupIndex));
+    mSecurityModeWidget = subGetWidgetByIndex(
+        mTestView->mForm,
+        iterator.index(4, apGroupIndex));
+    mHomepageWidget = subGetWidgetByIndex(
+        mTestView->mForm,
+        iterator.index(5, apGroupIndex));
+}
+
+/**
+ * Gets advanced settings view UI widget pointers by group index.
+ */
+void TestCpWlanApPlugin::subGetAdvancedUiWidgets(
+    uint index)
+{
+    // Get the group item
+    HbModelIterator iterator(mTestViewAdvanced->mModel);
+    QModelIndex groupIndex = iterator.index(index);
+    
+    // Get UI widgets
+    if (index == 0) {
+        // IPv4 settings group
+        mIpv4AddressAutomaticWidget = subGetWidgetByIndex(
+            mTestViewAdvanced->mForm,
+            iterator.index(0, groupIndex));
+        mIpv4AddressWidget = subGetWidgetByIndex(
+            mTestViewAdvanced->mForm,
+            iterator.index(1, groupIndex));
+        mIpv4SubnetMaskWidget = subGetWidgetByIndex(
+            mTestViewAdvanced->mForm,
+            iterator.index(2, groupIndex));
+        mIpv4GatewayWidget = subGetWidgetByIndex(
+            mTestViewAdvanced->mForm,
+            iterator.index(3, groupIndex));
+        mIpv4DnsAddressAutomaticWidget = subGetWidgetByIndex(
+            mTestViewAdvanced->mForm,
+            iterator.index(4, groupIndex));
+        mIpv4PrimaryDnsAddressWidget = subGetWidgetByIndex(
+            mTestViewAdvanced->mForm,
+            iterator.index(5, groupIndex));
+        mIpv4SecondaryDnsAddressWidget = subGetWidgetByIndex(
+            mTestViewAdvanced->mForm,
+            iterator.index(6, groupIndex));
+    } else if (index == 1) {
+        // IPv6 settings group
+        mIpv6DnsAddressAutomaticWidget = subGetWidgetByIndex(
+            mTestViewAdvanced->mForm,
+            iterator.index(0, groupIndex));
+        mIpv6PrimaryDnsAddressWidget = subGetWidgetByIndex(
+            mTestViewAdvanced->mForm,
+            iterator.index(1, groupIndex));
+        mIpv6SecondaryDnsAddressWidget = subGetWidgetByIndex(
+            mTestViewAdvanced->mForm,
+            iterator.index(2, groupIndex));    
+    } else {
+        // Proxy settings group
+        mProxyServerAddressWidget = subGetWidgetByIndex(
+            mTestViewAdvanced->mForm,
+            iterator.index(0, groupIndex));
+        mProxyPortNumberWidget = subGetWidgetByIndex(
+            mTestViewAdvanced->mForm,
+            iterator.index(1, groupIndex));
+    }
+}
+
+/**
+ * Gets an UI widget from HbDataForm by index. 
+ */
+HbWidget *TestCpWlanApPlugin::subGetWidgetByIndex(
+    HbDataForm *form,
+    const QModelIndex &index)
+{
+    HbDataFormViewItem *viewItem = qobject_cast<HbDataFormViewItem *>
+        (form->itemByIndex(index));
+    HbWidget *widget = viewItem->dataItemContentWidget();
+    //QString widgetClassName(widget->metaObject()->className());
+    //qDebug() << widgetClassName;
+    return widget;
+}
+
+/**
  * Verifies that given string is correctly stored in CommsDat and shown on UI. 
  */
 void TestCpWlanApPlugin::subVerifyString(
@@ -503,17 +1409,15 @@
 void TestCpWlanApPlugin::subClearLineEdit(
     uint length)
 {
-    // Erase old string
-    QTest::qWait(5000); // TODO: Remove this when item specific menu doesn't pop up anymore
-
     // Move cursor to end of string
-    //HbAutoTest::keyClick(mMainWindow, Qt::Key_End, 0, waitTime); // doesn't seem to do anything? 
+    //HbAutoTest::keyClick(mMainWindow, Qt::Key_End, Qt::ControlModifier, waitTime); // doesn't seem to do anything? 
     HbAutoTest::keyClick(mMainWindow, Qt::Key_Down, 0, waitTime);
     HbAutoTest::keyClick(mMainWindow, Qt::Key_Down, 0, waitTime);
     HbAutoTest::keyClick(mMainWindow, Qt::Key_Down, 0, waitTime);
     for (int i=0; i<25; i++) {
         HbAutoTest::keyClick(mMainWindow, Qt::Key_Right, 0, waitTime);
     }
+    // Erase string
     for (int i=0; i<length; i++) {
         HbAutoTest::keyClick(mMainWindow, Qt::Key_Backspace, 0, waitTime);
     }
@@ -558,3 +1462,56 @@
     Q_ASSERT(target);
     HbAutoTest::mouseClick(mMainWindow, static_cast<HbWidget *>(target));
 }
+
+/**
+ * Returns the middle point of a widget.
+ */
+QPointF TestCpWlanApPlugin::subMiddlePointOfWidget(const HbWidget *widget)
+{
+    QRectF widgetRect = widget->rect();
+    QRectF widgetSceneRect = widget->mapRectToScene(widgetRect);
+    qreal middleX = ((widgetSceneRect.right() - widgetSceneRect.left()) / 2) + widgetSceneRect.left();
+    qreal middleY = ((widgetSceneRect.bottom() - widgetSceneRect.top()) / 2) + widgetSceneRect.top();
+    
+    return QPointF(middleX, middleY);
+}
+
+/**
+ * Verifies that given attribute contains expected boolean value in CommsDat. 
+ */
+void TestCpWlanApPlugin::subVerifyBool(
+    CMManagerShim::ConnectionMethodAttribute attribute,
+    bool expected)
+{
+    // Read attribute value from CommsDat
+    QScopedPointer<CmManagerShim> cmManager(new CmManagerShim);
+    QScopedPointer<CmConnectionMethodShim> connectionMethod( 
+        cmManager->connectionMethod(testApId));
+    bool commsdat = connectionMethod->getBoolAttribute(attribute);
+    
+    QCOMPARE(commsdat, expected);
+}
+
+/**
+ * Scrolls the tested view to the bottom.
+ */
+void TestCpWlanApPlugin::subScrollToBottom()
+{
+    // Scroll to the bottom of the view
+    HbAutoTest::mousePress(mMainWindow, mTestView, scrollMiddle);
+    QTest::qWait(1000);
+    HbAutoTest::mouseMove(mMainWindow, mTestView, scrollTop);
+    HbAutoTest::mouseRelease(mMainWindow, mTestView, scrollTop);
+}
+
+/**
+ * Scrolls the tested view to the top.
+ */
+void TestCpWlanApPlugin::subScrollToTop()
+{
+    // Scroll to the top of the view
+    HbAutoTest::mousePress(mMainWindow, mTestView, scrollMiddle);
+    QTest::qWait(1000);
+    HbAutoTest::mouseMove(mMainWindow, mTestView, scrollBottom);
+    HbAutoTest::mouseRelease(mMainWindow, mTestView, scrollBottom);
+}
--- a/cmmanager/cpwlanapplugin/tsrc/ut/testcpwlanapplugin.h	Tue May 18 13:52:48 2010 +0100
+++ b/cmmanager/cpwlanapplugin/tsrc/ut/testcpwlanapplugin.h	Wed Jun 23 17:49:20 2010 +0100
@@ -19,12 +19,16 @@
 #include <QtTest/QtTest>
 #include <cmmanagerdefines_shim.h>
 
+class HbWidget;
 class HbDialog;
 class HbMainWindow;
 class HbAutoTestMainWindow;
+class HbDataForm;
 class HbDataFormModelItem;
+class HbDataFormViewItem;
 class HbAction;
 class CpWlanApView;
+class CpWlanApAdvancedView;
 class CpBearerApPluginInterface;
 
 enum NetworkStatus {
@@ -58,12 +62,54 @@
         void tcChangeNetworkStatus();
         void tcChangeNetworkMode();
         void tcChangeSecurityMode();
+        void tcScrollToBottom();
+        void tcGetUiWidgets();
         void tcChangeHomepage();
         void tcChangeHomepage_data();
-        void tcAdvancedSettings();
+        void tcOpenAdvancedSettingsView();
+        void tcExpandIpv4SettingsAndGetUiWidgets();
+        void tcEnableAutomaticIpv4Address();
+        void tcEnableUserDefinedIpv4Address();
+        void tcChangeIpAddress();
+        void tcChangeIpAddress_data();
+        void tcChangeSubnetMask();
+        void tcChangeSubnetMask_data();
+        void tcInvalidSubnetMask();
+        void tcChangeGateway();
+        void tcChangeGateway_data();
+        void tcInvalidGateway();
+        void tcScrollToBottom2();
+        void tcEnableAutomaticIpv4DnsAddress();
+        void tcEnableUserDefinedIpv4DnsAddress();
+        void tcChangeIpv4DnsAddress();
+        void tcChangeIpv4DnsAddress_data();
+        void tcInvalidIpv4DnsAddress();
+        void tcScrollToTop();
+        void tcCollapseIpv4Settings();
+        void tcExpandIpv6SettingsAndGetUiWidgets();
+        void tcEnableAutomaticIpv6DnsAddress();
+        void tcEnableWellKnownIpv6DnsAddress();
+        void tcEnableUserDefinedIpv6DnsAddress();
+        void tcChangeIpv6DnsAddress();
+        void tcChangeIpv6DnsAddress_data();
+        void tcInvalidIpv6DnsAddress();
+        void tcCollapseIpv6Settings();
+        void tcExpandProxySettingsAndGetUiWidgets();
+        void tcChangeProxyServerAddress();
+        void tcChangeProxyServerAddress_data();
+        void tcChangeProxyPortNumber();
+        void tcChangeProxyPortNumber_data();
+        void tcInvalidProxyPortNumber();
+        void tcCollapseProxySettings();
+        void tcCloseAdvancedSettingsView();
 
     private:
         // Sub test cases
+        void subGetUiWidgets();
+        void subGetAdvancedUiWidgets(uint index);
+        HbWidget *subGetWidgetByIndex(
+            HbDataForm *form,
+            const QModelIndex &index);
         void subVerifyString(
             CMManagerShim::ConnectionMethodAttribute attribute,
             HbDataFormModelItem *item,
@@ -76,12 +122,43 @@
         void subClearLineEdit(uint length);
         void subCreateSettingsView(uint connetionMethodId);
         void subClickWidget(const QString &name);
+        QPointF subMiddlePointOfWidget(const HbWidget *widget);
+        void subVerifyBool(
+            CMManagerShim::ConnectionMethodAttribute attribute,
+            bool expected);
+        void subScrollToBottom();
+        void subScrollToTop();
 
     private:
         // Code references
         CpWlanApView *mTestView;
+        CpWlanApAdvancedView *mTestViewAdvanced;
+        // "Access point settings" UI widgets
+        HbWidget *mConnectionNameWidget;
+        HbWidget *mWlanNetworkNameWidget;
+        HbWidget *mNetworkStatusWidget;
+        HbWidget *mNetworkModeWidget;
+        HbWidget *mSecurityModeWidget;
+        HbWidget *mHomepageWidget;
+        // "Advanced settings" UI widgets
+        HbDataFormViewItem *mIpv4GroupViewItem;
+        HbDataFormViewItem *mIpv6GroupViewItem;
+        HbDataFormViewItem *mProxyGroupViewItem;
+        HbWidget *mIpv4AddressAutomaticWidget;
+        HbWidget *mIpv4AddressWidget;
+        HbWidget *mIpv4SubnetMaskWidget;
+        HbWidget *mIpv4GatewayWidget;
+        HbWidget *mIpv4DnsAddressAutomaticWidget;
+        HbWidget *mIpv4PrimaryDnsAddressWidget;
+        HbWidget *mIpv4SecondaryDnsAddressWidget;
+        HbWidget *mIpv6DnsAddressAutomaticWidget;
+        HbWidget *mIpv6PrimaryDnsAddressWidget;
+        HbWidget *mIpv6SecondaryDnsAddressWidget;
+        HbWidget *mProxyServerAddressWidget;
+        HbWidget *mProxyPortNumberWidget;
         
         // Test data
         HbAutoTestMainWindow *mMainWindow;
+        QPluginLoader *mPluginLoader;
         CpBearerApPluginInterface *mPlugin;
 };
--- a/connectionmonitoring/cellularindicatorplugin/src/cellularindicatorplugin.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/connectionmonitoring/cellularindicatorplugin/src/cellularindicatorplugin.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -209,17 +209,14 @@
             else if ( indicatorInfo[0].toInt() && (indicatorInfo.count() >= 2)) {
                 
                 // Only one connection -> show name of the iap
-                QString iapName;
-                iapName = indicatorInfo[1].toString();
-                QString str = QString(hbTrId("txt_occ_dblist_cellular_data_val_1_connected"));
-                ret = str.arg(iapName);
+                ret = indicatorInfo[1].toString();
             }
         }
         break;
 
     case DecorationNameRole:
         // Return the icon
-        ret = HbIcon("qtg_small_gprs");
+        ret = QString("qtg_small_gprs");
         break;
     
     default:
--- a/connectionmonitoring/connectionview/connectionview.pro	Tue May 18 13:52:48 2010 +0100
+++ b/connectionmonitoring/connectionview/connectionview.pro	Wed Jun 23 17:49:20 2010 +0100
@@ -16,7 +16,10 @@
 #
 TEMPLATE = app
 TARGET = connview
-CONFIG += hb no_icon
+
+CONFIG += hb no_icon mobility
+MOBILITY+=bearer
+
 DEPENDPATH += . inc src
 INCLUDEPATH += .
 
@@ -34,8 +37,6 @@
 
 SYMBIAN_PLATFORMS = WINSCW ARMV5
 
-LIBS += -lqtbearer
-
 symbian {
     TARGET.CAPABILITY = NetworkServices NetworkControl
     TARGET.UID3 = 0x2002C36A
--- a/connectionmonitoring/connectionview/inc/connectionview.h	Tue May 18 13:52:48 2010 +0100
+++ b/connectionmonitoring/connectionview/inc/connectionview.h	Wed Jun 23 17:49:20 2010 +0100
@@ -135,9 +135,6 @@
         /* The toolbar on the view */
         HbToolBar *mToolBar;
         
-        /* The toolbar action which can be used to disconnect all the connections */
-        HbAction *mDisconnectAction;
-        
         /* The id of the timer used to close the application */
         int mClosingTimer;
         
--- a/connectionmonitoring/connectionview/src/connectionview.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/connectionmonitoring/connectionview/src/connectionview.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -143,10 +143,12 @@
     // Create the toolbar and the disconnection action
     mToolBar = new HbToolBar();    
     HbIcon icon("qtg_mono_disconnect");
-    mDisconnectAction = mToolBar->addAction(icon, hbTrId("txt_occ_button_disconnect_all"));
+    HbAction *disconnectAction = new HbAction(mToolBar);
+    disconnectAction->setIcon(icon);
+    mToolBar->addAction(disconnectAction);
     mMainView->setToolBar(mToolBar);
     bool connectStatus = connect(
-            mDisconnectAction,
+            disconnectAction,
             SIGNAL(triggered(bool)),
             this,
             SLOT(disconnectAll()));
--- a/connectionmonitoring/indicatorobserver/indicatorobserver.pro	Tue May 18 13:52:48 2010 +0100
+++ b/connectionmonitoring/indicatorobserver/indicatorobserver.pro	Wed Jun 23 17:49:20 2010 +0100
@@ -16,14 +16,14 @@
 
 TEMPLATE = app
 TARGET = indicatorobserver
-CONFIG += hb \
-          no_icon
+CONFIG += hb no_icon mobility
+MOBILITY += bearer
 
 INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \
                ./inc \
                ./traces
                
-LIBS += -lqtbearer -lxqsettingsmanager
+LIBS += -lxqsettingsmanager
 
 QT += core \
       network 
--- a/connectionmonitoring/indicatorobserver/src/indicatorobserver.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/connectionmonitoring/indicatorobserver/src/indicatorobserver.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -80,11 +80,8 @@
         KWlanOnOff);
     
     //Read current status of WLAN radio
-    //mWlanEnabled = mSettingsManager->readItemValue(wlanKey).toInt() ? true : false;
-    mWlanEnabled = true; 
-    //TODO: Replace above code with commented code when WlanOnOff implementation is in release.
-    //TODO: Remeber to add check for read failure(call error() method from settings manager).
-    
+    mWlanEnabled = mSettingsManager->readItemValue(wlanKey).toInt() ? true : false;
+
     mSettingsManager->startMonitoring(wlanKey);
 
     initializeIndicators();
@@ -147,10 +144,7 @@
     Q_UNUSED(key);
     
     // Inform about WLAN ON/OFF status change
-    Q_UNUSED(value); //TODO: to be removed with final implementation. To keep compiler satisfied.
-    //    mWlanEnabled = value.toInt() ? true : false;
-    
-    mWlanEnabled = true; //TODO: Replace with above code when WlanOnOff implementation is in release
+    mWlanEnabled = value.toInt() ? true : false;
     
     if (mWlanEnabled == false) {    
         deactivateWlanIndicatorPlugin();
--- a/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/connectionstatuspopup.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/connectionstatuspopup.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -48,9 +48,9 @@
 const TInt KErrGenConnNoGPRSNetwork     = -3609;
 
 // Icons representing bearer
-_LIT( KIconCellular, "pri_small_wlan.svg" );
-_LIT( KIconWlan,     "pri_small_gprs.svg" );
-_LIT( KIconVpn,      "pri_small_vpn.svg" ); 
+_LIT( KIconCellular, "qtg_small_wlan.svg" );
+_LIT( KIconWlan,     "qtg_small_gprs.svg" );
+_LIT( KIconVpn,      "qtg_small_vpn.svg" ); 
 _LIT( KIconNone,     "" );
 
 // Empty text
--- a/dbcreator/commsdatcreator/Inc/cdcprocessordn.h	Tue May 18 13:52:48 2010 +0100
+++ b/dbcreator/commsdatcreator/Inc/cdcprocessordn.h	Wed Jun 23 17:49:20 2010 +0100
@@ -114,14 +114,7 @@
         * Writes the actual created access point to the log file.
         */
         void DoLogL();
-    
-    private:
-        /**
-        * Tells whether the current destination has the internet metadata set.
-        * @return ETrue if the destination is Internet, EFalse otherwise.
-        */
-//        TBool IsInternet();
-        
+            
     private:
     
         // @var The destiantion that is created
@@ -147,4 +140,4 @@
 #endif PROCESSOR_DN_H
 
 
-// End of File.
\ No newline at end of file
+// End of File.
--- a/dbcreator/commsdatcreator/Inc/cdcprocessorglobal.h	Tue May 18 13:52:48 2010 +0100
+++ b/dbcreator/commsdatcreator/Inc/cdcprocessorglobal.h	Wed Jun 23 17:49:20 2010 +0100
@@ -65,9 +65,6 @@
                                 RPointerArray< HBufC >& aDestNames,
                                 RPointerArray< HBufC >& aDefCon );
 
-        // Stores the default connection values
-     //   void SetDefaultConnectionL();
-        
         /**
         * Destructor.
         */
--- a/dbcreator/commsdatcreator/Inc/cdcprocessorvpn.h	Tue May 18 13:52:48 2010 +0100
+++ b/dbcreator/commsdatcreator/Inc/cdcprocessorvpn.h	Wed Jun 23 17:49:20 2010 +0100
@@ -84,12 +84,8 @@
                        RPointerArray< HBufC >& aUnderLying );
         
         /**
-        * From CProcessorBase. Processes the actual tag.
-        * @param aFieldIDPresent shows if field id is read from input file
-        * @return the result of the process, KErrNone if the actual tag is
-        * valid.
+        * From CProcessorBase. 
         */
-        ////virtual void ProcessTagL( TBool aFieldIDPresent );
         virtual void ProcessSpecialFieldsL( TInt aField, HBufC* aTagPtr, TInt aDx );
 
     private:
@@ -105,4 +101,4 @@
 #endif PROCESSOR_VPN_H
 
 
-// End of File.
\ No newline at end of file
+// End of File.
--- a/dbcreator/commsdatcreator/Inc/cdcprocessorwlan.h	Tue May 18 13:52:48 2010 +0100
+++ b/dbcreator/commsdatcreator/Inc/cdcprocessorwlan.h	Wed Jun 23 17:49:20 2010 +0100
@@ -264,25 +264,6 @@
          */
         void SetExpandedEapListL( CMDBGenericRecord* aGeneric );
         
-        /*
-         * Creates expanded Eap list from the common Eap list
-         * @param aEapList the common Eap list from which the expanded list
-         *              will be created 
-         * @param aEnabledNeed indicates the type of the result expanded  
-         *           Eap list. If it is ETrue then the enabled expanded
-         *           Eap list will be created. Else the disbled one.
-         * @return The created expanded Eap list. It can be empty. 
-         */
-        HBufC8* ExpandedEapListLC( HBufC16* aEapList, TBool aEnabledNeed );
-  
-        /*
-         * Adds one item to the expanded Eap list
-         * @param aExpandedEapList to which the new item will be added.
-         * @param aSlice the common Eap list slice containing one 
-         *              3 digit long number with sign.
-         */
-        void AddToList( HBufC8* aExpandedEapList, TPtrC16 aSlice );
-
     private:
     
         void AddSecurityDataL( TInt aField, HBufC* aPtrTag, TBool aIsWep );
@@ -298,13 +279,6 @@
 		TUint FindCertificateEntryL( const CertificateEntry::TCertType aCertType, const TInt aEapIndex );
 		
 		void ConvertSubjectKeyIdToBinaryL( const HBufC16* const aSubjectKeyIdString, TDes& aBinaryKey);
-        /*
-        // @var Stores indexes of WEP fields
-        TInt iWEPIndex[KWEPKeyNumOfFields];
-        
-        // @var Stores indexes of WPA fields
-        TInt iWPAIndex[KWPAKeyNumOfFields];
-        */
         
         // @var Indicates the WLAN security mode
         TDbCreatorSecurityMode iSecurityMode;
@@ -322,15 +296,9 @@
        
         // @var HBufC for empty WEP and WPA tags
         HBufC* iEmptyTag;
-
-        // @var Stores indexes of WEP fields
-        ////RPointerArray< HBufC > iWepData;
         
         HBufC* iWepData[KWEPKeyNumOfFields];
         
-        // @var Stores indexes of WPA fields
-        ////RPointerArray< HBufC > iWpaData;
-        
         HBufC* iWpaData[KWPAKeyNumOfFields];
 
         TInt iDataStart;
@@ -343,4 +311,4 @@
 #endif PROCESSOR_WLAN_H
 
 
-// End of File.
\ No newline at end of file
+// End of File.
--- a/dbcreator/commsdatcreator/Src/cdccommsdatcreator.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/dbcreator/commsdatcreator/Src/cdccommsdatcreator.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -150,8 +150,6 @@
     CLOG_WRITE( "Processing started...\n" )
     CLOG_WRITE( "=====================\n" )               
 
-	iCmManager.OpenL();
-
     TDbCreatorInputCharSet charSet( ECharSetUnknown );//input character set
 
     //Creates access points
@@ -325,7 +323,7 @@
                   
 
     // Updates the IAPs that are not in destinations.
-    UpdateUncatCmsL( iCmInDest /*, iPluginNames, iPluginArray*/ );
+    UpdateUncatCmsL( iCmInDest );
 
     // Sets the underlying IAP/SNAPS for vpn IAPs    
     SetUnderlyingIapL( iUnderLying );
@@ -349,9 +347,6 @@
     // Sets linger settings
     SetLingerSettingsL( iLingerSettings );
 
-    // Sets the default connection    
-//    SetDefaultConnectionL( iDefCon );
-    
     // Logs IAPs in UDEB mode
     #ifdef _DEBUG
     LogIapIdsL();
@@ -435,7 +430,9 @@
     FeatureManager::InitializeLibL();
     iIsWlanS = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan );
     FeatureManager::UnInitializeLib();
-    CLOG_WRITE( "FeatureManager closed\n" )               
+    CLOG_WRITE( "FeatureManager closed\n" )
+
+    iCmManager.OpenL();
     }
     
 //------------------------------------------------
@@ -583,34 +580,6 @@
         }
     }
 
-// ---------------------------------------------------------
-// CCdcCommsDatCreator::ProcessDNL
-// ---------------------------------------------------------
-//
-/*void CCdcCommsDatCreator::SetDefaultConnectionL( RPointerArray< HBufC >& aDefCon )
-    {
-    // Sets the default connection    
-    if( aDefCon.Count() > 0 )
-        {
-        CLOG_WRITE_FORMAT( "SetDefaultConnectionL: %d\n", aDefCon.Count() )
-        CLOG_WRITE( "--------------------------------------\n" )
-
-        CProcessorGlobal* glb = CProcessorGlobal::NewL( iReader,
-                                               iCmManager,
-                                               iPluginArray,
-                                               iPluginNames,
-                                               iDestArray,
-                                               iDestNames,
-                                               aDefCon );
-        
-        CleanupStack::PushL( glb );
-        glb->SetDefaultConnectionL();
-        
-        CleanupStack::PopAndDestroy( glb );
-
-        CLOG_WRITE( "--------------------------------------\n" )
-        }
-    }*/
 
 // ---------------------------------------------------------
 // CCdcCommsDatCreator::SetUnderlyingIapL
--- a/dbcreator/commsdatcreator/Src/cdcprocessordn.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/dbcreator/commsdatcreator/Src/cdcprocessordn.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -187,18 +187,6 @@
                         }
                     }
                 break;
-                // SetIconL API removed from new cmmgr implementation
-                //case EDN_Icon:
-                //    {
-                //    TPtrC16 iconPtr = ptrTag->Right( ptrTag->Length() );
-                //    TLex16 lex( iconPtr );
-                //    TUint32 icon( 0 );
-                //    if ( lex.Val( icon, EDecimal ) == KErrNone )
-                //        {
-                //        iDestination.SetIconL( icon );
-                //        }
-                //    }
-                //break;
                 case EDN_Metadata:
                     {
                     if( !ptrTag->Compare( KPurposeUnknown ) )
--- a/dbcreator/commsdatcreator/Src/cdcprocessorwlan.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/dbcreator/commsdatcreator/Src/cdcprocessorwlan.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -379,7 +379,7 @@
             //WPA
             case EWPAPresharedKey:
             case EWPAKeyLength:
-            case EWPAListOfEAPs:
+            case EWPAEapMethod:
             case EWPAUseOfPresharedKey:
                 {
                 if( iSecurityMode != ESecurityModeWEP && iSecurityMode != ESecurityModeOpen )
@@ -638,6 +638,7 @@
 		    eapType->SetConfigurationL( *eap->iEapSettings );
 		    CLOG_WRITE( "eapType->SetConfiguration success!" );
 		    CleanupStack::PopAndDestroy( eapType );
+		    REComSession::FinalClose();
 			}
         }
         
@@ -1248,15 +1249,9 @@
     secModeField->SetL( iSecurityMode );
     
     CLOG_WRITE( "Wrote securityMode" );
+
     // Save EAP list
-    CMDBField<TDesC>* wlanEapsField = static_cast<CMDBField<TDesC>*>
-                                ( generic->GetFieldByIdL( KCDTIdWlanEaps ) );
-    wlanEapsField->SetL( WPAFieldData( EWPAListOfEAPs )->Des() );
-
-	CLOG_WRITE( "Wrote EAPList" );
-	
     SetExpandedEapListL( generic );
-
 	CLOG_WRITE( "Wrote expandedEapList" );	
 	
     // Save PreShared Key
@@ -1298,118 +1293,40 @@
 //
 void CProcessorWlan::SetExpandedEapListL( CMDBGenericRecord* generic )
     {
+    CLOG_WRITE( "CProcessorWlan::SetExpandedEapListL" )
     // Gets the text format eap list
-    HBufC16* eapList = WPAFieldData( EWPAListOfEAPs );
+    HBufC16* eapList = WPAFieldData( EWPAEapMethod );
     
     if ( eapList != NULL && 0 < eapList->Length() )
         {
-        
-        // Creates the expanded eap lists    
-        HBufC8* enabledEapList = ExpandedEapListLC( eapList, ETrue );
-        HBufC8* disabledEapList = ExpandedEapListLC( eapList, EFalse );
-        
-        // Save enabled EAP list
+
+        // Read EAP method and save it as enabled eap list.
+        // Fills expandedForm with 8 bytes: 0xFE, 6 zeros and EAP ID.
+        // That's the format expected by EAPOL.
+        TBuf8<8> expandedForm;
+        expandedForm.AppendFill( 0xFE, 1 );
+        expandedForm.AppendFill( 0x00, 6 );
+            
+        TUint8 resultByte;
+        TLex16 lex( eapList->Ptr() );
+        User::LeaveIfError( lex.Val( resultByte, EDecimal ) );
+        expandedForm.AppendFill( resultByte, 1 );
+        CLOG_WRITE_FORMAT( "CProcessorWlan::SetExpandedEapListL: EAP %d",
+                (int)resultByte)
+
         CMDBField<TDesC8>* wlanEnabledEapsField = static_cast<CMDBField<TDesC8>*>
                                 ( generic->GetFieldByIdL( KCDTIdWlanEnabledEaps ) );
-        wlanEnabledEapsField->SetL( enabledEapList->Des() );
+        wlanEnabledEapsField->SetL( expandedForm );
 
-        // Save disabled EAP list
+        // Save empty disabled EAP list
+        HBufC8* disabledEapList = HBufC8::NewLC(0);
         CMDBField<TDesC8>* wlanDisabledEapsField = static_cast<CMDBField<TDesC8>*>
                                 ( generic->GetFieldByIdL( KCDTIdWlanDisabledEaps ) );
         wlanDisabledEapsField->SetL( disabledEapList->Des() );
-        
         CleanupStack::PopAndDestroy( disabledEapList );
-        CleanupStack::PopAndDestroy( enabledEapList );
-        
         }
     }
 
-// ---------------------------------------------------------
-// CProcessorWlan::ExpandedEapListLC
-// ---------------------------------------------------------
-//
-HBufC8* CProcessorWlan::ExpandedEapListLC( HBufC16* aEapList, TBool aEnabledNeed )
-    {
-    // The eap list has a well defined form 
-    // so this parser supposes this concrete form like this:
-    // "+018,-023,+026,-021,-006"
-    
-    // Lenght of a 3 digit long signed number 
-     const TInt sliceLength = 4;
-     
-   // Max lenght of the resulted list.
-    // Adding one "," then divide the lenght of a slice+1   
-    TInt maxLenght = ( ( aEapList->Length()+1 ) / 5 ) * 8;
-    
-    HBufC8* expandedEapList = HBufC8::NewLC( maxLenght );
-    
-    TInt pos = 0;
-    while ( pos + sliceLength <= aEapList->Length() )
-        {
-        // Getting a slice
-        TPtrC16 slice = aEapList->Mid( pos, sliceLength );
-        
-        // Checks the sign
-        if( slice[0] == '+' )
-            {
-            if( aEnabledNeed )
-                {
-                AddToList( expandedEapList, slice );
-                }
-            }
-        else if( slice[0] == '-' )
-            {
-            if( !aEnabledNeed )
-                {
-                AddToList( expandedEapList, slice );
-                }
-            }
-        else
-            {
-            CLOG_WRITE_FORMAT( "! Error : Wrong Eap list format %S", aEapList );
-            }
-        
-        // Step over one slice and "," e.g. "+023,"
-        pos+=5;    
-        
-        }
-    if( pos != aEapList->Length() + 1)    
-        {
-        CLOG_WRITE_FORMAT( "! Warning : possible wrong Eap list format %S", aEapList );
-        }
-        
-    return expandedEapList;    
-    }
-
-// ---------------------------------------------------------
-// CProcessorWlan::AddToList
-// ---------------------------------------------------------
-//
-void CProcessorWlan::AddToList( HBufC8* aExpandedEapList, TPtrC16 aSlice )
-    {
-    // Fills the 8 byte form with "0xFE000000000000"        
-    TBuf8<8> expandedForm;
-    expandedForm.AppendFill( 0xFE, 1 );
-    expandedForm.AppendFill( 0x00, 6 );
-        
-    // Leave the "sign"     
-    TPtrC16 number = aSlice.Mid( 1 );    
-    TUint8 resultByte;
-    TLex16 lex( number );
-        
-    if( KErrNone == lex.Val( resultByte, EDecimal ) )
-        {
-        expandedForm.AppendFill( resultByte, 1 );
-        }
-    else
-        {
-        expandedForm.AppendFill( 0x00, 1 );
-        CLOG_WRITE( "! Error : Unlexed Eap number. 0 is addded" );
-        }
-
-    aExpandedEapList->Des().Append( expandedForm ); 
-    }
-
 
 // ---------------------------------------------------------
 // CProcessorWlan::WPAIndex
--- a/dbcreator/commsdatcreator/Src/cdcreaderxml.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/dbcreator/commsdatcreator/Src/cdcreaderxml.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -169,7 +169,7 @@
 //---------------
 //WPAPresharedKey         string    WPA/WPA2 pre-shared key in plain text. 
 //WPAKeyLength            integer   The length of the WPA/WPA2 pre-shared key.
-//WPAListOfEAPs           string    A list of EAPs in use
+//WPAEapMethod            string    A EAP method in use
 //WPAUseOfPresharedKey    string    WPA/WPA2 pre-shared key usage.
 //=============
 //VPN specific:
@@ -323,7 +323,7 @@
 //WPA security
 _LIT16( KWPAPresharedKey,           "WPAPresharedKey" );
 _LIT16( KWPAKeyLength,              "WPAKeyLength" );
-_LIT16( KWPAListOfEAPs,             "WPAListOfEAPs" );
+_LIT16( KWPAEapMethod,              "WPAEapMethod");
 _LIT16( KWPAUseOfPresharedKey,      "WPAUseOfPresharedKey" );
 
 //EAP security
@@ -494,15 +494,6 @@
 _LIT16( KWlanPowerMode,             "WlanPowerMode" );
 
 
-//maximum number of PacketData AP parameters
-const TInt KMaxPacketDataParam = 28;
-const TInt KMaxLANParam = 26;
-const TInt KMaxWLANParam = 125;
-const TInt KMaxGlobalParam = 42;
-const TInt KMaxVPNParam = 12;
-const TInt KMaxDNParam = 19;
-
-
 // ================= MEMBER FUNCTIONS =======================
 
 // ---------------------------------------------------------
@@ -912,26 +903,32 @@
     
     if ( iLine->FindF( KFeatureHeadPacketData ) != KErrNotFound )
         {
+        CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeaturePacketData" );
         feature = EFeaturePacketData;
         }
     else if ( iLine->FindF( KFeatureHeadWLAN ) != KErrNotFound )
         {
+        CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeatureWLAN" );
         feature = EFeatureWLAN;
         }
     else if ( iLine->FindF( KFeatureHeadLAN ) != KErrNotFound )
         {
+        CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeatureLAN" );
         feature = EFeatureLAN;
         }
     else if ( iLine->FindF( KFeatureHeadVPN ) != KErrNotFound )
         {
+        CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeatureVPN" );
         feature = EFeatureVPN;
         }
     else if ( iLine->FindF( KFeatureHeadDN ) != KErrNotFound )
         {
+        CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeatureDN" );
         feature = EFeatureDN;
         }
     else if ( iLine->FindF( KFeatureHeadGlobal ) != KErrNotFound )
         {
+        CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeatureGlobal" );
         feature = EFeatureGlobal;
         iFoundGlobal = ETrue;        
         }
@@ -1020,7 +1017,6 @@
 //
 TInt CReaderXML::DetectParam()
     {
-    TInt maxParam( 0 );           //maximum nunber of params in array
     TInt fieldId( KErrNotFound ); //field id of detected parameter 
     RArray<EInputParams> *params( NULL ); //pointer to the table used 
                                         //for or detection    
@@ -1028,27 +1024,21 @@
     switch ( CurrentFeature() )        
         {
         case EFeaturePacketData:
-            maxParam = KMaxPacketDataParam;
             params   = &iPDParams;
             break;
         case EFeatureWLAN:
-            maxParam = KMaxWLANParam;
             params   = &iWLanParams;
             break;
         case EFeatureLAN:
-            maxParam = KMaxLANParam;
             params   = &iLanParams;
             break;
         case EFeatureVPN:
-            maxParam = KMaxVPNParam;
             params   = &iVpnParams;
             break;
         case EFeatureDN:
-            maxParam = KMaxDNParam;
             params =   &iDNParams;
             break;
         case EFeatureGlobal:
-            maxParam = KMaxGlobalParam;
             params   = &iGlobalParams;
             break;
         default:
@@ -1057,14 +1047,13 @@
        
     //looks for parameter match
     HBufC16* paramName = ReadParam( EParamName );
-    TBool found ( EFalse );
-    
     if ( paramName == NULL )
             {
             return fieldId;
             }
 
-    for ( TInt idx = 0; idx < maxParam && !found; idx++ )
+    TBool found ( EFalse );
+    for ( TInt idx = 0; idx < params->Count() && !found; idx++ )
         {        
         if ( paramName->CompareF( (*params)[idx].iParam ) == 0 )
             {
@@ -1127,6 +1116,18 @@
             CLOG_WRITE_FORMAT( "! Warning: tag could not be allocated %S:",
                                      &tag );
             }
+// Debugging help; commented out for clearer log.
+//        else 
+//            {
+//            if (aSegment == EParamValue)
+//                {
+//                CLOG_WRITE_FORMAT( "CReaderXML::ReadParam: value %S", &tag );
+//                }
+//            else if (aSegment == EParamName)
+//                {
+//                CLOG_WRITE_FORMAT( "CReaderXML::ReadParam: name %S", &tag );
+//                }
+//            }
         }
     return ret;
     }
@@ -1642,7 +1643,7 @@
     iWLanParams.Append( EInputParams( EWEPKey4Data,                 KWEPKey4Data ) );
     iWLanParams.Append( EInputParams( EWPAPresharedKey,             KWPAPresharedKey ) );
     iWLanParams.Append( EInputParams( EWPAKeyLength,                KWPAKeyLength ) );
-    iWLanParams.Append( EInputParams( EWPAListOfEAPs,               KWPAListOfEAPs ) );
+    iWLanParams.Append( EInputParams( EWPAEapMethod,                KWPAEapMethod ) );
     iWLanParams.Append( EInputParams( EWPAUseOfPresharedKey,        KWPAUseOfPresharedKey ) );
     iWLanParams.Append( EInputParams( EEapGtcUsername,              KEapGtcUsername ) );
     iWLanParams.Append( EInputParams( EEapGtcSessionValidityTime,   KEapGtcSessionValidityTime ) );
--- a/dbcreator/commsdatcreatorrfsplugin/src/cdccommsdatcreatorrfsplugin.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/dbcreator/commsdatcreatorrfsplugin/src/cdccommsdatcreatorrfsplugin.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -18,7 +18,6 @@
 
 
 #include <centralrepository.h>
-#include "cdccommsdatcreatorcrkeys.h"
 
 #include "cdccommsdatcreatorrfsplugin.h"
 #include "cdclogger.h"
--- a/dbcreator/commsdatstartup/Inc/cdccommsdatstartup.h	Tue May 18 13:52:48 2010 +0100
+++ b/dbcreator/commsdatstartup/Inc/cdccommsdatstartup.h	Wed Jun 23 17:49:20 2010 +0100
@@ -67,17 +67,6 @@
     */
     void CheckCreatorUIdL();
 
-    /*
-    * Reads the database descriptor input file name
-    * @param out: Name of the database descriptor file 
-    */
-    void GetInputFileNameL( TFileName &aFileName );
-
-    /*
-    * Creates repository
-    */
-    void CreateRepositoryL();
-
    	/**
     * Resets the commsdat repository. This causes the default Commsdat
     * from z to be copied to c
@@ -89,15 +78,6 @@
     */
     void ResetEAPSettingsL();
     
-    /*
-    * Sets the startup status
-    * @param startup status to be set.
-    */
-    void SetStartupStatusL( TInt aStatus );
-    
-    // Repository
-    CRepository *iRepository;
-
     };
 
 
--- a/dbcreator/commsdatstartup/Src/cdccommsdatstartup.cpp	Tue May 18 13:52:48 2010 +0100
+++ b/dbcreator/commsdatstartup/Src/cdccommsdatstartup.cpp	Wed Jun 23 17:49:20 2010 +0100
@@ -27,7 +27,6 @@
 #include <etelpckt.h>
 
 #include <centralrepository.h>
-#include "cdccommsdatcreatorcrkeys.h"
 
 #include "cdccommsdatstartup.h"
 #include "cdccommsdatcreator.h"
@@ -37,6 +36,7 @@
 
 // CONSTANTS
 const TUid KCRUidCommsDb = { 0xcccccc00 };
+_LIT( KVariantXmlFile, "Z:\\private\\10281BC3\\VariantData_commsdat.xml" );
 
 //------------------------------------------------
 // CCdcCommsDatStartup::DoStartL
@@ -50,11 +50,6 @@
     
     CheckCreatorUIdL();
 
-    CreateRepositoryL();
-    
-    // Set status to not initialised
-    SetStartupStatusL( ECommsDatInitialisationFailed );
-
 	CLOG_WRITE( "CCdcCommsDatStartup::ResetCommsDatToDefaultL()" );
 	// In all RFS cases CommsDat must be reset 
 	ResetCommsDatToDefaultL();
@@ -71,136 +66,40 @@
 	// In all RFS cases CommsDat tables must be checked/created
 	cdc->CreateTablesL();
 	
-    TFileName fileName;
-    GetInputFileNameL( fileName );
-        
-    // CommsDatCreator feature is supported if input file name
-    // lenght is not 0. However file name lenght at least 5. (x.xml)     
-    if( fileName.Length() > 0 )
+    // If variant XML file exists, read it and create settings
+    TFileName fileName( KVariantXmlFile );
+    RFs fs;
+    User::LeaveIfError( fs.Connect() );
+    RFile file;
+    if ( KErrNone == file.Open( fs, fileName, EFileRead ) )
         {
+        file.Close();
         CLOG_WRITE( "CCdcCommsDatStartup::CommsDat generation enabled" );
-        
-        TFileName path( _L("Z:\\private\\10281BC3\\" )  );
-        path.Append( fileName );
+    
+        TRAPD(err, cdc->CreateCommsDatL( fileName ) );
+        if ( err != KErrNone )
+            {
+            // CommsDat creation leaved so something must be wrong.
+            // Reset CommsDat and EAP settings.
+            ResetCommsDatToDefaultL();
+            ResetEAPSettingsL();
+            cdc->CreateTablesL();
+            User::Leave( err );
+            }
 
-		CLOG_WRITE( "CCdcCommsDatStartup::CreateCommsDatL begin" );
-	
-        TRAPD(err, cdc->CreateCommsDatL( path ) );
-        if(err != KErrNone )
-        	{
-        	// CommsDat creation leaved so something must be wrong.
-        	// Reset CommsDat and EAP settings.
-        	ResetCommsDatToDefaultL();
-        	ResetEAPSettingsL();
-        	cdc->CreateTablesL();
-        	User::Leave( err );
-        	}
-
-        CLOG_WRITE( "CCdcCommsDatStartup::CreateCommsDatL end" );               
+        CLOG_WRITE( "CCdcCommsDatStartup::CommsDat generation done" );
         }
-       else
-       	{
-       	CLOG_WRITE( "CCdcCommsDatStartup::CommsDat generation disabled" );
-       	}
-        
-    // If nothing has leaved then everything is okay (both in disabled and
-    // enabled cases.
-    SetStartupStatusL( ECommsDatInitialised );
+    else
+        {
+        CLOG_WRITE( "CCdcCommsDatStartup::CommsDat generation disabled" );
+        }
+    fs.Close();
         
     CleanupStack::PopAndDestroy( cdc );
     CLOG_WRITE( "CCdcCommsDatStartup::DoStartL end" );
     }
 
 // ----------------------------------------------------------------------------
-// CCdcCommsDatStartup::CreateRepositoryL()
-// ----------------------------------------------------------------------------
-//    
-void CCdcCommsDatStartup::CreateRepositoryL()
-    {
-    CLOG_WRITE( "CCdcCommsDatStartup::CreateRepositoryL()" );
-
-    TRAPD( err, iRepository = CRepository::NewL( KCRUidCommsDatCreator ) );
-    
-    // Log is important now, because repository cannot contain the 
-    // error value if it cannot be used 
-    if( err != KErrNone )
-        {
-        CLOG_WRITE_FORMAT( "Repository could not created err : %d", err );
-        User::Leave( err );
-        }
-    }
-
-// ----------------------------------------------------------------------------
-// CCdcCommsDatStartup::SetStartupStatusL()
-// ----------------------------------------------------------------------------
-//    
-void CCdcCommsDatStartup::SetStartupStatusL( TInt aResult )
-    {
-    CLOG_WRITE_FORMAT( "CCdcCommsDatStartup::SetStartupStatusL() %d", aResult );
-
-    TInt err = iRepository->Set( KCommsDatCreatorStartupStatus, aResult );
-    if( err != KErrNone )
-        {
-        CLOG_WRITE_FORMAT( 
-                "Value could not write to repository err : %d", err );
-        User::Leave( err );
-        }
-
-    CLOG_WRITE_FORMAT( "CCdcCommsDatStartup::SetStartupStatusL() %d", aResult );
-    }
-
-// ----------------------------------------------------------------------------
-// CCdcCommsDatStartup::GetInputFileNameL()
-// ----------------------------------------------------------------------------
-//    
-void CCdcCommsDatStartup::GetInputFileNameL( TFileName &aFileName )
-    {
-    CLOG_WRITE( "CCdcCommsDatStartup::GetInputFileNameL()" );
-
-    TInt err = iRepository->Get( KCommsDatCreatorInputFileName, aFileName );
-    if( err != KErrNone )
-        {
-        CLOG_WRITE_FORMAT(
-                 "Value could not red from repository err : %d", err );
-        User::Leave( err );
-        }
-
-    CLOG_WRITE( "Input filename red" );
-
-    HBufC *fileName = aFileName.AllocLC();
-
-    CLOG_WRITE_FORMAT( "Input filename value : %S", fileName );
-    
-    CleanupStack::PopAndDestroy( fileName );
-    
-    // Check if file exists. If it doesn't reset filename.
-    RFs fs;
-    err = fs.Connect();//check
-    
-    if( err == KErrNone )
-    	{
-    	RFile file;
-    
-    	TFileName path( _L("Z:\\private\\10281BC3\\" )  );
-    	path.Append( aFileName );
-
-    	err = file.Open(fs, path, EFileRead);
-    	if( err != KErrNone )
-    	{
-	    	CLOG_WRITE( "CCdcCommsDatStartup::GetInputFileNameL() File does not exist");
-  	  	aFileName.Zero();
-    	}
-    	else
-    	{
-    		file.Close();
-    	}
-    	fs.Close();
-    	}
-    
-    CLOG_WRITE( "CCdcCommsDatStartup::GetInputFileNameL()" );
-    }
-
-// ----------------------------------------------------------------------------
 // CCdcCommsDatStartup::CheckCreatorUIdL()
 // ----------------------------------------------------------------------------
 //   	
@@ -211,7 +110,7 @@
     
     CLOG_WRITE( "CCdcCommsDatStartup::CheckCreatorUIdL" );
     
-    TUid creatorId = User::CreatorIdentity();
+    TUid creatorId = User::CreatorSecureId();
 
     CLOG_WRITE_FORMAT( "CreatorId : %x", creatorId );
    
@@ -229,10 +128,6 @@
 //   	
 CCdcCommsDatStartup::~CCdcCommsDatStartup()
     {
-    if( iRepository )
-        {
-        delete iRepository;
-        }
     }
 
 // ----------------------------------------------------------------------------
Binary file dbcreator/commsdatstartup/cenrep/keys_commsdatcreator.xls has changed
Binary file dbcreator/conf/commsdatcreator.confml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/conf/commsdatcreator.content	Wed Jun 23 17:49:20 2010 +0100
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<content xmlns="http://www.s60.com/xml/content/2">
+  <desc>Copy commsdat content</desc>
+    <output dir="content/private/10202be9" file="cccccc00.cre">
+    	<externalinput dir="${CIA_KCRUidCommsDatCreator.CommsdatInputPath}">
+    		<include files="cccccc00_empty.cre"/>
+    	</externalinput>
+    </output>
+</content>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/conf/commsdatcreator.ruleml	Wed Jun 23 17:49:20 2010 +0100
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ruleml xmlns="http://www.s60.com/xml/ruleml/2">
+
+<!-- correct cccccc00.cre to image --> 
+ <rule>
+  APs.AP or
+  VPN_APs.VPN_AP or
+  LAN_APs.LAN_AP or
+  WLAN_APs.WLAN_AP or 
+  configures 
+  CIA_KCRUidCommsDatCreator.CommsdatInputPath ='/epoc32/data/Z/private/10202be9'
+ </rule>
+ 
+</ruleml>
Binary file dbcreator/conf/commsdatcreator_10281BC8.crml has changed
--- a/dbcreator/group/bld.inf	Tue May 18 13:52:48 2010 +0100
+++ b/dbcreator/group/bld.inf	Wed Jun 23 17:49:20 2010 +0100
@@ -24,7 +24,8 @@
 PRJ_EXPORTS
 ../conf/commsdatcreator.confml				MW_LAYER_CONFML(commsdatcreator.confml)
 ../conf/commsdatcreator_01.gcfml			MW_LAYER_GCFML(commsdatcreator_01.gcfml)
-../conf/commsdatcreator_10281BC8.crml	MW_LAYER_CRML(commsdatcreator_10281BC8.crml)
+../conf/commsdatcreator.content         MW_LAYER_CRML(commsdatcreator.content)
+../conf/commsdatcreator.ruleml          MW_LAYER_CRML(commsdatcreator.ruleml)
 ../rom/commsdatcreator.iby						CORE_MW_LAYER_IBY_EXPORT_PATH(commsdatcreator.iby)
 
 
--- a/dbcreator/inc/cdccommon.h	Tue May 18 13:52:48 2010 +0100
+++ b/dbcreator/inc/cdccommon.h	Wed Jun 23 17:49:20 2010 +0100
@@ -162,7 +162,7 @@
     {
     EWPAPresharedKey = 0x00002000,    // Preshared key 
     EWPAKeyLength    = 0x00002001,    // Key length
-    EWPAListOfEAPs   = 0x00002002,    // List of EA plugins
+    EWPAEapMethod    = 0x00002002,    // EAP Method
     EWPAUseOfPresharedKey =0x00002003,// Use of preshared key
     };
     
--- a/dbcreator/inc/cdccommsdatcreatorcrkeys.h	Tue May 18 13:52:48 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
-* Copyright (c) 2007 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:   Commsdatcreator related central repository keys
-*
-*/
-
-
-
-#ifndef __CDC_COMMSDAT_CREATOR_CR_KEYS_H__
-#define __CDC_COMMSDAT_CREATOR_CR_KEYS_H__
-
-/** CommsDatCreator API */
-/** Provides access CDCCommsDatCreator Startup Status CenRep key*/
-
-const TUid KCRUidCommsDatCreator= {0x10281BC8};
-
-
-/** 
-* Defines the status of the CommsDat creation. 
-*
-* Integer type
-*
-* Default value: 0
-*/
-const TUint32 KCommsDatCreatorStartupStatus = 0x00000001;
-
-
-/** 
-* Defines the input file name for CommsDat creation. 
-*
-* String type
-*
-* Default value: VariantData.xml
-*/
-const TUint32 KCommsDatCreatorInputFileName = 0x00000002;
-
-/** 
-* Possible statuses of the CommsDat creation. 
-*
-* enum type
-*
-* Default value: 0
-*/
-
-enum TCommsDatCreatorStartupStatus
-	{
-	ECommsDatNotInitialised,
-	ECommsDatInitialised,
-	ECommsDatInitialisationFailed
-	};
-
-
-
-#endif // __CDC_COMMSDAT_CREATOR_CR_KEYS_H__
\ No newline at end of file
--- a/group/bld.inf	Tue May 18 13:52:48 2010 +0100
+++ b/group/bld.inf	Wed Jun 23 17:49:20 2010 +0100
@@ -26,7 +26,6 @@
 ../inc/meshpreface1.cfg         /epoc32/release/winscw/udeb/z/system/data/meshpreface1.cfg
 
 PRJ_MMPFILES
-#include "../accesspointcontrol/apcontrollistplugin/group/bld.inf"
 #include "../alwayson_net_plugin/group/bld.inf"
 #include "../apengine/group/bld.inf"
 #include "../bearermanagement/group/bld.inf"
--- a/ipcm_plat/bearer_settings_plugin_api/inc/cmpluginbaseeng.h	Tue May 18 13:52:48 2010 +0100
+++ b/ipcm_plat/bearer_settings_plugin_api/inc/cmpluginbaseeng.h	Wed Jun 23 17:49:20 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2010 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"
@@ -63,14 +63,14 @@
 /**
  * Record indexes for generic iap records in the Client instance table.
  */
-const TInt KIapRecordIndex = 0;
-const TInt KServiceRecordIndex = 1;
-const TInt KNetworkRecordIndex = 2;
-const TInt KWAPAPRecordIndex = 3;
-const TInt KWAPBearerRecordIndex = 4;
-const TInt KMetaDataRecordIndex = 5;
-const TInt KLocationRecordIndex = 6;
-const TInt KProxyRecordIndex = 7;
+const TInt KIapRecordIndex = 0;         // Mandatory record
+const TInt KServiceRecordIndex = 1;     // Mandatory record
+const TInt KNetworkRecordIndex = 2;     // Mandatory record
+const TInt KWAPAPRecordIndex = 3;       // Mandatory record
+const TInt KWAPBearerRecordIndex = 4;   // Mandatory record
+const TInt KMetaDataRecordIndex = 5;    // Mandatory record
+const TInt KLocationRecordIndex = 6;    // Optional record
+const TInt KProxyRecordIndex = 7;       // Mandatory record (flag in record tells if in use)
 
 
 // DATA TYPES
@@ -80,8 +80,8 @@
     ECmInt,
     ECmText,
     ECmText8
-    }TCMFieldTypes;
-    
+    } TCMFieldTypes;
+
 // Attributes that are related to bearer plugin creation
 enum TBearerCreationCommonAttributes
     {
@@ -90,13 +90,13 @@
                                                 * bearer creation related
                                                 * attributes
                                                 */
-    
+
     ECmExtensionLevel,          /**<
-                                * Return the extension level of the given 
+                                * Return the extension level of the given
                                 * bearer type. 1 means the level 1st.
                                 * (TUint32 - default: none - read only)
                                 */
-    
+
     ECmBearerCreationCommonAttributesEnd = 9999 /**<
                                                 * Marks the end of bearer
                                                 * creation related attributes
@@ -106,9 +106,9 @@
 /**
  * Flags for Iap metadata to indicate:
  * EMetaHighlight: If it's set it indicates that a connection method is
- *                 highlighted in Agent dialog. Only one connection 
+ *                 highlighted in Agent dialog. Only one connection
  *                 method can have this flag set.
- * EMetaHiddenAgent: If it's set it indicates that an connection method is 
+ * EMetaHiddenAgent: If it's set it indicates that an connection method is
  *                   hidden connection method in Agent dialog.
  */
 enum TCmMetaDataFields
@@ -120,7 +120,7 @@
 // FORWARD DECLARATIONS
 class CCmPluginBaseEng;
 class CCDIAPMetadataRecord;
-        
+
 // CLASS DECLARATION
 /**
  * Initialisation instance for plugin creation. Used in plugin
@@ -134,18 +134,18 @@
          * @param aSessionRef Reference for open Session handle to CommsDat.
          */
         IMPORT_C TCmPluginInitParam( CommsDat::CMDBSession& aSessionRef );
-        
+
     public:
         /**
          * Reference to CommsDat session handle.
          */
         CommsDat::CMDBSession& iSessionRef;
-            
+
         /**
          * Reserved for future.
          */
-        TAny*               iNotused1;
-        TAny*               iNotused2;
+        TAny* iNotused1;
+        TAny* iNotused2;
     };
 
 // CLASS DECLARATION
@@ -167,7 +167,7 @@
          * CCmClientPluginInstance object.
          */
         IMPORT_C static CCmClientPluginInstance* NewLC();
-        
+
         /**
          * Destructor
          */
@@ -178,7 +178,7 @@
          * Default constructor.
          */
         CCmClientPluginInstance();
-        
+
         /**
          * Second phase constructor.
          */
@@ -187,7 +187,7 @@
     public:
         /**
          * Pointer array for generic record pointers. Those are copies
-         * from CommsDat versions for the client usage. 
+         * from CommsDat versions for the client usage.
          */
         RPointerArray<CommsDat::CCDRecordBase> iGenRecordArray;
 
@@ -197,15 +197,15 @@
          * the different plugins.
          */
         RPointerArray<CommsDat::CCDRecordBase> iBearerSpecRecordArray;
-        
+
         /** Naming way of the CM. e.g. ENamingUnique */
-        CMManager::TNamingMethod               iNamingMethod;
-        
+        CMManager::TNamingMethod iNamingMethod;
+
         /** Boolean to keep the information if location is enabled */
-        TBool                                  iLocationEnabled;
-        
+        TBool iLocationEnabled;
+
         /** Iap Record id of this Connection Method */
-        TUint32                                iIapId;
+        TUint32 iIapId;
     };
 
 /**
@@ -219,11 +219,11 @@
 class CCmPluginBaseEng : public CBase
     {
     public:
-       /** 
+       /**
         * Destructor.
         */
        IMPORT_C virtual ~CCmPluginBaseEng();
-        
+
         /**
          * Create a new instance of the given bearer type plugin.
          * Used from CMM server to avoid using slow ECom framework.
@@ -231,28 +231,28 @@
          * @return Returns CCmPluginBaseEng type pointer which represents pure
          * bearer instance for the CMM server.
          */
-        virtual CCmPluginBaseEng* 
-                CreateInstanceL( TCmPluginInitParam& aInitParam ) const = 0;
+        virtual CCmPluginBaseEng* CreateInstanceL(
+                TCmPluginInitParam& aInitParam ) const = 0;
 
         /**
-         * Following GetBearerInfoXXXL methods return the values of the 
+         * Following GetBearerInfoXXXL methods return the values of the
          * requested attributes. These values are bearerspecific so they
          * don't vary between CMs with same bearer type.
          * @param aAttribute An attribute identifier.
          * @return Returns the value requested. If not found leaves with
-         * KErrNotFound error code. 
+         * KErrNotFound error code.
          */
-        IMPORT_C virtual TUint32 GetBearerInfoIntL( 
-                                                TUint32 aAttribute ) const = 0;
-        
-        IMPORT_C virtual TBool GetBearerInfoBoolL( 
-                                                TUint32 aAttribute ) const = 0;
+        IMPORT_C virtual TUint32 GetBearerInfoIntL(
+                TUint32 aAttribute ) const = 0;
+
+        IMPORT_C virtual TBool GetBearerInfoBoolL(
+                TUint32 aAttribute ) const = 0;
 
-        IMPORT_C virtual HBufC* GetBearerInfoStringL( 
-                                                TUint32 aAttribute ) const = 0;
-        
-        IMPORT_C virtual HBufC8* GetBearerInfoString8L( 
-                                                TUint32 aAttribute ) const = 0;
+        IMPORT_C virtual HBufC* GetBearerInfoStringL(
+                TUint32 aAttribute ) const = 0;
+
+        IMPORT_C virtual HBufC8* GetBearerInfoString8L(
+                TUint32 aAttribute ) const = 0;
 
         /**
          * Checks if the plug-in can handle the Connection Method identified
@@ -261,14 +261,14 @@
          * @return ETrue if plug-in can handle the IAP, otherwise EFalse.
          */
         virtual TBool CanHandleIapIdL( TUint32 aIapId ) const = 0;
-         
+
         /**
          * Checks if the plug-in can handle the given IAP record.
          * @param aIapRecord IAP record to be checked
          * @return ETrue if plug-in can handle the IAP, otherwise EFalse.
          */
-        virtual TBool CanHandleIapIdL( 
-                 CommsDat::CCDIAPRecord* aIapRecord ) const = 0;
+        virtual TBool CanHandleIapIdL(
+                CommsDat::CCDIAPRecord* aIapRecord ) const = 0;
 
     public: // Client interface
         /**
@@ -284,37 +284,37 @@
         IMPORT_C void ReLoadL();
 
         /**
-         * Creates a new Connection Method in memory. Call UpdateL() to store 
+         * Creates a new Connection Method in memory. Call UpdateL() to store
          * it in CommsDat. No CommsDat transaction operation is needed for this.
-         * @param aCmId Predefined iapid to be used when saving to CommsDat. 
+         * @param aCmId Predefined iapid to be used when saving to CommsDat.
          *       0 means that CommsDat gives the id.
          */
         IMPORT_C void CreateNewL( TUint32 aCmId );
-         
+
         /**
          * Creates a copy of an existing Connection Method.
          * @param aClientPluginInstance The source data to create the copy from.
          * @return CCmPluginBaseEng type pointer to an object which represents
          * the new plugin to the CMM server.
          */
-        IMPORT_C CCmPluginBaseEng* CreateCopyL( 
-                         CCmClientPluginInstance* aClientPluginInstance );
+        IMPORT_C CCmPluginBaseEng* CreateCopyL(
+                CCmClientPluginInstance* aClientPluginInstance );
 
         /**
          * Updates all records to commsdat. Data is copied from the client's copy
          * to the original data.
-         * This method does not open/rollback/commit transaction to CommsDat. 
+         * This method does not open/rollback/commit transaction to CommsDat.
          * Caller must handle transactions.
          */
-        IMPORT_C virtual void UpdateL( 
+        IMPORT_C virtual void UpdateL(
                 CCmClientPluginInstance* aClientPluginInstance );
 
         /*
-         * Deletes all the records of this CM from the database. 
-         * All the preventing conditions must be checked before calling this. 
-         * This method does not open/rollback/commit transaction to CommsDat. 
+         * Deletes all the records of this CM from the database.
+         * All the preventing conditions must be checked before calling this.
+         * This method does not open/rollback/commit transaction to CommsDat.
          * Caller must handle transactions.
-         */    
+         */
         IMPORT_C virtual void DeleteL();
 
         /**
@@ -322,53 +322,61 @@
          * @param aClientPluginInstance An object where to copy the data.
          */
         IMPORT_C void GetPluginDataL( CCmClientPluginInstance* aClientPluginInstance );
-        
+
         /**
-         * Following GetXXXXAttributeL methods return the values of the 
+         * Following GetXXXXAttributeL methods return the values of the
          * requested attributes. Attributes are returned from the client's
          * copy of the data. These values are CM specific.
          * @param aAttribute An attribute identifier.
          * @param aClientPluginInstance Client's copy of the data where
          * to get the return value.
          * @return Returns the value requested. If not found leaves with
-         * KErrNotFound error code. 
+         * KErrNotFound error code.
          */
-        IMPORT_C TUint32 GetIntAttributeL( 
-                            TUint32 aAttribute, 
-                            CCmClientPluginInstance* aClientPluginInstance );
-        
-        IMPORT_C TBool GetBoolAttributeL( 
-                            TUint32 aAttribute,
-                            CCmClientPluginInstance* aClientPluginInstance );
-                                         
-        IMPORT_C HBufC* GetStringAttributeL( 
-                            TUint32 aAttribute, 
-                            CCmClientPluginInstance* aClientPluginInstance );
-        
-        IMPORT_C HBufC8* GetString8AttributeL( 
-                            TUint32 aAttribute, 
-                            CCmClientPluginInstance* aClientPluginInstance );
+        IMPORT_C TUint32 GetIntAttributeL(
+                TUint32 aAttribute,
+                CCmClientPluginInstance* aClientPluginInstance );
+
+        IMPORT_C TBool GetBoolAttributeL(
+                TUint32 aAttribute,
+                CCmClientPluginInstance* aClientPluginInstance );
+
+        IMPORT_C HBufC* GetStringAttributeL(
+                TUint32 aAttribute,
+                CCmClientPluginInstance* aClientPluginInstance );
+
+        IMPORT_C HBufC8* GetString8AttributeL(
+                TUint32 aAttribute,
+                CCmClientPluginInstance* aClientPluginInstance );
 
         /**
-         * Following SetXXXXAttributeL methods set the given values 
-         * identified with attributes. Attributes are set to the 
+         * Following SetXXXXAttributeL methods set the given values
+         * identified with attributes. Attributes are set to the
          * client's copy of the data.
          * @param aAttribute An attribute identifier.
          * @param aValue Value to set.
          * @param aClientPluginInstance Client's copy of the data where
          * to set the given value.
          */
-        IMPORT_C void SetIntAttributeL( TUint32 aAttribute, TUint32 aValue, 
-                                        CCmClientPluginInstance* aClientPluginInstance );
-        
-        IMPORT_C void SetBoolAttributeL( TUint32 aAttribute, TBool aValue,
-                                         CCmClientPluginInstance* aClientPluginInstance );
-                                         
-        IMPORT_C void SetStringAttributeL( TUint32 aAttribute, const TDesC16& aValue,
-                                           CCmClientPluginInstance* aClientPluginInstance );
-        
-        IMPORT_C void SetString8AttributeL( TUint32 aAttribute, const TDesC8& aValue,
-                                            CCmClientPluginInstance* aClientPluginInstance );
+        IMPORT_C void SetIntAttributeL(
+                TUint32 aAttribute,
+                TUint32 aValue,
+                CCmClientPluginInstance* aClientPluginInstance );
+
+        IMPORT_C void SetBoolAttributeL(
+                TUint32 aAttribute,
+                TBool aValue,
+                CCmClientPluginInstance* aClientPluginInstance );
+
+        IMPORT_C void SetStringAttributeL(
+                TUint32 aAttribute,
+                const TDesC16& aValue,
+                CCmClientPluginInstance* aClientPluginInstance );
+
+        IMPORT_C void SetString8AttributeL(
+                TUint32 aAttribute,
+                const TDesC8& aValue,
+                CCmClientPluginInstance* aClientPluginInstance );
 
         /**
          * Requests CommsDat table ids to be observed for changes by the cmm
@@ -386,99 +394,99 @@
          * @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( 
+        IMPORT_C virtual void GetBearerTableIdsToBeObservedL(
                 RArray<TUint32>& aTableIdArray ) const = 0;
 
     public: // plugin interface
         /**
          * Creates a copy of all bearer specific CommsDat data for the client.
          * Called as result of GetPluginDataL().
-         * @param aRecordArray An array where the copy the records. Only 
+         * @param aRecordArray An array where the copy the records. Only
          * the bearer specific implementation knows the amount and order
          * of these records in the array.
          */
-        virtual void GetBearerSpecificRecordsL( 
+        virtual void GetBearerSpecificRecordsL(
                 RPointerArray<CommsDat::CCDRecordBase>& aRecordArray ) = 0;
 
         /**
          * Following GetBearerXXXXAttribute methods get only the
          * fields in records in pointer arrays(parameters).
          * @param aAttribute Identifier of the requested value.
-         * @param aGenRecordArray An array containing pointers to generic 
+         * @param aGenRecordArray An array containing pointers to generic
          * records of the Connection Method.
          * @param aBearerSpecRecordArray An array containing pointers to bearer
          * specific records of the Connection Method. aAttribute
          * parameter should identify one field(integer, boolean string)
-         * in one of these records. 
-         * @return Returns the requested value. In error case leaves with 
+         * in one of these records.
+         * @return Returns the requested value. In error case leaves with
          * system-wide error code.
          */
 
-        virtual TUint32 GetBearerIntAttributeL( 
-                TUint32 aAttribute, 
+        virtual TUint32 GetBearerIntAttributeL(
+                TUint32 aAttribute,
                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) = 0;
-        
-        virtual TBool GetBearerBoolAttributeL( 
-                TUint32 aAttribute, 
+
+        virtual TBool GetBearerBoolAttributeL(
+                TUint32 aAttribute,
                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) = 0;
-                                         
-        virtual HBufC* GetBearerStringAttributeL( 
-                TUint32 aAttribute, 
+
+        virtual HBufC* GetBearerStringAttributeL(
+                TUint32 aAttribute,
                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) = 0;
-        
-        virtual HBufC8* GetBearerString8AttributeL( 
-                TUint32 aAttribute, 
+
+        virtual HBufC8* GetBearerString8AttributeL(
+                TUint32 aAttribute,
                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) = 0;
 
         /**
          * Following SetBearerXXXXAttribute methods set only the
-         * fields in records in pointer arrays(parameters). They are not 
+         * fields in records in pointer arrays(parameters). They are not
          * allowed to update the original records in plugins.
          * @param aAttribute Identifier of the field to set.
          * @param aValue The value to set.
-         * @param aGenRecordArray An array containing pointers to generic 
+         * @param aGenRecordArray An array containing pointers to generic
          * records of the Connection Method.
          * @param aBearerSpecRecordArray An array containing pointers to bearer
          * specific records of the Connection Method. aAttribute
          * parameter should identify one field(integer, boolean string)
-         * in one of these records. 
+         * in one of these records.
          * @return None.
          */
 
-        virtual void SetBearerIntAttributeL( 
-                TUint32 aAttribute, 
-                TUint32 aValue, 
+        virtual void SetBearerIntAttributeL(
+                TUint32 aAttribute,
+                TUint32 aValue,
                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) = 0;
-        
-        virtual void SetBearerBoolAttributeL( 
-                TUint32 aAttribute, 
+
+        virtual void SetBearerBoolAttributeL(
+                TUint32 aAttribute,
                 TBool aValue,
                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) = 0;
-                                         
-        virtual void SetBearerStringAttributeL( 
-                TUint32 aAttribute, 
+
+        virtual void SetBearerStringAttributeL(
+                TUint32 aAttribute,
                 const TDesC16& aValue,
                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) = 0;
 
-        virtual void SetBearerString8AttributeL( 
-                TUint32 aAttribute, 
-                const TDesC8& aValue,                                                    
+        virtual void SetBearerString8AttributeL(
+                TUint32 aAttribute,
+                const TDesC8& aValue,
                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) = 0;
 
         /**
-         * Inherited class can make some preraration before CCmPluginBaseEng 
+         * Inherited class can make some preraration before CCmPluginBaseEng
          * would start loading bearer specific records.
          */
         virtual void PreparePluginToLoadRecordsL() = 0;
-        
+
         /**
          * Gives the plugin a possibility to do some preparing operations
          * if needed.
@@ -487,10 +495,10 @@
         virtual void PrepareToCopyDataL( CCmPluginBaseEng* aCopyInstance ) = 0;
 
         /**
-         * Inherited class can make some preraration before CCmPluginBaseEng 
+         * Inherited class can make some preraration before CCmPluginBaseEng
          * would start to update all the records.
          * @param aGenRecordArray Reference to generic records pointer array.
-         * @param aBearerSpecRecordArray Reference to bearer specific records 
+         * @param aBearerSpecRecordArray Reference to bearer specific records
          * pointer array.
          */
         virtual void PreparePluginToUpdateRecordsL(
@@ -498,14 +506,14 @@
                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) = 0;
 
         /**
-         * Plugin can prepare to delete the Connection Method with this 
-         * function. Called from DeleteL() before any record would be 
+         * Plugin can prepare to delete the Connection Method with this
+         * function. Called from DeleteL() before any record would be
          * deleted. No records are deleted here.
          */
         virtual void PrepareToDeleteRecordsL(){};
 
         /**
-         * Loads the service record. Service record type is known and loaded by 
+         * Loads the service record. Service record type is known and loaded by
          * plugin(bearer specific) part of the implementation even if the record
          * is saved to the generic side. Service record is linked to IAP record.
          */
@@ -519,17 +527,17 @@
         /**
          * Update service record.
          * @param aGenRecordArray Reference to generic records pointer array.
-         * @param aBearerSpecRecordArray Reference to bearer specific records 
+         * @param aBearerSpecRecordArray Reference to bearer specific records
          * pointer array.
          */
-        virtual void UpdateServiceRecordL( 
+        virtual void UpdateServiceRecordL(
                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) = 0;
 
         /**
          * Copies the service record. Bearer specific part knows the type of it's
          * service record.
-         * @return Returns the service record pointer. 
+         * @return Returns the service record pointer.
          */
         virtual CommsDat::CCDRecordBase* CopyServiceRecordL() = 0;
 
@@ -541,14 +549,14 @@
 
         /**
          * Returns the service record name of the Connection Method.
-         * @param aServiceName Name of the service record the CM's iap record 
+         * @param aServiceName Name of the service record the CM's iap record
          * points to.
          */
         virtual void ServiceRecordNameLC( HBufC* &aServiceName ) = 0;
 
         /**
-         * Inherited class loads all the bearer specific records after 
-         * loading generic records. Called from LoadL(). 
+         * Inherited class loads all the bearer specific records after
+         * loading generic records. Called from LoadL().
          */
         virtual void LoadBearerRecordsL() = 0;
 
@@ -560,9 +568,9 @@
         /**
          * Update bearer specific records.
          * @param aGenRecordArray Reference to generic records pointer array.
-         * @param aBearerSpecRecordArray Reference to bearer specific records 
+         * @param aBearerSpecRecordArray Reference to bearer specific records
          */
-        virtual void UpdateBearerRecordsL( 
+        virtual void UpdateBearerRecordsL(
                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) = 0;
 
@@ -572,50 +580,50 @@
          */
         virtual void DeleteBearerRecordsL() = 0;
 
-         /** 
-          * Resets the bearer specific records. 
+         /**
+          * Resets the bearer specific records.
           */
          virtual void ResetBearerRecords() = 0;
 
         /**
-         * Copies the bearer specific records to copy instance given as 
-         * parameter. 
+         * Copies the bearer specific records to copy instance given as
+         * parameter.
          * @param aCopyInstance Pointer to instance where to copy.
          */
         virtual void CopyBearerRecordsL( CCmPluginBaseEng* aCopyInstance ) = 0;
 
         /**
          * Returns the bearer record id of the Connection Method.
-         * @param aRecordId Id of the bearer record this CM's iap record 
+         * @param aRecordId Id of the bearer record this CM's iap record
          * points to.
          */
         virtual void BearerRecordIdL( TUint32& aRecordId ) = 0;
 
         /**
          * Returns the bearer record name of the Connection Method.
-         * @param aBearerName Name of the bearer record this CM's iap record 
+         * @param aBearerName Name of the bearer record this CM's iap record
          * points to.
          */
         virtual void BearerRecordNameLC( HBufC* &aBearerName ) = 0;
 
     protected:
-        /** 
-         * Constructor 
+        /**
+         * Constructor
          */
         IMPORT_C CCmPluginBaseEng( TCmPluginInitParam *aInitParam );
-        
-        /** 
+
+        /**
          * Second phase constructor
          */
         IMPORT_C virtual void ConstructL();
-        
+
         /**
          * Checks if the ECmName attribute was set since the last update.
          * If so, name is updated in passed record
          * @param aSrcRecord record to be checked against
          * @param aDestRecord record to be checked against aSrcRecord
          */
-        IMPORT_C void CheckIfNameModifiedL( 
+        IMPORT_C void CheckIfNameModifiedL(
                 CommsDat::CCDRecordBase* aSrcRecord,
                 CommsDat::CCDRecordBase* aDestRecord ) const;
 
@@ -629,8 +637,8 @@
          * @param aDNS1 first DNS server address
          * @param aDNS1 secord DNS server address
          * @param aDNSFromServer DNS address from server flag
-         */                                            
-        IMPORT_C void CheckDNSServerAddressL( 
+         */
+        IMPORT_C void CheckDNSServerAddressL(
                 TBool aIPv6,
                 CommsDat::CMDBField<TDesC>& aDNS1,
                 CommsDat::CMDBField<TDesC>& aDNS2,
@@ -638,7 +646,7 @@
 
     private:
         /**
-         * Handles all the Connection Method data copying to instance given as 
+         * Handles all the Connection Method data copying to instance given as
          * parameter. This is called from CreateCopyL().
          * @ param aCopyInstance Pointer to plugin to copy the data.
          */
@@ -654,28 +662,41 @@
         /**
          * Copies the record identified by aRecordIdentifier to copy instance.
          * @param aRecordIdentifier Identifies the record which is copied copy.
-         * @param aCopyInstance Pointer to plugin to copy the data. 
+         * @param aCopyInstance Pointer to plugin to copy the data.
          */
-        void CopyRecordDataL( TUint32 aRecordIdentifier,
-                              CCmPluginBaseEng* aCopyInstance );
+        void CopyRecordDataL(
+                TUint32 aRecordIdentifier,
+                CCmPluginBaseEng* aCopyInstance );
+
+        /**
+         * Copies the values and attributes of all fields from aSource-record
+         * into aDestination record.
+         * Does not copy the record element ID. Also, does not touch any field
+         * in aDestination-record that is NULL in aSource-record.
+         * @param aSource The record that is copied from.
+         * @param aDestination The record that is copied to.
+         */
+        void CopyRecordFieldsL(
+                CommsDat::CMDBRecordBase& aSource,
+                CommsDat::CMDBRecordBase& aDestination );
 
         /**
          * Creates proxy record and sets the proxy settings enabled for this
          * Connection Method.
          */
         void EnableProxyL( TBool aEnable );
-        
+
         /**
-         * Creates location record and sets the location enabled for this 
+         * Creates location record and sets the location enabled for this
          * Connection Method.
          */
         void EnableLocationL( TBool aEnable );
 
         /**
-         * Calls all the loading methods. 
+         * Calls all the loading methods.
          */
         void DoLoadL( TUint32 aIapId );
-        
+
         /**
          * Loads IAP record.
          * @param aIapId Identifies the IAP record to load.
@@ -693,7 +714,7 @@
          * of calling LoadL().
          */
         void LoadNetworkRecordL();
-        
+
         /**
          * Loads location record related to this IAP. This is called as a result
          * of calling LoadL().
@@ -711,12 +732,12 @@
          * of calling LoadL().
          */
         void LoadMetadataRecordL();
-        
+
         /**
          * Following methods are called as a result of calling method UpdateL().
          * Each method overwrites the original data in memory with the client copy
          * of that data. Client data has all the possible changes set by client.
-         * After overwrite the data is written to CommsDat. 
+         * After overwrite the data is written to CommsDat.
          * @param aClientPluginInstance The client copy of the original data with the
          * possible changes.
          */
@@ -728,14 +749,14 @@
         void UpdateWapRecordL( CCmClientPluginInstance* aClientPluginInstance );
         void UpdateMetadataRecordL( CCmClientPluginInstance* aClientPluginInstance );
         void UpdateServiceRecordL( CCmClientPluginInstance* aClientPluginInstance );
-        
+
         /**
         * Creates new wap records.
         */
         void NewWapRecordL();
 
         /**
-         * Searches the WAP records related to this iap. This is called as a 
+         * Searches the WAP records related to this iap. This is called as a
          * result of LoadL().
          * @return Returns pointer to WAP IP record. If it's not found NULL is
          * returned.
@@ -748,14 +769,14 @@
         * @return Returns metadata record pointer.
         */
         CCDIAPMetadataRecord* NewMetadataRecordL( TBool aSetDef );
-        
+
         /**
-         * Searches the metadata record belonging to this iap. This is called as a 
+         * Searches the metadata record belonging to this iap. This is called as a
          * result of LoadL().
          * @return Returns pointer to WAP IP record. If it's not found NULL is
          * returned.
          */
-        CCDIAPMetadataRecord* FindMetadataRecordL();
+        CCDIAPMetadataRecord* FindMetadataRecordL(); //TODO, check comment, return value...
 
         /**
         * Set attribute flag on the given record.
@@ -763,19 +784,21 @@
         * @param aAttribute Attribute to be set.
         * @param aSet ETrue to set, EFalse to clear
         */
-        void SetAttribute( CommsDat::CCDRecordBase* aRecord, 
-                           TUint32 aAttribute, 
-                           TBool aSet );
-                           
+        void SetAttribute(
+                CommsDat::CCDRecordBase* aRecord,
+                TUint32 aAttribute,
+                TBool aSet );
+
         /**
         * Copy the attributes of the source record to the destination.
         * @param aSrcRecord record of which attributes are copied
         * @param ADstRecord record of which attributes are set
         */
-        void CopyAttributes( CommsDat::CCDRecordBase* aSrcRecord, 
-                             CommsDat::CCDRecordBase* aDstRecord );
+        void CopyAttributes(
+                CommsDat::CCDRecordBase* aSrcRecord,
+                CommsDat::CCDRecordBase* aDstRecord );
 
-        
+
         /**
         * Returns the default location record id.
         * @return Returns the default location record id.
@@ -785,16 +808,16 @@
     private:
 
         /**
-         * Gives a possibility to make some prerarations before 
+         * Gives a possibility to make some prerarations before
          * starting to load bearer specific records.
          */
         void PrepareToLoadRecordsL();
 
         /**
-         * Gives a possibility to make some prerarations before 
+         * Gives a possibility to make some prerarations before
          * starting to update bearer specific records.
          */
-        void PrepareToUpdateRecordsL( 
+        void PrepareToUpdateRecordsL(
                 CCmClientPluginInstance* aClientPluginInstance );
 
         /**
@@ -802,7 +825,7 @@
          * @return Returns the element id of the iap record.
          */
         CommsDat::TMDBElementId IAPRecordElementId() const;
-        
+
         /**
          * Checks the protection attribute of the IAP.
          * @return Returns ETrue if the IAP is protected. Otherwise returns
@@ -813,36 +836,35 @@
         /**
          * Sets the name of the proxy server to proxy record. If name's
          * length is 0, proxyport is set to 0 and proxyserver usage
-         * boolean is set to EFalse. If the name is longer than 0, 
+         * boolean is set to EFalse. If the name is longer than 0,
          * boolean is set to ETrue.
          * @param aProxyServer Address to be set.
          * @param Record pointer where to set.
          */
-        void SetProxyServerNameL( const TDesC& aProxyServer,
-                                  CommsDat::CCDRecordBase* aProxyRecord );
+        void SetProxyServerNameL(
+                const TDesC& aProxyServer,
+                CommsDat::CCDRecordBase* aProxyRecord );
 
         /**
          * Sets a name to IAP.
          * @param aName Name to set.
-         * @param aClientPluginInstance Client copy of data where to set the 
+         * @param aClientPluginInstance Client copy of data where to set the
          * name. UpdateL() updates the name to the CommsDat.
          */
-        void SetNameL( const TDesC& aName,
-                       CommsDat::CCDRecordBase* aIapRecord,
-                       const CMManager::TNamingMethod aNamingMethod );
+        void SetNameL(
+                const TDesC& aName,
+                CommsDat::CCDRecordBase* aIapRecord,
+                const CMManager::TNamingMethod aNamingMethod );
 
         /**
          * Following methods are called as a result of SetNameL() to
          * make a valid name of the given string.
          */
-        HBufC* DoMakeValidNameL( const TDesC& aName, 
-                                 const TUint32& aIapId );
-        HBufC* EnsureMaxLengthLC( const TDesC& aName, 
-                                  TBool& aChanged );
+        HBufC* DoMakeValidNameL( const TDesC& aName, const TUint32& aIapId );
+        HBufC* EnsureMaxLengthLC( const TDesC& aName, TBool& aChanged );
         TPtrC GetPrefix( const TDesC& aName );
         TInt GetPostfix( const TDesC& aName, const TDesC& aPrefix );
-        TBool IsValidNameL( const TDesC& aNameText,
-                            const TUint32& aIapId );
+        TBool IsValidNameL( const TDesC& aNameText, const TUint32& aIapId );
         HBufC* EscapeTextLC( const TDesC& aLiteral );
         void SetDefaultNameL( const TDesC& aName );
 
@@ -854,8 +876,8 @@
 
         /**
         * Check if the passed IP address is one of these:
-        * - empty string    -   
-        * - '0:0:0:0:0:0:0:0' 
+        * - empty string    -
+        * - '0:0:0:0:0:0:0:0'
         * - 'fec0:000:0000:ffff::1'
         * - 'fec0:000:0000:ffff::2'
         * @param aIpAddress IP address to be checked
@@ -863,7 +885,7 @@
         CMManager::TIPv6Types ClassifyIPv6Address( const TDesC& aIpv6Address );
 
     public: // Data
-    
+
         // Required attribute for the framework
         // (An identifier used during destruction)
         TUid    iDtor_ID_Key;
@@ -877,7 +899,7 @@
         CommsDat::CMDBSession& iSession;
 
         /**
-         * Generic record pointers. 
+         * Generic record pointers.
          */
         CommsDat::CCDIAPRecord*             iIapRecord;
         CommsDat::CCDProxiesRecord*         iProxyRecord;
@@ -887,29 +909,29 @@
         CommsDat::CCDWAPAccessPointRecord*  iWapAPRecord;
         CommsDat::CCDWAPIPBearerRecord*     iWapIPBearerRecord;
         CCDIAPMetadataRecord*               iMetaDataRecord;
-        
+
     private:
         /**
          * IAP record id of the CM. 0 means that this is not stored to CommsDat
-         * yet. If in UpdateL phase iap record has an id but iIapId == 0 --> 
+         * yet. If in UpdateL phase iap record has an id but iIapId == 0 -->
          * predefined iap id
          */
-        TUint32         iIapId;
+        TUint32 iIapId;
 
         /**
          * Naming method of the CM.
          */
-        CMManager::TNamingMethod    iNamingMethod;
-        
+        CMManager::TNamingMethod iNamingMethod;
+
         /**
-         * Table id of the iap metadata table. 
+         * Table id of the iap metadata table.
          */
-        CommsDat::TMDBElementId     iMetadataTableId;
-        
+        CommsDat::TMDBElementId iMetadataTableId;
+
         /**
          * Identifies if the location is enabled.
          */
-        TBool                       iLocationEnabled;
+        TBool iLocationEnabled;
     };
-    
+
 #endif // CMPLUGINBASEENG_H
--- a/ipcm_plat/connection_settings_shim_api/inc/cmmanagerdefines_shim.h	Tue May 18 13:52:48 2010 +0100
+++ b/ipcm_plat/connection_settings_shim_api/inc/cmmanagerdefines_shim.h	Wed Jun 23 17:49:20 2010 +0100
@@ -1,19 +1,19 @@
 /*
- * 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:  
- * Defines for data types and attributes used in CmManagerShim interface.
- */
+* 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:  
+* Defines for data types and attributes used in CmManagerShim interface.
+*/
 
 #ifndef CMMANAGERDEFINES_SHIM_H
 #define CMMANAGERDEFINES_SHIM_H
@@ -220,6 +220,8 @@
         //!  From TConnectionMethodWlanSpecificAttributes in cmpluginwlandef.h
         WlanScanSSID                    = CMManager::EWlanScanSSID,
         //!  From TConnectionMethodWlanSpecificAttributes in cmpluginwlandef.h
+        WlanChannelID                   = CMManager::EWlanChannelID,
+        //!  From TConnectionMethodWlanSpecificAttributes in cmpluginwlandef.h
         WlanWepKey1InHex                = CMManager::EWlanWepKey1InHex,
         //!  From TConnectionMethodWlanSpecificAttributes in cmpluginwlandef.h
         WlanWepKey2InHex                = CMManager::EWlanWepKey2InHex,